mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-22 09:49:35 +08:00
fix(push): hasPermission is part of Push object
addresses comment in #1297
This commit is contained in:
parent
390f474ad5
commit
145577f9bc
@ -213,6 +213,21 @@ export type PushEvent = 'registration' | 'error' | 'notification';
|
|||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* // to check if we have permission
|
||||||
|
* this.push.hasPermission()
|
||||||
|
* .then((res: any) => {
|
||||||
|
*
|
||||||
|
* if (res.isEnabled) {
|
||||||
|
* console.log('We have permission to send push notifications');
|
||||||
|
* } else {
|
||||||
|
* console.log('We don't have permission to send push notifications');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // to initialize push notifications
|
||||||
|
*
|
||||||
* const options: PushOptions = {
|
* const options: PushOptions = {
|
||||||
* android: {
|
* android: {
|
||||||
* senderID: '12345679'
|
* senderID: '12345679'
|
||||||
@ -264,6 +279,13 @@ export class Push {
|
|||||||
return new PushObject(options);
|
return new PushObject(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the push notification permission has been granted.
|
||||||
|
* @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
hasPermission(): Promise<{ isEnabled: boolean }> { return; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -284,13 +306,6 @@ export class PushObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether the push notification permission has been granted.
|
|
||||||
* @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
|
|
||||||
*/
|
|
||||||
@Cordova()
|
|
||||||
hasPermission(): Promise<{ isEnabled: boolean }> { return; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an event listener
|
* Adds an event listener
|
||||||
* @param event {string}
|
* @param event {string}
|
||||||
|
Loading…
Reference in New Issue
Block a user