-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
impact: criticalUsually a production crash with high user impact. (P1)Usually a production crash with high user impact. (P1)plugin: messagingtype: enhancementNew feature or requestNew feature or request
Description
Describe the bug
Hi, I found a undesired auto cleaning notifications scenario when application entering foreground. It is at line 159 in
https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m
- (void)applicationDidBecomeActive:(UIApplication *)application {
_resumingFromBackground = NO;
// Clears push notifications from the notification center, with the
// side effect of resetting the badge count. We need to clear notifications
// because otherwise the user could tap notifications in the notification
// center while the app is in the foreground, and we wouldn't be able to
// distinguish that case from the case where a message came in and the
// user dismissed the notification center without tapping anything.
// TODO(goderbauer): Revisit this behavior once we provide an API for managing
// the badge number, or if we add support for running Dart in the background.
// Setting badgeNumber to 0 is a no-op (= notifications will not be cleared)
// if it is already 0,
// therefore the next line is setting it to 1 first before clearing it again
// to remove all
// notifications.
application.applicationIconBadgeNumber = 1;
application.applicationIconBadgeNumber = 0;
}
To Reproduce
- get >=2 remote notifications on iPhone
- enter foreground
- all notifications & badges be unexpectedly removed
Expected behavior
Just remove the notification we clicked. Thanks!
ali-thowfeek, sspogra, izabekz, HeavnTeam, jlhour and 20 more
Metadata
Metadata
Assignees
Labels
impact: criticalUsually a production crash with high user impact. (P1)Usually a production crash with high user impact. (P1)plugin: messagingtype: enhancementNew feature or requestNew feature or request