diff --git a/src/@ionic-native/plugins/app-rate/index.ts b/src/@ionic-native/plugins/app-rate/index.ts index 16f21c95e..8ed2858b2 100644 --- a/src/@ionic-native/plugins/app-rate/index.ts +++ b/src/@ionic-native/plugins/app-rate/index.ts @@ -1,6 +1,33 @@ import { Injectable } from '@angular/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 { /** * Custom BCP 47 language tag @@ -22,11 +49,29 @@ export interface AppRatePreferences { */ 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 */ 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` */ @@ -93,20 +138,30 @@ export interface AppRateCustomLocale { feedbackPromptMessage?: string; } +export interface AppRateLocales { + addLocale(localeObject: AppRateCustomLocale): AppRateCustomLocale + + getLocale(language: string, applicationTitle?: string, customLocale?: AppRateCustomLocale) + + getLocalesNames(): { [prop: string]: AppRateCustomLocale; } +} + export interface AppRateCallbacks { /** * 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 */ - onRateDialogShow?: Function; + onRateDialogShow?: (rateCallback: (buttonIndex: number) => void) => void; /** * call back function. called when user clicked on negative feedback */ - handleNegativeFeedback?: Function; + handleNegativeFeedback?: () => void; + + done?: () => void; } export interface AppUrls { @@ -196,16 +251,44 @@ export class AppRate extends IonicNativePlugin { @CordovaProperty() 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 * @param {boolean} immediately Show the rating prompt immediately. */ @Cordova() - promptForRating(immediately: boolean): void {} + promptForRating(immediately?: boolean): void { + return; + } + /** * Immediately send the user to the app store rating page */ @Cordova() - navigateToAppStore(): void {} + navigateToAppStore(): void { + } }