|
| 1 | +import { Injectable } from '@angular/core'; |
| 2 | +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; |
| 3 | + |
| 4 | +/** |
| 5 | + * @name System Alert Window Permission |
| 6 | + * @description |
| 7 | + * This plugin does something |
| 8 | + * |
| 9 | + * @usage |
| 10 | + * ```typescript |
| 11 | + * import { SystemAlertWindowPermission } from '@ionic-native/system-alert-window-permission/ngx'; |
| 12 | + * |
| 13 | + * |
| 14 | + * constructor(private systemAlertWindowPermission: SystemAlertWindowPermission) { } |
| 15 | + * |
| 16 | + * ... |
| 17 | + * |
| 18 | + * |
| 19 | + * this.systemAlertWindowPermission.hasPermission() |
| 20 | + * .then((res: any) => console.log(res)) |
| 21 | + * .catch((error: any) => console.error(error)); |
| 22 | + * |
| 23 | + * this.systemAlertWindowPermission.requestPermission() |
| 24 | + * .then((res: any) => console.log(res)) |
| 25 | + * .catch((error: any) => console.error(error)); |
| 26 | + * |
| 27 | + * ``` |
| 28 | + */ |
| 29 | + |
| 30 | +@Plugin({ |
| 31 | + pluginName: 'SystemAlertWindowPermission', |
| 32 | + plugin: 'cordova-plugin-system-alert-window-permission', |
| 33 | + pluginRef: 'window.systemAlertWindowPermission', |
| 34 | + repo: 'https://github.com/MaximBelov/cordova-plugin-system-alert-window-permission.git', |
| 35 | + install: 'ionic cordova plugin add cordova-plugin-system-alert-window-permission', |
| 36 | + platforms: ['Android'] |
| 37 | +}) |
| 38 | +@Injectable() |
| 39 | +export class SystemAlertWindowPermission extends IonicNativePlugin { |
| 40 | + |
| 41 | + /** |
| 42 | + * Check permission |
| 43 | + * @return {Promise<any>} return 0 when dont have SYSTEM_ALERT_WINDOW permission, 1 when have SYSTEM_ALERT_WINDOW permission |
| 44 | + */ |
| 45 | + @Cordova() |
| 46 | + hasPermission(): Promise<any> { |
| 47 | + return; |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Request permission |
| 52 | + * @return {Promise<any>} Returns a promise that resolves when something happens |
| 53 | + */ |
| 54 | + @Cordova() |
| 55 | + requestPermission(): Promise<any> { |
| 56 | + return; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Open notification Settings |
| 61 | + * @return {Promise<any>} Returns a promise that resolves when something happens |
| 62 | + */ |
| 63 | + @Cordova() |
| 64 | + openNotificationSettings(): Promise<any> { |
| 65 | + return; |
| 66 | + } |
| 67 | + |
| 68 | +} |
0 commit comments