mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-05-14 06:34:07 +08:00
refactor(launch-review): update the definitions for new v3 plugin API (#2162)
This commit is contained in:
parent
10a96fcdd6
commit
154a4bcacb
@ -5,9 +5,9 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|||||||
* @name Launch Review
|
* @name Launch Review
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
* This launches the native store app in order for the user to leave a review.
|
* Assists in leaving user reviews/ratings in the App Stores.
|
||||||
* On Android, the plugin opens the the app's storepage in the Play Store where the user can leave a review by pressing the stars to give a rating.
|
* - Launches the platform's App Store page for the current app in order for the user to leave a review.
|
||||||
* On iOS, the plugin opens the app's storepage in the App Store and focuses the Review tab, where the user can leave a review by pressing "Write a review".
|
* - On iOS (10.3 and above) invokes the native in-app rating dialog which allows a user to rate your app without needing to open the App Store.
|
||||||
*
|
*
|
||||||
* @usage
|
* @usage
|
||||||
* ```typescript
|
* ```typescript
|
||||||
@ -17,9 +17,13 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
* const appId: string = 'yourAppId';
|
* this.launchReview.launch()
|
||||||
* this.launchReview.launch(appId)
|
|
||||||
* .then(() => console.log('Successfully launched store app');
|
* .then(() => console.log('Successfully launched store app');
|
||||||
|
*
|
||||||
|
* if(this.launchReview.isRatingSupported()){
|
||||||
|
* this.launchReview.rating()
|
||||||
|
* .then(() => console.log('Successfully launched rating dialog');
|
||||||
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
@ -33,10 +37,34 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|||||||
export class LaunchReview extends IonicNativePlugin {
|
export class LaunchReview extends IonicNativePlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch store app using given app ID
|
* Launches App Store on current platform in order to leave a review for given app.
|
||||||
|
* @param appId {string} - (optional) the platform-specific app ID to use to open the page in the store app.
|
||||||
|
* If not specified, the plugin will use the app ID for the app in which the plugin is contained.
|
||||||
|
* On Android this is the full package name of the app. For example, for Google Maps: `com.google.android.apps.maps`
|
||||||
|
* On iOS this is the Apple ID of the app. For example, for Google Maps: `585027354`
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@Cordova()
|
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
|
||||||
launch(appId: string): Promise<void> { return; }
|
launch(appId?: string): Promise<void> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes the native in-app rating dialog which allows a user to rate your app without needing to open the App Store.
|
||||||
|
* Requires iOS 10.3 and above: Calling this on any platform/version other than iOS 10.3+ will result in the error callback.
|
||||||
|
* Success callback will be called up to 3 times:
|
||||||
|
* - First: after `LaunchReview.rating()` is called and the request to show the dialog is successful. Will be passed the value `requested`.
|
||||||
|
* - Second: if and when the Rating dialog is actually displayed. Will be passed the value `shown`.
|
||||||
|
* - Third: if and when the Rating dialog is dismissed. Will be passed the value `dismissed`.
|
||||||
|
* @returns {Promise<string>}
|
||||||
|
*/
|
||||||
|
@Cordova({ platforms: ['iOS'] })
|
||||||
|
rating(): Promise<string> { return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the current platform/version supports in-app ratings dialog, i.e. calling LaunchReview.rating().
|
||||||
|
* Will return true if current platform is iOS 10.3 or above.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
@Cordova({ platforms: ['Android', 'iOS'], sync: true })
|
||||||
|
isRatingSupported(): boolean { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user