Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hansemannn/titanium-review-dialog
Use the native iOS 10.3+ SKStoreReviewController and Android dialog in Appcelerator Titanium.
https://github.com/hansemannn/titanium-review-dialog
appcelerator appstore review-dialog titanium
Last synced: 3 months ago
JSON representation
Use the native iOS 10.3+ SKStoreReviewController and Android dialog in Appcelerator Titanium.
- Host: GitHub
- URL: https://github.com/hansemannn/titanium-review-dialog
- Owner: hansemannn
- License: other
- Created: 2017-03-28T13:19:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T17:20:05.000Z (5 months ago)
- Last Synced: 2024-07-30T04:58:17.360Z (3 months ago)
- Topics: appcelerator, appstore, review-dialog, titanium
- Language: Java
- Homepage:
- Size: 9.59 MB
- Stars: 42
- Watchers: 12
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Review Dialogs in Appcelerator Titanium
### Summary
Use the `SKStoreReviewController` from iOS 10.3+ in your Ttanium application. Also use a native Android dialog
for best parity.### Requirements
- Titanium Mobile SDK 8+
- iOS 10.3+
- Android 4.4+### Android Usage
```js
import Review from 'ti.reviewdialog';if (!Review.isSupported()) { return; }
Review.requestReview();
// when review is done
Review.addEventListener("complete", function(e){
console.log(e.success);
});
```### iOS Usage
There are some important notes on when to show the rating dialog (thanks to [@skypanther](https://github.com/skypanther):
* The internal API itself will decide when, or if, to show the prompt
* You should not show it more than once for a given version of your app
* You should not show the dialog in response to user actions (like after a user clicks a button)
* You should not show it on first app launch (even after an update) but should wait until the user has used your app for a "meaningful" amount.The following (ES6+ based) example shows how to use it in a real world example. It relies on the [semver module](https://github.com/smclab/ti-semver) / http://gitt.io/component/semver to compare app versions.
Apple's own example uses a simple launch count to determine "meaningful" amount of use, which is also used
in this example. You should use something appropriate for your app (amount of time, completion of an
action N times, etc.):```js
import semver from 'semver';
import Review from 'ti.reviewdialog';// first, check that the user has used your app for a "meaningful" amount
// here, a simple count of some action
let countOfSomeUserAction = Ti.App.Properties.getInt('countOfSomeUserAction', 0);
countOfSomeUserAction += 1;Ti.App.Properties.setInt('countOfSomeUserAction', countOfSomeUserAction);
if (countOfSomeUserAction >= 4) {
// if they've done whatever action 4 or more times, check the app version
const lastVersionPromptedForReview = Ti.App.Properties.getString('lastVersionPromptedForReview', '1.0.0');
let appVersion = Ti.App.version;
const appVersionAsArray = appVersion.split('.');
if (appVersionAsArray.length > 3) {
// the semver library supports max 3-part version numbers (per semver rules)
appVersion = appVersionAsArray[0] + '.' + appVersionAsArray[1] + '.' + appVersionAsArray[2];
}
if (semver.gt(appVersion, lastVersionPromptedForReview)) {
// if the current app version is greater-than the last time you prompted them
// prompt them with the titanium-review-dialog alert
Ti.App.Properties.setString('lastVersionPromptedForReview', appVersion);
if (Review.isSupported()) {
Review.requestReview();
}
}
}
```### Download
* [Stable release](https://github.com/hansemannn/titanium-review-dialog/releases)
* [![gitTio](http://hans-knoechel.de/shields/shield-gittio.svg)](http://gitt.io/component/ti.reviewdialog)### Setup
Unpack the modules and place them inside the `modules/iphone/` and `modules/android/` folder of your project.
Edit the modules section of your `tiapp.xml` file to include this module:
```xmlti.reviewdialog
ti.reviewdialog```
### Example
Request a new review dialog:
```javascript
import Review from 'ti.reviewdialog';if (Review.isSupported()) {
Review.requestReview();
}
```
#### Methods
- [x] `isSupported`
- [x] `requestReview`### Events
- [x] `complete` (Android only) **Note:** The API does not indicate whether the user reviewed or not, or even whether the review dialog was shown.### Author
Hans Knoechel ([@hansemannnn](https://twitter.com/hansemannnn) / [Web](https://hans-knoechel.de))### License
Apache 2.0### Contributing
Code contributions are greatly appreciated, please submit a new [pull request](https://github.com/hansemannn/titanium-review-dialog/pull/new/master)!