Skip to content

Commit

Permalink
fix(push): hasPermission is part of Push object
Browse files Browse the repository at this point in the history
addresses comment in #1297
  • Loading branch information
ihadeed committed Mar 30, 2017
1 parent 390f474 commit 145577f
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/@ionic-native/plugins/push/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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; }

}

/**
Expand All @@ -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}
Expand Down

0 comments on commit 145577f

Please sign in to comment.