Fix: Notification click not foreground the app in the first click if app is closed and no clickListener is added #2259
+39
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
This PR fixes a bug where clicking on a notification does not always bring the app to the foreground under certain conditions.
Details
Motivation
Some users have reported that clicking a notification for the first time does not foreground the app when it is fully closed. This creates unexpected behavior, and we aim to ensure the app opens correctly when a notification is clicked.
Scope
This PR will result in two app behavior changes:
OPTIONAL - Root cause explained
* There is a subscriber in 'extOpenedCallback', or
* 'setInternalNotificationLifecycleCallback' is called and subscribed.
Testing
Unit testing
Manual testing
To reproduce the scenario:
Expected: The notification should open the app.
Observed (before fix): The first click neither opened the app nor cleared the notification.
After the fix, we can observe that the first click always open the app and clear the notification tray.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is