2016-07-08 06:33:07 +08:00
|
|
|
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
|
|
|
|
2016-03-05 03:56:22 +08:00
|
|
|
|
|
|
|
declare var window;
|
2016-02-17 17:17:40 +08:00
|
|
|
|
|
|
|
/**
|
2016-03-14 03:45:07 +08:00
|
|
|
* @name App Rate
|
2016-03-13 07:30:16 +08:00
|
|
|
* @description
|
2016-02-17 17:17:40 +08:00
|
|
|
* The AppRate plugin makes it easy to prompt the user to rate your app, either now, later, or never.
|
|
|
|
*
|
2016-03-05 05:42:21 +08:00
|
|
|
* Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate).
|
2016-02-17 17:17:40 +08:00
|
|
|
*
|
|
|
|
* @usage
|
2016-07-20 23:17:09 +08:00
|
|
|
* ```typescript
|
|
|
|
* import { AppRate } from 'ionic-native';
|
2016-03-25 01:00:18 +08:00
|
|
|
*
|
2016-08-02 02:01:54 +08:00
|
|
|
* AppRate.preferences.storeAppURL = {
|
|
|
|
* ios: '<my_app_id>',
|
|
|
|
* android: 'market://details?id=<package_name>',
|
|
|
|
* };
|
2016-03-25 01:00:18 +08:00
|
|
|
*
|
2016-03-05 05:42:21 +08:00
|
|
|
* AppRate.promptForRating();
|
2016-02-17 17:17:40 +08:00
|
|
|
* ```
|
2016-07-02 03:16:52 +08:00
|
|
|
*
|
|
|
|
* @advanced
|
|
|
|
*
|
|
|
|
* Rating dialog preferences
|
|
|
|
*
|
|
|
|
* | Option | Type | Default | Description |
|
|
|
|
* |------------------------------|------------|---------|----------------------------------------------------------------------------------------|
|
|
|
|
* | useLanguage | `String` | null | custom BCP 47 language tag |
|
|
|
|
* | displayAppName | `String` | '' | custom application title |
|
|
|
|
* | promptAgainForEachNewVersion | `Boolean` | true | show dialog again when application version will be updated |
|
|
|
|
* | usesUntilPrompt | `Integer` | 3 | count of runs of application before dialog will be displayed |
|
|
|
|
* | openStoreInApp | `Boolean` | false | leave app or no when application page opened in app store (now supported only for iOS) |
|
|
|
|
* | useCustomRateDialog | `Boolean` | false | use custom view for rate dialog |
|
|
|
|
* | callbacks.onButtonClicked | `Function` | null | call back function. called when user clicked on rate-dialog buttons |
|
|
|
|
* | callbacks.onRateDialogShow | `Function` | null | call back function. called when rate-dialog showing |
|
|
|
|
* | storeAppURL.ios | `String` | null | application id in AppStore |
|
|
|
|
* | storeAppURL.android | `String` | null | application URL in GooglePlay |
|
|
|
|
* | storeAppURL.blackberry | `String` | null | application URL in AppWorld |
|
|
|
|
* | storeAppURL.windows8 | `String` | null | application URL in WindowsStore |
|
|
|
|
* | customLocale | `Object` | null | custom locale object |
|
|
|
|
|
2016-02-17 17:17:40 +08:00
|
|
|
*/
|
|
|
|
@Plugin({
|
2016-03-13 07:30:16 +08:00
|
|
|
plugin: 'cordova-plugin-apprate',
|
|
|
|
pluginRef: 'AppRate',
|
2016-03-15 01:38:35 +08:00
|
|
|
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['Android', 'iOS']
|
2016-02-17 17:17:40 +08:00
|
|
|
})
|
|
|
|
export class AppRate {
|
|
|
|
|
|
|
|
/**
|
2016-07-02 03:16:52 +08:00
|
|
|
* Configure various settings for the Rating View.
|
|
|
|
* See table below for options
|
2016-02-17 17:17:40 +08:00
|
|
|
*/
|
2016-03-05 03:56:22 +08:00
|
|
|
@CordovaProperty
|
2016-03-11 04:54:25 +08:00
|
|
|
static get preferences() { return window.AppRate.preferences; }
|
2016-02-17 17:17:40 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prompts the user for rating
|
2016-03-16 05:09:53 +08:00
|
|
|
* @param {boolean} immediately Show the rating prompt immediately.
|
2016-02-17 17:17:40 +08:00
|
|
|
*/
|
|
|
|
@Cordova()
|
2016-07-08 06:33:07 +08:00
|
|
|
static promptForRating(immediately: boolean): void { };
|
2016-02-17 17:17:40 +08:00
|
|
|
|
|
|
|
}
|