fix(push): hasPermission is part of Push object

addresses comment in #1297
This commit is contained in:
Ibby Hadeed 2017-03-30 15:48:46 -04:00
parent 390f474ad5
commit 145577f9bc

View File

@ -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 = {
* android: {
* senderID: '12345679'
@ -264,6 +279,13 @@ export class Push {
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
* @param event {string}