mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-17 00:51:07 +08:00
feat(app-rate): update plugin functions (#3598)
* cordova-plugin-apprate * Update index.ts
This commit is contained in:
parent
de6dee7de4
commit
3e92f64484
@ -1,6 +1,33 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
export enum AppRateReviewTypeIos {
|
||||||
|
/**
|
||||||
|
* Write review directly in your application (iOS 10.3+), limited to 3 prompts per year.
|
||||||
|
* Will fallback to 'AppStoreReview' for other iOS versions
|
||||||
|
*/
|
||||||
|
InAppReview = 'InAppReview',
|
||||||
|
/**
|
||||||
|
* Open the store within the app. Use this option as an alternative to inAppReview to avoid the rate action from doing nothing
|
||||||
|
*/
|
||||||
|
AppStoreReview = 'AppStoreReview',
|
||||||
|
/**
|
||||||
|
* Open the store using the openUrl preference (defaults to InAppBrowser). Be advised that WKWebView might not open the app store links
|
||||||
|
*/
|
||||||
|
InAppBrowser = 'InAppBrowser'
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum AppRateReviewTypeAndroid {
|
||||||
|
/**
|
||||||
|
* Write review directly in your application. Will fallback to InAppBrowser if not available
|
||||||
|
*/
|
||||||
|
InAppReview = 'InAppReview',
|
||||||
|
/**
|
||||||
|
* Open the store using the openUrl preference (defaults to InAppBrowser)
|
||||||
|
*/
|
||||||
|
InAppBrowser = 'InAppBrowser',
|
||||||
|
}
|
||||||
|
|
||||||
export interface AppRatePreferences {
|
export interface AppRatePreferences {
|
||||||
/**
|
/**
|
||||||
* Custom BCP 47 language tag
|
* Custom BCP 47 language tag
|
||||||
@ -22,11 +49,29 @@ export interface AppRatePreferences {
|
|||||||
*/
|
*/
|
||||||
usesUntilPrompt?: number;
|
usesUntilPrompt?: number;
|
||||||
|
|
||||||
|
reviewType?: {
|
||||||
|
/**
|
||||||
|
* the type of review display to show the user on iOS
|
||||||
|
* Default: AppStoreReview
|
||||||
|
*/
|
||||||
|
ios?: AppRateReviewTypeIos
|
||||||
|
/**
|
||||||
|
* the type of review display to show the user on Android
|
||||||
|
* Default: InAppBrowser
|
||||||
|
*/
|
||||||
|
android?: AppRateReviewTypeAndroid
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple Mode to display the rate dialog directly and bypass negative feedback filtering flow
|
* Simple Mode to display the rate dialog directly and bypass negative feedback filtering flow
|
||||||
*/
|
*/
|
||||||
simpleMode?: boolean;
|
simpleMode?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disabling would skip displaying a rate dialog if in app review is set and available. Defaults to `true`
|
||||||
|
*/
|
||||||
|
showPromptForInAppReview?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* leave app or no when application page opened in app store (now supported only for iOS). Defaults to `false`
|
* leave app or no when application page opened in app store (now supported only for iOS). Defaults to `false`
|
||||||
*/
|
*/
|
||||||
@ -93,20 +138,30 @@ export interface AppRateCustomLocale {
|
|||||||
feedbackPromptMessage?: string;
|
feedbackPromptMessage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AppRateLocales {
|
||||||
|
addLocale(localeObject: AppRateCustomLocale): AppRateCustomLocale
|
||||||
|
|
||||||
|
getLocale(language: string, applicationTitle?: string, customLocale?: AppRateCustomLocale)
|
||||||
|
|
||||||
|
getLocalesNames(): { [prop: string]: AppRateCustomLocale; }
|
||||||
|
}
|
||||||
|
|
||||||
export interface AppRateCallbacks {
|
export interface AppRateCallbacks {
|
||||||
/**
|
/**
|
||||||
* call back function. called when user clicked on rate-dialog buttons
|
* call back function. called when user clicked on rate-dialog buttons
|
||||||
*/
|
*/
|
||||||
onButtonClicked?: Function;
|
onButtonClicked?: (buttonIndex: number) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* call back function. called when rate-dialog showing
|
* call back function. called when rate-dialog showing
|
||||||
*/
|
*/
|
||||||
onRateDialogShow?: Function;
|
onRateDialogShow?: (rateCallback: (buttonIndex: number) => void) => void;
|
||||||
/**
|
/**
|
||||||
* call back function. called when user clicked on negative feedback
|
* call back function. called when user clicked on negative feedback
|
||||||
*/
|
*/
|
||||||
handleNegativeFeedback?: Function;
|
handleNegativeFeedback?: () => void;
|
||||||
|
|
||||||
|
done?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AppUrls {
|
export interface AppUrls {
|
||||||
@ -196,16 +251,44 @@ export class AppRate extends IonicNativePlugin {
|
|||||||
@CordovaProperty()
|
@CordovaProperty()
|
||||||
preferences: AppRatePreferences;
|
preferences: AppRatePreferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manager custom locales
|
||||||
|
*/
|
||||||
|
@CordovaProperty()
|
||||||
|
locales: AppRateLocales;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set preferences
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
setPreferences(pref: AppRatePreferences): void {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get preferences
|
||||||
|
* @return AppRatePreferences
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
getPreferences(): AppRatePreferences {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts the user for rating
|
* Prompts the user for rating
|
||||||
* @param {boolean} immediately Show the rating prompt immediately.
|
* @param {boolean} immediately Show the rating prompt immediately.
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
promptForRating(immediately: boolean): void {}
|
promptForRating(immediately?: boolean): void {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immediately send the user to the app store rating page
|
* Immediately send the user to the app store rating page
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova()
|
||||||
navigateToAppStore(): void {}
|
navigateToAppStore(): void {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user