feat(app-rate): add custom locale interface

This commit is contained in:
Daniel Sogl 2018-03-16 13:46:08 +01:00 committed by GitHub
parent f11be24f74
commit 2a18dbcf3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface AppRatePreferences { export interface AppRatePreferences {
/** /**
* Custom BCP 47 language tag * Custom BCP 47 language tag
*/ */
@ -41,7 +40,7 @@ export interface AppRatePreferences {
/** /**
* Custom locale object * Custom locale object
*/ */
customLocale?: any; customLocale?: AppRateCustomLocale;
/** /**
* Callbacks for events * Callbacks for events
@ -52,11 +51,38 @@ export interface AppRatePreferences {
* App Store URLS * App Store URLS
*/ */
storeAppURL?: AppUrls; storeAppURL?: AppUrls;
}
export interface AppRateCustomLocale {
/** Title */
title?: string;
/** Message */
message?: string;
/** Cancel button label */
cancelButtonLabel?: string;
/** Later button label */
laterButtonLabel?: string;
/** Rate button label */
rateButtonLabel?: string;
/** Yes button label */
yesButtonLabel?: string;
/** No button label */
noButtonLabel?: string;
/** App rate promt title */
appRatePromptTitle?: string;
/** Feedback prompt title */
feedbackPromptTitle?: string;
} }
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
*/ */
@ -70,11 +96,9 @@ export interface AppRateCallbacks {
* call back function. called when user clicked on negative feedback * call back function. called when user clicked on negative feedback
*/ */
handleNegativeFeedback?: Function; handleNegativeFeedback?: Function;
} }
export interface AppUrls { export interface AppUrls {
/** /**
* application id in AppStore * application id in AppStore
*/ */
@ -99,7 +123,6 @@ export interface AppUrls {
* application URL in WindowsStore * application URL in WindowsStore
*/ */
windows8?: string; windows8?: string;
} }
/** /**
@ -142,6 +165,7 @@ export interface AppUrls {
* AppRatePreferences * AppRatePreferences
* AppUrls * AppUrls
* AppRateCallbacks * AppRateCallbacks
* AppRateCustomLocal
* *
*/ */
@Plugin({ @Plugin({
@ -153,25 +177,22 @@ export interface AppUrls {
}) })
@Injectable() @Injectable()
export class AppRate extends IonicNativePlugin { export class AppRate extends IonicNativePlugin {
/** /**
* Configure various settings for the Rating View. * Configure various settings for the Rating View.
* See table below for options * See table below for options
*/ */
@CordovaProperty @CordovaProperty preferences: AppRatePreferences;
preferences: AppRatePreferences;
/** /**
* 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 {}
/** /**
* 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 {}
} }