cordova-plugin-firebasex
cordova-plugin-firebasex copied to clipboard
[iOS] lookup of isContentAvailable is incorrect for FCM data messages when app is in background
Bug report
CHECKLIST
-
[ x] I have read the issue reporting guidelines
-
[ x] I confirm this is a suspected bug or issue that will affect other users
- [ x] I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
- [ x] I have read the documentation thoroughly and it does not help solve my issue.
- [x ] I have checked that no similar issues (open or closed) already exist.
Current behavior:
When you send a DATA payload with FCM, the received payload on the app side is aps + content-available = 1
From the logs :
Apr 7 18:05:04 FarmLife[577] <Notice>: FirebasePlugin[native] LOG: didReceiveRemoteNotification: {
aps = {
"content-available" = 1;
};
"gcm.message_id" = 1617811504608547;
messageType = data;
"notification_android_priority" = 4;
"notification_android_sound" = default;
"notification_body" = body;
"notification_ios_sound" = default;
"notification_title" = title;
tag = 697;
uuid = "xxxxx";
}
However at line https://github.com/dpa99c/cordova-plugin-firebasex/blob/master/src/ios/AppDelegate+FirebasePlugin.m#L188
isContentAvailable is only looked up if "alert" is a key fo aps, but for a DATA payload, it's not set. so, isContentAvailable is false.
So, if you are in background, it will not go into
if([self.applicationInBackground isEqual:[NSNumber numberWithBool:YES]] && isContentAvailable){
[FirebasePlugin.firebasePlugin _logError:@"didReceiveRemoteNotification: omitting foreground notification as content-available:1 so system notification will be shown"];
}
So the background notification (content-available:1 per documentation https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html) will not pass to "system notification will be shown"
So the user can't tap the system notification no "tap" background will be set for https://github.com/dpa99c/cordova-plugin-firebasex/commit/cb3dda27ad97a5c5af14efc55971f93ef3d5d310
Expected behavior:
- do not lookup the iscontentAvailable inside "alert" but inside "aps" without alert
Steps to reproduce:
- send a DATA payload with FCM (not a notification payload)
Environment information
- Cordova CLI version
-
10.0.0
-
- Cordova platform version Installed platforms: android 9.0.0 ios 6.1.1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Reopening as stalebot incorrectly closed it