-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(system-alert-window-permission): add plugin (#3659)
- Loading branch information
1 parent
4435155
commit 50f8a45
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/@ionic-native/plugins/system-alert-window-permission/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; | ||
|
||
/** | ||
* @name System Alert Window Permission | ||
* @description | ||
* This plugin does something | ||
* | ||
* @usage | ||
* ```typescript | ||
* import { SystemAlertWindowPermission } from '@ionic-native/system-alert-window-permission/ngx'; | ||
* | ||
* | ||
* constructor(private systemAlertWindowPermission: SystemAlertWindowPermission) { } | ||
* | ||
* ... | ||
* | ||
* | ||
* this.systemAlertWindowPermission.hasPermission() | ||
* .then((res: any) => console.log(res)) | ||
* .catch((error: any) => console.error(error)); | ||
* | ||
* this.systemAlertWindowPermission.requestPermission() | ||
* .then((res: any) => console.log(res)) | ||
* .catch((error: any) => console.error(error)); | ||
* | ||
* ``` | ||
*/ | ||
|
||
@Plugin({ | ||
pluginName: 'SystemAlertWindowPermission', | ||
plugin: 'cordova-plugin-system-alert-window-permission', | ||
pluginRef: 'window.systemAlertWindowPermission', | ||
repo: 'https://github.com/MaximBelov/cordova-plugin-system-alert-window-permission.git', | ||
install: 'ionic cordova plugin add cordova-plugin-system-alert-window-permission', | ||
platforms: ['Android'] | ||
}) | ||
@Injectable() | ||
export class SystemAlertWindowPermission extends IonicNativePlugin { | ||
|
||
/** | ||
* Check permission | ||
* @return {Promise<any>} return 0 when dont have SYSTEM_ALERT_WINDOW permission, 1 when have SYSTEM_ALERT_WINDOW permission | ||
*/ | ||
@Cordova() | ||
hasPermission(): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Request permission | ||
* @return {Promise<any>} Returns a promise that resolves when something happens | ||
*/ | ||
@Cordova() | ||
requestPermission(): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Open notification Settings | ||
* @return {Promise<any>} Returns a promise that resolves when something happens | ||
*/ | ||
@Cordova() | ||
openNotificationSettings(): Promise<any> { | ||
return; | ||
} | ||
|
||
} |