cordova-plugin-apprate
Advanced tools
Comparing version 1.6.1 to 1.7.0
@@ -6,2 +6,7 @@ # Changelog | ||
- 1.7.0 | ||
- [PR #286](https://github.com/pushandplay/cordova-plugin-apprate/pull/286) - Added new method `setPreferences` which does not override any default/existing settings. This is now the preferred way to set the plugins preferences. | ||
- [PR #286](https://github.com/pushandplay/cordova-plugin-apprate/pull/286) - Added option `showPromptForInAppReview` | ||
- [PR #286](https://github.com/pushandplay/cordova-plugin-apprate/pull/286) - Typescript definitions updated to latest syntax | ||
- 1.6.1 | ||
@@ -8,0 +13,0 @@ - [#287](https://github.com/pushandplay/cordova-plugin-apprate/issues/287) - Fix bug with `reviewType` setting |
{ | ||
"name": "cordova-plugin-apprate", | ||
"version": "1.6.1", | ||
"version": "1.7.0", | ||
"repository": { | ||
@@ -13,3 +13,4 @@ "type": "git", | ||
}, | ||
"types": "./typescript/AppRate.d.ts" | ||
"main": "./typings/index.js", | ||
"types": "./typings/index.d.ts" | ||
} |
243
README.md
@@ -17,2 +17,3 @@ # Cordova-Plugin-Apprate | ||
## Installation Prerequisites | ||
Choose your preferred browser plugin which will be used to open the store and install it: | ||
@@ -22,36 +23,38 @@ - https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller | ||
NOTE: If you chose inappbrowser then make sure to add `openUrl: AppRate.preferences.openUrl` option to preferences if you will override the preference object. And if you chose cordova-plugin-safariviewcontroller then you must configure it with this plugin by setting: | ||
You must implement the `openUrl` method for your chosen plugin. Below is an example that works for both. | ||
```javascript | ||
AppRate.preferences.openUrl = function (url) { | ||
if (!window.SafariViewController) { | ||
window.open(url, '_blank', 'location=yes'); | ||
} | ||
else { | ||
SafariViewController.isAvailable(function (available) { | ||
if (available) { | ||
SafariViewController.show({ | ||
url: url, | ||
barColor: "#0000ff", // on iOS 10+ you can change the background color as well | ||
controlTintColor: "#00ffff", // on iOS 10+ you can override the default tintColor | ||
tintColor: "#00ffff", // should be set to same value as controlTintColor and will be a fallback on older ios | ||
}, | ||
// this success handler will be invoked for the lifecycle events 'opened', 'loaded' and 'closed' | ||
function(result) { | ||
if (result.event === 'opened') { | ||
console.log('opened'); | ||
} else if (result.event === 'loaded') { | ||
console.log('loaded'); | ||
} else if (result.event === 'closed') { | ||
console.log('closed'); | ||
} | ||
}, | ||
function(msg) { | ||
console.log("error: " + msg); | ||
}) | ||
} else { | ||
window.open(url, '_blank', 'location=yes'); | ||
AppRate.setPreferences({ | ||
openUrl: function(url) { | ||
var safariAvailable = false; | ||
if (window.SafariViewController) { | ||
SafariViewController.isAvailable(function(available) { | ||
safariAvailable = available; | ||
}); | ||
} | ||
if (!safariAvailable) { | ||
window.open(url, '_blank', 'location=yes'); | ||
} else { | ||
SafariViewController.show( | ||
{ | ||
url: url, | ||
barColor: "#0000ff", // on iOS 10+ you can change the background color as well | ||
controlTintColor: "#00ffff", // on iOS 10+ you can override the default tintColor | ||
tintColor: "#00ffff", // should be set to same value as controlTintColor and will be a fallback on older ios | ||
}, | ||
// this success handler will be invoked for the lifecycle events 'opened', 'loaded' and 'closed' | ||
function(result) { | ||
console.log(result.event) | ||
}, | ||
function(msg) { | ||
console.log("Error: " + msg); | ||
} | ||
}); | ||
); | ||
} | ||
} | ||
}; | ||
}); | ||
``` | ||
@@ -75,3 +78,3 @@ | ||
## Options / Preferences | ||
These options are available on the `AppRate.preferences` object. | ||
These options are available to set via the `setPreferences` method. | ||
@@ -87,2 +90,3 @@ | Option | Type | Default | Description | | ||
| simpleMode | Boolean | false | enabling simplemode would display the rate dialog directly without the negative feedback filtering flow | | ||
| showPromptForInAppReview | boolean | true | disabling would skip displaying a rate dialog if in app review is set and available | | ||
| callbacks.onButtonClicked | Function | null | call back function. called when user clicked on rate-dialog buttons | | ||
@@ -97,4 +101,13 @@ | callbacks.onRateDialogShow | Function | null | call back function. called when rate-dialog showing | | ||
### reviewType | ||
#### reviewType.ios [Enum] | ||
- `InAppReview` - Write review directly in your application (iOS 10.3+), limited to 3 prompts per year. Will fallback to 'AppStoreReview' for other iOS versions | ||
- `AppStoreReview` - Open the store within the app. Use this option as an alternative to inAppReview to avoid the rate action from [doing nothing](https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview) | ||
- `InAppBrowser` - Open the store using the `openUrl` preference (defaults to InAppBrowser). Be advised that WKWebView might not open the app store links | ||
#### reviewType.android [Enum] | ||
- `InAppReview` - Write review directly in your application. Will fallback to `InAppBrowser` if not available | ||
- `InAppBrowser` - Open the store using the `openUrl` preference (defaults to InAppBrowser) | ||
### In App Reviews | ||
The `InAppReview` review type will attempt to launch a native in-app review dialog (as opposed to opening the app store). | ||
@@ -108,15 +121,6 @@ | ||
Native in-app review can only be possible under certain conditions. If those conditions are not met, a fallback method will be used (see information per platform below). | ||
Native in-app review can only be possible under certain conditions. If those conditions are not met, a fallback method will be used see information per platform. | ||
#### reviewType.ios [Enum] | ||
- `InAppReview` - Write review directly in your application (iOS 10.3+), limited to 3 prompts per year. Will fallback to 'AppStoreReview' for other iOS versions | ||
- `AppStoreReview` - Open the store within the app. Use this option as an alternative to inAppReview to avoid the rate action from [doing nothing](https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview) | ||
- `InAppBrowser` - Open the store using the `openUrl` preference (defaults to InAppBrowser). Be advised that WKWebView might not open the app store links | ||
Note: The `InAppReview` will only work on released versions. To test it our please refer to [this article](https://developer.android.com/guide/playcore/in-app-review/test) | ||
#### reviewType.android [Enum] | ||
- `InAppReview` - Write review directly in your application. Will fallback to `InAppBrowser` if not available | ||
- `InAppBrowser` - Open the store using the `openUrl` preference (defaults to InAppBrowser) | ||
Notice that the `InAppReview` will only work on released versions. To test it our please refer to [this article](https://developer.android.com/guide/playcore/in-app-review/test) | ||
## Examples | ||
@@ -126,3 +130,3 @@ | ||
### Simple setup and call | ||
### Simple Setup and Call | ||
@@ -132,8 +136,10 @@ Note: windows does not need an URL as this is done by the native code. | ||
```javascript | ||
AppRate.preferences.storeAppURL = { | ||
ios: '<my_app_id>', | ||
android: 'market://details?id=<package_name>', | ||
blackberry: 'appworld://content/[App Id]/', | ||
windows8: 'ms-windows-store:Review?name=<the Package Family Name of the application>' | ||
}; | ||
AppRate.setPreferences({ | ||
storeAppURL: { | ||
ios: '<my_app_id>', | ||
android: 'market://details?id=<package_name>', | ||
blackberry: 'appworld://content/[App Id]/', | ||
windows8: 'ms-windows-store:Review?name=<the Package Family Name of the application>' | ||
} | ||
}); | ||
@@ -143,3 +149,3 @@ AppRate.promptForRating(); | ||
### Don't Call rate dialog immediately | ||
### Don't Call Rate Dialog Immediately | ||
@@ -149,39 +155,47 @@ ```javascript | ||
``` | ||
If false is not present it will ignore usesUntilPrompt, promptAgainForEachNewVersion, and button logic, it will prompt every time. | ||
If false is not present it will ignore `usesUntilPrompt`, `promptAgainForEachNewVersion`, and the button logic, it will prompt every time. | ||
### Override dialog button callback | ||
### Override Dialog Button Callback | ||
```javascript | ||
AppRate.preferences.callbacks.onButtonClicked = function(buttonIndex) { | ||
console.log("onButtonClicked -> " + buttonIndex); | ||
}; | ||
AppRate.setPreferences({ | ||
callbacks: { | ||
onButtonClicked: function(buttonIndex) { | ||
console.log("onButtonClicked -> " + buttonIndex); | ||
} | ||
} | ||
}); | ||
``` | ||
### Set custom language | ||
### Set Custom Language | ||
```javascript | ||
AppRate.preferences.useLanguage = 'ru'; | ||
AppRate.setPreferences({ | ||
useLanguage: 'ru' | ||
}); | ||
``` | ||
### Set custom Locale object | ||
Note: `%@` patterns in `title` and `message` will be automatically replaced with `AppRate.preferences.displayAppName` | ||
### Set Custom Locale Object | ||
Note: `%@` patterns in `title` and `message` will be automatically replaced with `preferences.displayAppName` | ||
```javascript | ||
AppRate.preferences.customLocale = { | ||
title: "Would you mind rating %@?", | ||
message: "It won’t take more than a minute and helps to promote our app. Thanks for your support!", | ||
cancelButtonLabel: "No, Thanks", | ||
laterButtonLabel: "Remind Me Later", | ||
rateButtonLabel: "Rate It Now", | ||
yesButtonLabel: "Yes!", | ||
noButtonLabel: "Not really", | ||
appRatePromptTitle: 'Do you like using %@', | ||
feedbackPromptTitle: 'Mind giving us some feedback?', | ||
}; | ||
AppRate.setPreferences({ | ||
customLocale: { | ||
title: "Would you mind rating %@?", | ||
message: "It won’t take more than a minute and helps to promote our app. Thanks for your support!", | ||
cancelButtonLabel: "No, Thanks", | ||
laterButtonLabel: "Remind Me Later", | ||
rateButtonLabel: "Rate It Now", | ||
yesButtonLabel: "Yes!", | ||
noButtonLabel: "Not really", | ||
appRatePromptTitle: 'Do you like using %@', | ||
feedbackPromptTitle: 'Mind giving us some feedback?', | ||
} | ||
}); | ||
``` | ||
### Full setup using SafariViewController | ||
### Full Setup Using SafariViewController | ||
```javascript | ||
AppRate.preferences = { | ||
AppRate.setPreferences({ | ||
displayAppName: 'My custom app title', | ||
@@ -214,3 +228,3 @@ usesUntilPrompt: 5, | ||
handleNegativeFeedback: function(){ | ||
window.open('mailto:feedback@example.com','_system'); | ||
window.open('mailto:feedback@example.com', '_system'); | ||
}, | ||
@@ -223,37 +237,35 @@ onRateDialogShow: function(callback){ | ||
} | ||
} | ||
}; | ||
}, | ||
openUrl: function(url) { | ||
var safariAvailable = false; | ||
AppRate.preferences.openUrl = function (url) { | ||
if (!window.SafariViewController) { | ||
window.open(url, '_blank', 'location=yes'); | ||
} | ||
else { | ||
SafariViewController.isAvailable(function (available) { | ||
if (available) { | ||
SafariViewController.show({ | ||
url: url, | ||
barColor: "#0000ff", // on iOS 10+ you can change the background color as well | ||
controlTintColor: "#00ffff" // on iOS 10+ you can override the default tintColor | ||
tintColor: "#00ffff", // should be set to same value as controlTintColor and will be a fallback on older ios | ||
}, | ||
// this success handler will be invoked for the lifecycle events 'opened', 'loaded' and 'closed' | ||
function(result) { | ||
if (result.event === 'opened') { | ||
console.log('opened'); | ||
} else if (result.event === 'loaded') { | ||
console.log('loaded'); | ||
} else if (result.event === 'closed') { | ||
console.log('closed'); | ||
} | ||
}, | ||
function(msg) { | ||
console.log("error: " + msg); | ||
}) | ||
} else { | ||
window.open(url, '_blank', 'location=yes'); | ||
if (window.SafariViewController) { | ||
SafariViewController.isAvailable(function(available) { | ||
safariAvailable = available; | ||
}); | ||
} | ||
if (!safariAvailable) { | ||
window.open(url, '_blank', 'location=yes'); | ||
} else { | ||
SafariViewController.show( | ||
{ | ||
url: url, | ||
barColor: "#0000ff", // on iOS 10+ you can change the background color as well | ||
controlTintColor: "#00ffff", // on iOS 10+ you can override the default tintColor | ||
tintColor: "#00ffff", // should be set to same value as controlTintColor and will be a fallback on older ios | ||
}, | ||
// this success handler will be invoked for the lifecycle events 'opened', 'loaded' and 'closed' | ||
function(result) { | ||
console.log(result.event) | ||
}, | ||
function(msg) { | ||
console.log("Error: " + msg); | ||
} | ||
}); | ||
); | ||
} | ||
} | ||
}; | ||
}); | ||
@@ -263,6 +275,6 @@ AppRate.promptForRating(); | ||
### Full setup using inappbrowser | ||
### Full Setup Using InAppBrowser | ||
```javascript | ||
AppRate.preferences = { | ||
AppRate.setPreferences({ | ||
displayAppName: 'My custom app title', | ||
@@ -295,3 +307,3 @@ usesUntilPrompt: 5, | ||
handleNegativeFeedback: function(){ | ||
window.open('mailto:feedback@example.com','_system'); | ||
window.open('mailto:feedback@example.com', '_system'); | ||
}, | ||
@@ -304,5 +316,4 @@ onRateDialogShow: function(callback){ | ||
} | ||
}, | ||
openUrl: AppRate.preferences.openUrl | ||
}; | ||
} | ||
}); | ||
@@ -312,3 +323,3 @@ AppRate.promptForRating(); | ||
### Access to locales | ||
### Access To Locales | ||
@@ -323,3 +334,3 @@ ```javascript | ||
### List of translations | ||
### List of Translations | ||
https://github.com/pushandplay/cordova-plugin-apprate/blob/master/www/locales.js | ||
@@ -331,2 +342,2 @@ | ||
Created by [@pushandplay](https://github.com/pushandplay) - [Donate with PayPal](https://www.paypal.me/pushandplay/10) | ||
Created by [@pushandplay](https://github.com/pushandplay) |
@@ -20,3 +20,4 @@ /* | ||
* | ||
*/; | ||
*/ | ||
var exec = require('cordova/exec'); | ||
@@ -36,3 +37,3 @@ var Locales = require('./locales'); | ||
AppRate.initialized = false; | ||
AppRate.ready = new Promise(function (resolve, reject) { | ||
AppRate.ready = new Promise(function(resolve, reject) { | ||
AppRate.readyResolve = resolve; | ||
@@ -57,4 +58,34 @@ AppRate.readyReject = reject; | ||
var preferences = { | ||
useLanguage: null, | ||
displayAppName: '', | ||
simpleMode: false, | ||
showPromptForInAppReview: true, | ||
promptAgainForEachNewVersion: true, | ||
usesUntilPrompt: 3, | ||
reviewType: { | ||
ios: 'AppStoreReview', | ||
android: 'InAppBrowser' | ||
}, | ||
callbacks: { | ||
onButtonClicked: null, | ||
onRateDialogShow: null, | ||
handleNegativeFeedback: null, | ||
done: null | ||
}, | ||
storeAppURL: { | ||
ios: null, | ||
android: null, | ||
blackberry: null, | ||
windows8: null, | ||
windows: null | ||
}, | ||
customLocale: null, | ||
openUrl: function(url) { | ||
cordova.InAppBrowser.open(url, '_system', 'location=no'); | ||
} | ||
}; | ||
function promptForAppRatingWindowButtonClickHandler(buttonIndex) { | ||
var base = AppRate.preferences.callbacks, currentBtn = null; | ||
var base = preferences.callbacks, currentBtn = null; | ||
switch (buttonIndex) { | ||
@@ -79,3 +110,3 @@ case 0: | ||
function promptForStoreRatingWindowButtonClickHandler(buttonIndex) { | ||
var base = AppRate.preferences.callbacks, currentBtn = null; | ||
var base = preferences.callbacks, currentBtn = null; | ||
switch (buttonIndex) { | ||
@@ -106,3 +137,3 @@ case 0: | ||
function promptForFeedbackWindowButtonClickHandler(buttonIndex) { | ||
var base = AppRate.preferences.callbacks, currentBtn = null; | ||
var base = preferences.callbacks, currentBtn = null; | ||
switch (buttonIndex) { | ||
@@ -128,3 +159,3 @@ case 1: | ||
case 'increment': | ||
if (counter.countdown <= AppRate.preferences.usesUntilPrompt) { | ||
if (counter.countdown <= preferences.usesUntilPrompt) { | ||
counter.countdown++; | ||
@@ -137,3 +168,3 @@ } | ||
case 'stop': | ||
counter.countdown = AppRate.preferences.usesUntilPrompt + 1; | ||
counter.countdown = preferences.usesUntilPrompt + 1; | ||
} | ||
@@ -146,17 +177,10 @@ Storage.set(LOCAL_STORAGE_COUNTER, counter); | ||
updateCounter(); | ||
if (counter.countdown === AppRate.preferences.usesUntilPrompt || immediately) { | ||
localeObj = Locales.getLocale(AppRate.preferences.useLanguage, AppRate.preferences.displayAppName, AppRate.preferences.customLocale); | ||
if (counter.countdown === preferences.usesUntilPrompt || immediately) { | ||
localeObj = Locales.getLocale(preferences.useLanguage, preferences.displayAppName, preferences.customLocale); | ||
var isNativePrompt = false; | ||
if (isNativePromptAvailable && AppRate.preferences.reviewType) { | ||
if((IS_IOS && AppRate.preferences.reviewType.ios === 'InAppReview') || (IS_ANDROID && AppRate.preferences.reviewType.android === 'InAppReview')) { | ||
isNativePrompt = true; | ||
} | ||
} | ||
if (isNativePrompt) { | ||
if (!preferences.showPromptForInAppReview && isNativePromptAvailable && preferences.reviewType && | ||
((IS_IOS && preferences.reviewType.ios === 'InAppReview') || (IS_ANDROID && preferences.reviewType.android === 'InAppReview'))) { | ||
updateCounter('stop'); | ||
AppRate.navigateToAppStore(); | ||
} else if(AppRate.preferences.simpleMode) { | ||
} else if (preferences.simpleMode) { | ||
navigator.notification.confirm(localeObj.message, promptForStoreRatingWindowButtonClickHandler, localeObj.title, [localeObj.cancelButtonLabel, localeObj.laterButtonLabel, localeObj.rateButtonLabel]); | ||
@@ -167,3 +191,3 @@ } else { | ||
var base = AppRate.preferences.callbacks; | ||
var base = preferences.callbacks; | ||
if (typeof base.onRateDialogShow === "function") { | ||
@@ -177,3 +201,3 @@ base.onRateDialogShow(promptForStoreRatingWindowButtonClickHandler); | ||
function getAppVersion() { | ||
return new Promise(function (resolve, reject){ | ||
return new Promise(function(resolve, reject) { | ||
if (FLAG_NATIVE_CODE_SUPPORTED) { | ||
@@ -188,7 +212,7 @@ exec(resolve, reject, 'AppRate', 'getAppVersion', []); | ||
function getAppTitle() { | ||
return new Promise(function (resolve, reject){ | ||
return new Promise(function(resolve, reject) { | ||
if (FLAG_NATIVE_CODE_SUPPORTED) { | ||
exec(resolve, reject, 'AppRate', 'getAppTitle', []); | ||
} else { | ||
resolve(AppRate.preferences.displayAppName); | ||
resolve(preferences.displayAppName); | ||
} | ||
@@ -199,3 +223,3 @@ }); | ||
function checkIsNativePromptAvailable() { | ||
return new Promise(function (resolve, reject){ | ||
return new Promise(function(resolve, reject) { | ||
if (FLAG_NATIVE_CODE_SUPPORTED) { | ||
@@ -209,2 +233,19 @@ exec(resolve, reject, 'AppRate', 'isNativePromptAvailable', []); | ||
function setPreferences(pref, prefObj) { | ||
if(!prefObj) { | ||
prefObj = preferences; | ||
} | ||
if (pref && typeof pref === 'object') { | ||
for (let key in pref) { | ||
if (pref.hasOwnProperty(key) && prefObj.hasOwnProperty(key)) { | ||
if (typeof pref[key] === 'object') { | ||
setPreferences(pref[key], prefObj[key]); | ||
} else { | ||
prefObj[key] = pref[key]; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
AppRate.init = function() { | ||
@@ -215,3 +256,3 @@ var appVersionPromise = getAppVersion() | ||
counter.applicationVersion = applicationVersion; | ||
if (AppRate.preferences.promptAgainForEachNewVersion) { | ||
if (preferences.promptAgainForEachNewVersion) { | ||
updateCounter('reset'); | ||
@@ -225,3 +266,3 @@ } | ||
.then(function(displayAppName) { | ||
AppRate.preferences.displayAppName = displayAppName; | ||
preferences.displayAppName = displayAppName; | ||
}) | ||
@@ -234,7 +275,7 @@ .catch(noop); | ||
}) | ||
.catch(function () { | ||
.catch(function() { | ||
isNativePromptAvailable = false; | ||
}); | ||
var storagePromise = Storage.get(LOCAL_STORAGE_COUNTER).then(function (storedCounter) { | ||
var storagePromise = Storage.get(LOCAL_STORAGE_COUNTER).then(function(storedCounter) { | ||
counter = storedCounter || counter | ||
@@ -256,3 +297,2 @@ }); | ||
} | ||
return this; | ||
}; | ||
@@ -262,31 +302,10 @@ | ||
AppRate.preferences = { | ||
useLanguage: null, | ||
displayAppName: '', | ||
simpleMode: false, | ||
promptAgainForEachNewVersion: true, | ||
usesUntilPrompt: 3, | ||
reviewType: { | ||
ios: 'AppStoreReview', | ||
android: 'InAppBrowser' | ||
}, | ||
callbacks: { | ||
onButtonClicked: null, | ||
onRateDialogShow: null, | ||
handleNegativeFeedback: null, | ||
done: null | ||
}, | ||
storeAppURL: { | ||
ios: null, | ||
android: null, | ||
blackberry: null, | ||
windows8: null, | ||
windows: null | ||
}, | ||
customLocale: null, | ||
openUrl: function (url) { | ||
cordova.InAppBrowser.open(url, '_system', 'location=no'); | ||
} | ||
AppRate.setPreferences = function(pref) { | ||
setPreferences(pref); | ||
}; | ||
AppRate.getPreferences = function() { | ||
return preferences; | ||
}; | ||
AppRate.promptForRating = function(immediately) { | ||
@@ -299,4 +318,4 @@ AppRate.ready.then(function() { | ||
// see also: https://cordova.apache.org/news/2017/11/20/migrate-from-cordova-globalization-plugin.html | ||
if (AppRate.preferences.useLanguage === null && window.Intl && typeof window.Intl === 'object') { | ||
AppRate.preferences.useLanguage = window.navigator.language; | ||
if (preferences.useLanguage === null && window.Intl && typeof window.Intl === 'object') { | ||
preferences.useLanguage = window.navigator.language; | ||
} | ||
@@ -306,3 +325,2 @@ | ||
}); | ||
return this; | ||
}; | ||
@@ -315,6 +333,6 @@ | ||
if (IS_IOS) { | ||
if (!this.preferences.reviewType || !this.preferences.reviewType.ios || this.preferences.reviewType.ios === 'AppStoreReview') { | ||
exec(null, null, 'AppRate', 'launchiOSReview', [this.preferences.storeAppURL.ios, false]); | ||
} else if (this.preferences.reviewType.ios === 'InAppReview') { | ||
exec(null, null, 'AppRate', 'launchiOSReview', [this.preferences.storeAppURL.ios, true]); | ||
if (!preferences.reviewType || !preferences.reviewType.ios || preferences.reviewType.ios === 'AppStoreReview') { | ||
exec(null, null, 'AppRate', 'launchiOSReview', [preferences.storeAppURL.ios, false]); | ||
} else if (preferences.reviewType.ios === 'InAppReview') { | ||
exec(null, null, 'AppRate', 'launchiOSReview', [preferences.storeAppURL.ios, true]); | ||
} else { | ||
@@ -324,13 +342,13 @@ iOSVersion = navigator.userAgent.match(/OS\s+([\d\_]+)/i)[0].replace(/_/g, '.').replace('OS ', '').split('.'); | ||
if (iOSVersion < 9) { | ||
iOSStoreUrl = PREF_STORE_URL_FORMAT_IOS8 + this.preferences.storeAppURL.ios; | ||
iOSStoreUrl = PREF_STORE_URL_FORMAT_IOS8 + preferences.storeAppURL.ios; | ||
} else { | ||
iOSStoreUrl = PREF_STORE_URL_PREFIX_IOS9 + this.preferences.storeAppURL.ios + PREF_STORE_URL_POSTFIX_IOS9; | ||
iOSStoreUrl = PREF_STORE_URL_PREFIX_IOS9 + preferences.storeAppURL.ios + PREF_STORE_URL_POSTFIX_IOS9; | ||
} | ||
AppRate.preferences.openUrl(iOSStoreUrl); | ||
preferences.openUrl(iOSStoreUrl); | ||
} | ||
} else if (IS_ANDROID) { | ||
if (isNativePromptAvailable && this.preferences.reviewType && this.preferences.reviewType.android === 'InAppReview') { | ||
if (isNativePromptAvailable && preferences.reviewType && preferences.reviewType.android === 'InAppReview') { | ||
exec(null, null, 'AppRate', 'launchReview', []); | ||
} else { | ||
AppRate.preferences.openUrl(this.preferences.storeAppURL.android); | ||
preferences.openUrl(preferences.storeAppURL.android); | ||
} | ||
@@ -340,7 +358,6 @@ } else if (/(Windows|Edge)/i.test(navigator.userAgent.toLowerCase())) { | ||
} else if (/(BlackBerry)/i.test(navigator.userAgent.toLowerCase())) { | ||
AppRate.preferences.openUrl(this.preferences.storeAppURL.blackberry); | ||
preferences.openUrl(preferences.storeAppURL.blackberry); | ||
} else if (/(IEMobile|Windows Phone)/i.test(navigator.userAgent.toLowerCase())) { | ||
AppRate.preferences.openUrl(this.preferences.storeAppURL.windows8); | ||
preferences.openUrl(preferences.storeAppURL.windows8); | ||
} | ||
return this; | ||
}; | ||
@@ -347,0 +364,0 @@ |
@@ -22,18 +22,4 @@ /* | ||
; | ||
var Locale, Locales; | ||
var Locales; | ||
Locale = (function () { | ||
function Locale(arg) { | ||
for (var index in arg) { | ||
if (arg.hasOwnProperty(index)) { | ||
this[index] = arg[index] || ''; | ||
} | ||
} | ||
this; | ||
} | ||
return Locale; | ||
})(); | ||
Locales = (function() { | ||
@@ -68,3 +54,3 @@ var LOCALE_DEFAULT, locales; | ||
Locales.getLocalesNames = function () { | ||
Locales.getLocalesNames = function() { | ||
var locale, results; | ||
@@ -82,3 +68,3 @@ results = []; | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ar', | ||
@@ -90,5 +76,5 @@ title: "قيِّم %@", | ||
rateButtonLabel: "قيم البرنامج الآن" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'bn', | ||
@@ -104,5 +90,5 @@ title: "রেট %@", | ||
feedbackPromptTitle: 'কিছু মতামত দিবেন কি?', | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ca', | ||
@@ -114,5 +100,5 @@ title: "Ressenya %@", | ||
rateButtonLabel: "Escriure una ressenya ara" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'cs', | ||
@@ -124,5 +110,5 @@ title: "Ohodnotit %@", | ||
rateButtonLabel: "Ohodnotit nyní" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'da', | ||
@@ -134,5 +120,5 @@ title: "Vurdér %@", | ||
rateButtonLabel: "Vurdér nu" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'de', | ||
@@ -150,5 +136,5 @@ title: "Bewerte %@", | ||
feedbackPromptMessage:'' | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'de-AT', | ||
@@ -166,5 +152,5 @@ title: "Bewerte %@", | ||
feedbackPromptMessage:'' | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'el', | ||
@@ -176,5 +162,5 @@ title: "Αξιολόγησε %@", | ||
rateButtonLabel: "Αξιολόγησε τώρα" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'en', | ||
@@ -192,5 +178,5 @@ title: "Would you mind rating %@?", | ||
feedbackPromptMessage:'' | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'es', | ||
@@ -208,5 +194,5 @@ title: "Reseña %@", | ||
feedbackPromptMessage:"" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'eu', | ||
@@ -224,5 +210,5 @@ title: "%@ iruzkindu nahi?", | ||
feedbackPromptMessage:'' | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'fa', | ||
@@ -234,5 +220,5 @@ title: "نرخ %@", | ||
rateButtonLabel: "آن را دوست ندارم حالا" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'fi', | ||
@@ -244,5 +230,5 @@ title: "Arvostele %@", | ||
rateButtonLabel: "Arvostele nyt" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'fr', | ||
@@ -260,5 +246,5 @@ title: "Notez %@", | ||
feedbackPromptMessage:"" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'he', | ||
@@ -270,5 +256,5 @@ title: "דרג את %@", | ||
rateButtonLabel: "דרג עכשיו" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'hi', | ||
@@ -280,5 +266,5 @@ title: "दर %@", | ||
rateButtonLabel: "अब यह दर" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'id', | ||
@@ -290,5 +276,5 @@ title: "Beri Nilai %@", | ||
rateButtonLabel: "Berikan nilai sekarang!" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'it', | ||
@@ -306,5 +292,5 @@ title: "Valuta %@", | ||
feedbackPromptMessage:"" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ja', | ||
@@ -316,5 +302,5 @@ title: "%@の評価", | ||
rateButtonLabel: "今すぐ評価する" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ko', | ||
@@ -326,5 +312,5 @@ title: "%@ 평가하기", | ||
rateButtonLabel: "지금 평가하기" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'nl', | ||
@@ -336,5 +322,5 @@ title: "Beoordeel %@", | ||
rateButtonLabel: "Beoordeel nu" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'no', | ||
@@ -346,5 +332,5 @@ title: "Vurder %@", | ||
rateButtonLabel: "Vurder nå" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'pa', | ||
@@ -356,5 +342,5 @@ title: "ਦਰ %@", | ||
rateButtonLabel: "ਹੁਣ ਇਹ ਦਰ ਨੂੰ" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'pl', | ||
@@ -366,5 +352,5 @@ title: "Oceń %@", | ||
rateButtonLabel: "Oceń teraz" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'pt', | ||
@@ -382,5 +368,5 @@ title: "Avaliar %@", | ||
feedbackPromptMessage: "" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'pt-PT', | ||
@@ -398,5 +384,5 @@ title: "Avaliar %@", | ||
feedbackPromptMessage: "" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ru', | ||
@@ -412,5 +398,5 @@ title: "Оцените %@", | ||
feedbackPromptTitle: "Не могли бы вы дать нам обратную связь?" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'sk', | ||
@@ -422,5 +408,5 @@ title: "Ohodnotiť %@", | ||
rateButtonLabel: "Ohodnotiť teraz" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'sl', | ||
@@ -432,5 +418,5 @@ title: "Oceni %@", | ||
rateButtonLabel: "Oceni zdaj" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'sv', | ||
@@ -442,5 +428,5 @@ title: "Betygsätt %@", | ||
rateButtonLabel: "Betygsätt nu!" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ta', | ||
@@ -452,5 +438,5 @@ title: "%@ மதிப்பிடு", | ||
rateButtonLabel: "இப்போது மதிப்பிடு" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'th', | ||
@@ -462,5 +448,5 @@ title: "อัตรา %@", | ||
rateButtonLabel: "ให้คะแนนตอนนี้" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'tr', | ||
@@ -478,5 +464,5 @@ title: "%@ Uygulamamızı değerlendirmek ister misiniz?", | ||
feedbackPromptMessage:'' | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'uk', | ||
@@ -492,5 +478,5 @@ title: "Оцінити %@", | ||
feedbackPromptTitle: "Чи не могли б ви дати нам зворотний зв'язок?" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ur', | ||
@@ -502,5 +488,5 @@ title: "شرح %@", | ||
rateButtonLabel: "شرح اب یہ" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ur-IN', | ||
@@ -512,5 +498,5 @@ title: "کو ریٹ کیجیے %@", | ||
rateButtonLabel: "ابھی ریٹ کیجیے" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'ur-PK', | ||
@@ -522,5 +508,5 @@ title: "کو ریٹ کیجیے %@", | ||
rateButtonLabel: "ابھی ریٹ کیجیے" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'vi', | ||
@@ -532,5 +518,5 @@ title: "Đánh giá %@", | ||
rateButtonLabel: "Đánh Giá Ngay" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'zh-TW', | ||
@@ -542,5 +528,5 @@ title: "評分 %@", | ||
rateButtonLabel: "現在評分" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'zh-Hans', | ||
@@ -552,5 +538,5 @@ title: "为“%@”评分", | ||
rateButtonLabel: "现在去评分" | ||
})); | ||
}); | ||
Locales.addLocale(new Locale({ | ||
Locales.addLocale({ | ||
language: 'zh-Hant', | ||
@@ -562,4 +548,4 @@ title: "評分 %@", | ||
rateButtonLabel: "現在評分" | ||
})); | ||
}); | ||
module.exports = Locales; |
module.exports = { | ||
get: function (key) { | ||
get: function(key) { | ||
return new Promise(function(resolve, reject) { | ||
@@ -13,3 +13,3 @@ NativeStorage.getItem(key, resolve, function(e) { | ||
}, | ||
set: function (key, value) { | ||
set: function(key, value) { | ||
return new Promise(function(resolve, reject) { | ||
@@ -16,0 +16,0 @@ NativeStorage.setItem(key, value, resolve, reject); |
Sorry, the diff of this file is not supported yet
16
964
326
78435