fix(fcm): add missing clearAllNotifications, hasPermission and getAPNSToken (#3331)

* fix(fcm): add missing clearAllNotifications

* getAPNSToken method added

New version of `cordova-plugin-fcm-with-dependecy-updated` released: v4.0.0

_“The old FCMPlugin.getToken is focused on retrieving the FCM Token. For the IOS, APNS token can now be retrieved by the new method”_ (Show readme)[https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated#version-400-12102019]

* hasPermission added

[Show readme.md](https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated#version-320-16092019)

#### Checking for permissions
Useful for IOS. On android, it will always return `true`.

```javascript
FCMPlugin.hasPermission(function(doesIt){
    // doesIt === true => yes, push was allowed
    // doesIt === false => nope, push will not be available
    // doesIt === null => still not answered, recommended checking again later
    if(doesIt) {
        haveFun();
    }
});
```
# Conflicts:
#	src/@ionic-native/plugins/fcm/index.ts

Co-authored-by: Alexis Caffa <AlexisCaffa@users.noreply.github.com>
This commit is contained in:
Amine 2020-02-28 18:56:08 +01:00 committed by GitHub
parent 7277c0fbe5
commit 18bee4e298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,6 +53,8 @@ export interface NotificationData {
* }
* })
*
* this.fcm.clearAllNotifications();
*
* this.fcm.unsubscribeFromTopic('marketing');
*
* ```
@ -150,4 +152,14 @@ export class FCM extends IonicNativePlugin {
onNotification(): Observable<NotificationData> {
return;
}
/**
* Removes existing push notifications from the notifications center
*
* @returns {Promise<void>}
*/
@Cordova()
clearAllNotifications(): void {
return;
}
}