70 lines
3.4 KiB
TypeScript
Raw Normal View History

2016-07-08 00:33:07 +02:00
import { Cordova, CordovaProperty, Plugin } from './plugin';
declare var window;
2016-02-17 04:17:40 -05:00
/**
2016-03-13 15:45:07 -04:00
* @name App Rate
* @description
2016-02-17 04:17:40 -05:00
* The AppRate plugin makes it easy to prompt the user to rate your app, either now, later, or never.
*
2016-03-04 15:42:21 -06: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 04:17:40 -05:00
*
* @usage
* ```typescript
* import { AppRate } from 'ionic-native';
*
2016-08-01 14:01:54 -04:00
* AppRate.preferences.storeAppURL = {
* ios: '<my_app_id>',
* android: 'market://details?id=<package_name>',
* };
*
2016-11-09 01:02:10 +03:00
* AppRate.promptForRating(false);
2016-02-17 04:17:40 -05:00
* ```
2016-07-01 15:16:52 -04: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 04:17:40 -05:00
*/
@Plugin({
pluginName: 'AppRate',
plugin: 'cordova-plugin-apprate',
pluginRef: 'AppRate',
2016-03-14 13:38:35 -04:00
repo: 'https://github.com/pushandplay/cordova-plugin-apprate',
platforms: ['Android', 'iOS']
2016-02-17 04:17:40 -05:00
})
export class AppRate {
/**
2016-07-01 15:16:52 -04:00
* Configure various settings for the Rating View.
* See table below for options
2016-02-17 04:17:40 -05:00
*/
@CordovaProperty
static preferences;
2016-02-17 04:17:40 -05:00
/**
* Prompts the user for rating
* @param {boolean} immediately Show the rating prompt immediately.
2016-02-17 04:17:40 -05:00
*/
@Cordova()
2016-07-08 00:33:07 +02:00
static promptForRating(immediately: boolean): void { };
2016-02-17 04:17:40 -05:00
}