fix: emit messaging_notification_opened only for default notification action on iOS.#8945
Conversation
|
@mtjkln is attempting to deploy a commit to the Invertase Team on Vercel. A member of the Team first needs to authorize it. |
|
Hello 👋, this PR has been opened for more than 14 days with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
|
Apologies this went stale without a look, it deserves a look |
@mikehardy thanks for reopening this, it will be really helpful if you can review this PR, as it will help all the devs who want to implement custom action and not worry about unexpected redirection, which happens when user interacts with the custom action, example reply from notification. |
|
@mikehardy hey Mike can you please take a look into this ? |
…lt notification action Ensure messaging_notification_opened is emitted only when the UNNotificationDefaultActionIdentifier is triggered. This prevents onNotificationOpened from being invoked for custom notification actions.
Capture a strong local for weak _originalDelegate in didReceiveNotificationResponse and openSettingsForNotification (same pattern as willPresent). Note in docs that opened/initial APIs are default body-tap only. Keep clang-format wrap; drop temporary plan (lives on Linear CP-263).
4f2537b to
df9e00d
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8945 +/- ##
============================================
+ Coverage 66.03% 66.07% +0.04%
- Complexity 1903 1904 +1
============================================
Files 497 497
Lines 39065 39068 +3
Branches 5845 5846 +1
============================================
+ Hits 25794 25810 +16
+ Misses 11806 11798 -8
+ Partials 1465 1460 -5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Description
🔥 Fix: emit messaging_notification_opened only for default notification action on iOS.
Summary
Ensure
messaging_notification_openedis emitted only when the default notification action is triggered on iOS.Previously the event could be emitted for all
UNNotificationResponseactions, including custom notification actions.This change restricts the event emission to
UNNotificationDefaultActionIdentifier, ensuringonNotificationOpenedAppis invoked only when the user taps the notification body.Why
When notifications include custom actions (e.g. Reply, Mark as Read), selecting those actions previously triggered
messaging_notification_opened.This caused
onNotificationOpenedAppto fire and often resulted in unintended navigation or redirection in apps that rely on the default notification tap behavior for routing.By emitting the event only for
UNNotificationDefaultActionIdentifier, custom actions no longer triggeronNotificationOpenedApp, aligning the behavior with expected iOS notification interaction patterns.Related issues
N/A
Release Summary
Fix iOS behavior where
messaging_notification_openedcould be emitted for custom notification actions. The event is now emitted only for the default notification tap.Checklist
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/**/e2ejesttests added or updated inpackages/**/__tests__Test Plan
onNotificationOpenedAppis triggered.onNotificationOpenedAppis not triggered.Think
react-native-firebaseis great? Please consider supporting the project with any of the below:React Native FirebaseandInvertaseon Twitter