mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-22 09:49:35 +08:00
feat(fcm): add getAPNSToken and hasPermission methods (#3211)
This commit is contained in:
parent
86cca49236
commit
08332b7c02
@ -47,6 +47,12 @@ export interface NotificationData {
|
|||||||
* backend.registerToken(token);
|
* backend.registerToken(token);
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
|
* this.fcm.hasPermission().then(hasPermission => {
|
||||||
|
* if (hasPermission) {
|
||||||
|
* console.log("Has permission!");
|
||||||
|
* }
|
||||||
|
* })
|
||||||
|
*
|
||||||
* this.fcm.unsubscribeFromTopic('marketing');
|
* this.fcm.unsubscribeFromTopic('marketing');
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
@ -62,6 +68,16 @@ export interface NotificationData {
|
|||||||
})
|
})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FCM extends IonicNativePlugin {
|
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
|
* Gets device's current registration id
|
||||||
*
|
*
|
||||||
@ -108,6 +124,19 @@ export class FCM extends IonicNativePlugin {
|
|||||||
return;
|
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
|
* Watch for incoming notifications
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user