Skip to content

Commit

Permalink
[flutter-messaging] fix notifications disappearing after app launch (f…
Browse files Browse the repository at this point in the history
…irebase#227)

* fix notifications disappearing after app launch
  • Loading branch information
izabekz authored Jul 2, 2020
1 parent a2333ab commit d0fa43e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
8 changes: 6 additions & 2 deletions packages/firebase_messaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 6.0.16

* Fix push notifications clearing after app launch on iOS.

## 6.0.16

* Update lower bound of dart dependency to 2.0.0.

## 6.0.15
Expand Down Expand Up @@ -31,7 +35,7 @@

## 6.0.10

* Update README to explain how to correctly implement Android background message handling with the new v2 embedding.
* Update README to explain how to correctly implement Android background message handling with the new v2 embedding.

## 6.0.9

Expand Down Expand Up @@ -155,7 +159,7 @@ is not a top-level or static function.
* Add missing template type parameter to `invokeMethod` calls.
* Bump minimum Flutter version to 1.5.0.
* Replace invokeMethod with invokeMapMethod wherever necessary.

## 5.0.1+1

* Enable support for `onMessage` on iOS using `shouldEstablishDirectChannel`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,8 @@ - (void)applicationDidEnterBackground:(UIApplication *)application {

- (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;
// Removes badge number but doesn't clear push notifications,
// helpful when you have valuable info in your push notification
application.applicationIconBadgeNumber = 0;
}

Expand Down

0 comments on commit d0fa43e

Please sign in to comment.