From 9c75a0613168fcb4309acf2d0eae66a30e49b42e Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Fri, 20 Jan 2017 22:11:57 +0100 Subject: [PATCH] feat(launch-review): add LaunchReview plugin (#949) * Add LaunchReview * Fix pluginRef --- src/index.ts | 3 +++ src/plugins/launch-review.ts | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/plugins/launch-review.ts diff --git a/src/index.ts b/src/index.ts index 42144bd26..abb0b4b95 100644 --- a/src/index.ts +++ b/src/index.ts @@ -70,6 +70,7 @@ import { Instagram } from './plugins/instagram'; import { IsDebug } from './plugins/is-debug'; import { Keyboard } from './plugins/keyboard'; import { LaunchNavigator } from './plugins/launchnavigator'; +import { LaunchReview } from './plugins/launch-review'; import { LocalNotifications } from './plugins/localnotifications'; import { LocationAccuracy } from './plugins/location-accuracy'; import { MediaCapture } from './plugins/media-capture'; @@ -187,6 +188,7 @@ export * from './plugins/instagram'; export * from './plugins/is-debug'; export * from './plugins/keyboard'; export * from './plugins/launchnavigator'; +export * from './plugins/launch-review'; export * from './plugins/localnotifications'; export * from './plugins/location-accuracy'; export * from './plugins/market'; @@ -305,6 +307,7 @@ window['IonicNative'] = { IsDebug, Keyboard, LaunchNavigator, + LaunchReview, LocalNotifications, LocationAccuracy, Market, diff --git a/src/plugins/launch-review.ts b/src/plugins/launch-review.ts new file mode 100644 index 000000000..dbd8ae69b --- /dev/null +++ b/src/plugins/launch-review.ts @@ -0,0 +1,36 @@ +import { Plugin, Cordova } from './plugin'; + +/** + * @name LaunchReview + * @description + * + * This launches the native store app in order for the user to leave a review. + * On Android, the plugin opens the the app's storepage in the Play Store where the user can leave a review by pressing the stars to give a rating. + * On iOS, the plugin opens the app's storepage in the App Store and focuses the Review tab, where the user can leave a review by pressing "Write a review". + * + * @usage + * ``` + * import { LaunchReview } from 'ionic-native'; + * + * const appId: string = 'yourAppId'; + * LaunchReview.launch(appId) + * .then(() => console.log('Successfully launched store app'); + * ``` + */ +@Plugin({ + pluginName: 'LaunchReview', + plugin: 'cordova-launch-review', + pluginRef: 'LaunchReview', + repo: 'https://github.com/dpa99c/cordova-launch-review', + platforms: ['Android', 'iOS'] +}) +export class LaunchReview { + + /** + * Launch store app using given app ID + * @returns {Promise} + */ + @Cordova() + static launch(appId: string): Promise { return; } + +}