Skip to content

Commit

Permalink
feat(fcm): add getAPNSToken and hasPermission methods (#3211)
Browse files Browse the repository at this point in the history
  • Loading branch information
stojanovic authored and danielsogl committed Oct 30, 2019
1 parent 86cca49 commit 08332b7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/@ionic-native/plugins/fcm/index.ts
Expand Up @@ -47,6 +47,12 @@ export interface NotificationData {
* backend.registerToken(token);
* });
*
* this.fcm.hasPermission().then(hasPermission => {
* if (hasPermission) {
* console.log("Has permission!");
* }
* })
*
* this.fcm.unsubscribeFromTopic('marketing');
*
* ```
Expand All @@ -62,6 +68,16 @@ export interface NotificationData {
})
@Injectable()
export class FCM extends IonicNativePlugin {
/**
* Gets ios device's current APNS token
*
* @returns {Promise<string>} Returns a Promise that resolves with the APNS token
*/
@Cordova()
getAPNSToken(): Promise<string> {
return;
}

/**
* Gets device's current registration id
*
Expand Down Expand Up @@ -108,6 +124,19 @@ export class FCM extends IonicNativePlugin {
return;
}

/**
* Checking for permissions on iOS. On android, it always returns `true`.
*
* @returns {Promise<boolean | null>} Returns a Promise:
* - true: push was allowed (or platform is android)
* - false: push will not be available
* - null: still not answered, recommended checking again later.
*/
@Cordova()
hasPermission(): Promise<boolean | null> {
return;
}

/**
* Watch for incoming notifications
*
Expand Down

0 comments on commit 08332b7

Please sign in to comment.