|
| 1 | +import { Injectable } from '@angular/core'; |
| 2 | +import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; |
| 3 | + |
| 4 | +/** |
| 5 | + * @name App Review |
| 6 | + * @description |
| 7 | + * Cordova plugin to review app |
| 8 | + * |
| 9 | + * @usage |
| 10 | + * ```typescript |
| 11 | + * import { AppReview } from '@awesome-cordova-plugins/app-review/ngx'; |
| 12 | + * |
| 13 | + * |
| 14 | + * constructor(private appReview: AppReview) { } |
| 15 | + * |
| 16 | + * ... |
| 17 | + * |
| 18 | + * |
| 19 | + * this.appReview.requestReview() |
| 20 | + * .then(() => console.log('Success')) |
| 21 | + * .catch((error: any) => console.error(error)); |
| 22 | + * |
| 23 | + * ``` |
| 24 | + */ |
| 25 | +@Plugin({ |
| 26 | + pluginName: 'AppReview', |
| 27 | + plugin: 'cordova-plugin-app-review', |
| 28 | + pluginRef: 'cordova.plugins.AppReview', |
| 29 | + repo: 'https://github.com/chemerisuk/cordova-plugin-app-review', |
| 30 | + platforms: ['Android', 'iOS'], |
| 31 | +}) |
| 32 | +@Injectable() |
| 33 | +export class AppReview extends AwesomeCordovaNativePlugin { |
| 34 | + /** |
| 35 | + * Launches in-app review dialog. |
| 36 | + * |
| 37 | + * @returns {Promise<void>} Callback when operation is completed |
| 38 | + */ |
| 39 | + @Cordova({ sync: true }) |
| 40 | + requestReview(): Promise<void> { |
| 41 | + return; |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * Launches App/Play store page with a review form. By default current app screen |
| 46 | + * is displayed but you can pass a package name string to show another app details. |
| 47 | + * |
| 48 | + * @param {string} [packageName] Package name to show instead of the current app. |
| 49 | + * @returns {Promise<void>} Callback when operation is completed |
| 50 | + */ |
| 51 | + @Cordova({ sync: true }) |
| 52 | + openStoreScreen(packageName?: string): Promise<void> { |
| 53 | + return; |
| 54 | + } |
| 55 | +} |
0 commit comments