mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
refractor(apprate): export interfaces and improve docs
This commit is contained in:
parent
8b48d6c275
commit
80d9fe2211
@ -1,8 +1,94 @@
|
||||
import { Cordova, CordovaProperty, Plugin } from './plugin';
|
||||
|
||||
|
||||
declare var window;
|
||||
|
||||
export interface AppRatePreferences {
|
||||
|
||||
/**
|
||||
* Custom BCP 47 language tag
|
||||
*/
|
||||
useLanguage?: string;
|
||||
|
||||
/**
|
||||
* Custom application title
|
||||
*/
|
||||
displayAppName?: string;
|
||||
|
||||
/**
|
||||
* Show dialog again when application version will be updated. Defaults to `true`
|
||||
*/
|
||||
promptAgainForEachNewVersion?: boolean;
|
||||
|
||||
/**
|
||||
* count of runs of application before dialog will be displayed. Defaults to `3`
|
||||
*/
|
||||
usesUntilPrompt?: number;
|
||||
|
||||
/**
|
||||
* leave app or no when application page opened in app store (now supported only for iOS). Defaults to `false`
|
||||
*/
|
||||
openStoreInApp?: boolean;
|
||||
|
||||
/**
|
||||
* use custom view for rate dialog. Defaults to `false`
|
||||
*/
|
||||
useCustomRateDialog?: boolean;
|
||||
|
||||
/**
|
||||
* Custom locale object
|
||||
*/
|
||||
customLocale?: any;
|
||||
|
||||
/**
|
||||
* Callbacks for events
|
||||
*/
|
||||
callbacks?: AppRateCallbacks;
|
||||
|
||||
/**
|
||||
* App Store URLS
|
||||
*/
|
||||
storeAppUrl?: AppRateStoreAppUrls;
|
||||
|
||||
}
|
||||
|
||||
export interface AppRateCallbacks {
|
||||
|
||||
/**
|
||||
* call back function. called when user clicked on rate-dialog buttons
|
||||
*/
|
||||
onButtonClicked?: Function;
|
||||
|
||||
/**
|
||||
* call back function. called when rate-dialog showing
|
||||
*/
|
||||
onRateDialogShowed?: Function;
|
||||
|
||||
}
|
||||
|
||||
export interface AppRateStoreAppUrls {
|
||||
|
||||
/**
|
||||
* application id in AppStore
|
||||
*/
|
||||
ios?: string;
|
||||
|
||||
/**
|
||||
* application URL in GooglePlay
|
||||
*/
|
||||
android?: string;
|
||||
|
||||
/**
|
||||
* application URL in AppWorld
|
||||
*/
|
||||
blackberry?: string;
|
||||
|
||||
/**
|
||||
* application URL in WindowsStore
|
||||
*/
|
||||
windows8?: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name App Rate
|
||||
* @description
|
||||
@ -22,26 +108,11 @@ declare var window;
|
||||
* AppRate.promptForRating(false);
|
||||
* ```
|
||||
*
|
||||
* @advanced
|
||||
* @interfaces
|
||||
* AppRatePreferences
|
||||
* AppRateStoreAppUrls
|
||||
* AppRateCallbacks
|
||||
*
|
||||
* 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 |
|
||||
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AppRate',
|
||||
@ -57,7 +128,7 @@ export class AppRate {
|
||||
* See table below for options
|
||||
*/
|
||||
@CordovaProperty
|
||||
static preferences;
|
||||
static preferences: AppRatePreferences;
|
||||
|
||||
/**
|
||||
* Prompts the user for rating
|
||||
|
Loading…
Reference in New Issue
Block a user