Releases: andrehtissot/cordova-plugin-fcm-with-dependecy-updated
FCMPlugin.requestPushPermissionIOS improvements
The FCMPlugin.requestPushPermissionIOS
function now, not only triggers the request alert, but also returns, as boolean, if the permission was given.
FCMPlugin.requestPushPermissionIOS(
function(wasPermissionGiven) {
console.info("Was permission given: "+wasPermissionGiven);
},
function(error) {
console.error(error);
},
ios9Support: {
timeout: 10, // How long it will wait for a decision from the user before returning `false`
interval: 0.3 // How long between each permission verification
}
);
Note:
On iOS 9, there is no way to know if the user has denied the permissions or he has not yet decided.
For this reason, specifically for iOS 9, after presenting the alert, a timed loop waits until it knows that the user has either given the permissions or that the time has expired.
On iOS 10+, the return is given as soon as the user has selected.
Special thanks to @maximo72 for requesting this improvement.
Tapping improvement for iOS notifications
Now the "notification was tapped and the app is getting to the foreground" state is now not skipped, which should not be necessary, but that presented good results.
Special thanks to @bido20 for creating the issue, for @roman-rr and @plailopo for participating in the discussion and @cesarak for creating a PR with the fix.
createNotificationChannelAndroid now accepts "sound", "lights" and "vibration".
FCMPlugin.createNotificationChannelAndroid improved, now accepting three other options: "sound", "lights" and "vibration", like in:
FCMPlugin.createNotificationChannelAndroid({
id: "urgent_alert", // required
name: "Urgent Alert", // required
description: "Very urgent message alert",
importance: "high", // https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
visibility: "public", // https://developer.android.com/training/notify-user/build-notification#lockscreenNotification
sound: "alert_sound", // In the "alert_sound" example, the file should located as resources/raw/alert_sound.mp3
lights: true, // enable lights for notifications
vibration: true // enable vibration for notifications
});
Special thanks to @avoskresenskiy-alytics for implementing it and describing it in a PR.
Fixed version definition
v6.2.1 Upgraded to 6.2.1
Reintroduced iOS 9 support
Instead of growing the main file too big, the code required for iOS 9 support was implemented in a separate file and just called instead of the iOS 10+ code.
Special thanks to @smorris1709, @ulver2812 and others for requesting this feature.
Added createNotificationChannelAndroid feature
For Android, some notification properties are only defined programmatically, one of those is channel.
Channel can define the default behavior for notifications on Android 8.0+.
This feature was meant to bring the channel-only configurations importance and visibility:
FCMPlugin.createNotificationChannelAndroid({
id: "urgent_alert", // required
name: "Urgent Alert", // required
description: "Very urgent message alert",
importance: "high", // https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
visibility: "public", // https://developer.android.com/training/notify-user/build-notification#lockscreenNotification
});
! Once a channel is created, it stays unchangeable until the user uninstalls the app. !
To have a notification to use the channel, you have to add to the push notification payload the key android_channel_id
with the id given to createNotificationChannelAndroid
(https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support)
Special thanks to @sajhu for requesting this feature.
Hotfix to avoid compatibility issue with cordova-plugin-ionic-webview
Cordova and Ionic communities have worked on their own approach to replace the deprecated UIWebView to WKWebView, which are incompatible and break on build.
For this issue to not occur, the dependency cordova-plugin-fcm-with-dependecy-updated had to be removed from cordova-plugin-fcm-with-dependecy-updated's definition.
Special thanks to @melanom and @andremarchezini for reporting this issue.
UIWebView replaced with WKWebView
This back-ported WKWebView fix is intended for users who absolutely need the iOS 9 support.
Special thanks to @ulver2812, for requesting it.
iOS Push permission is now manually triggered
On iOS, first run doesn't automatically request Push permission.
This change allows the user to get used to the app before being asked about receiving notifications.
The permission, as it is still required, may now be requested from javascript at any moment by executing:
//FCMPlugin.requestPushPermissionIOS( successCallback(), errorCallback(err) );
FCMPlugin.requestPushPermissionIOS();
Special thanks to @loama, for requesting this feature.
Now using WKWebView
Replaced UIWebView
with WKWebView
, as required by Apple (https://developer.apple.com/documentation/uikit/uiwebview).
For a smooth upgrade, the changes requested for cordova support (https://cordova.apache.org/howto/2020/03/18/wkwebviewonly) are applied automatically.
Special thanks for @andremarchezini for requesting this update.