feat(fcm): add getAPNSToken and hasPermission methods (#3211)

This commit is contained in:
Slobodan Stojanović 2019-10-30 16:56:23 +01:00 committed by Daniel Sogl
parent 86cca49236
commit 08332b7c02

View File

@ -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');
*
* ```
@ -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
*
@ -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
*