From 18bee4e2982fd55bff4918758619a42b2be3916c Mon Sep 17 00:00:00 2001 From: Amine Date: Fri, 28 Feb 2020 18:56:08 +0100 Subject: [PATCH] fix(fcm): add missing clearAllNotifications, hasPermission and getAPNSToken (#3331) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- src/@ionic-native/plugins/fcm/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/@ionic-native/plugins/fcm/index.ts b/src/@ionic-native/plugins/fcm/index.ts index bdb8f132d..27a223614 100644 --- a/src/@ionic-native/plugins/fcm/index.ts +++ b/src/@ionic-native/plugins/fcm/index.ts @@ -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 { return; } + + /** + * Removes existing push notifications from the notifications center + * + * @returns {Promise} + */ + @Cordova() + clearAllNotifications(): void { + return; + } }