Skip to content

Commit

Permalink
feat(app-rate): add custom locale interface
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsogl committed Mar 16, 2018
1 parent f11be24 commit 2a18dbc
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions src/@ionic-native/plugins/app-rate/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
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 {

/**
* Custom BCP 47 language tag
*/
Expand Down Expand Up @@ -41,7 +40,7 @@ export interface AppRatePreferences {
/**
* Custom locale object
*/
customLocale?: any;
customLocale?: AppRateCustomLocale;

/**
* Callbacks for events
Expand All @@ -52,11 +51,38 @@ export interface AppRatePreferences {
* App Store URLS
*/
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 {

/**
* call back function. called when user clicked on rate-dialog buttons
*/
Expand All @@ -70,11 +96,9 @@ export interface AppRateCallbacks {
* call back function. called when user clicked on negative feedback
*/
handleNegativeFeedback?: Function;

}

export interface AppUrls {

/**
* application id in AppStore
*/
Expand All @@ -99,7 +123,6 @@ export interface AppUrls {
* application URL in WindowsStore
*/
windows8?: string;

}

/**
Expand Down Expand Up @@ -142,6 +165,7 @@ export interface AppUrls {
* AppRatePreferences
* AppUrls
* AppRateCallbacks
* AppRateCustomLocal
*
*/
@Plugin({
Expand All @@ -153,25 +177,22 @@ export interface AppUrls {
})
@Injectable()
export class AppRate extends IonicNativePlugin {

/**
* Configure various settings for the Rating View.
* See table below for options
*/
@CordovaProperty
preferences: AppRatePreferences;
@CordovaProperty preferences: AppRatePreferences;

/**
* Prompts the user for rating
* @param {boolean} immediately Show the rating prompt immediately.
*/
@Cordova()
promptForRating(immediately: boolean): void { };
promptForRating(immediately: boolean): void {}

/**
* Immediately send the user to the app store rating page
*/
@Cordova()
navigateToAppStore(): void { };

navigateToAppStore(): void {}
}

0 comments on commit 2a18dbc

Please sign in to comment.