fix(messaging, ios): emit onMessage for foreground pushes with content-available: 0 - #9229
fix(messaging, ios): emit onMessage for foreground pushes with content-available: 0#9229lnuvy wants to merge 1 commit into
Conversation
russellwheatley
left a comment
There was a problem hiding this comment.
Confirmed against main: the serializer sets contentAvailable to @(NO) whenever content-available is present at all, and the emit guard was checking key presence instead of value, so content-available: 0 got treated as a silent push and swallowed. The comment above the guard already states the intent in terms of the value, so this is a straightforward mismatch, not deliberate behavior.
Also checked the nil case: when content-available is absent, notificationDict[@"contentAvailable"] is nil, and [nil boolValue] returns NO per Objective-C's nil-messaging semantics (verified this by compiling and running it standalone). So onMessage still fires for pushes without the key, same as before. No crash risk there.
We don't have an XCTest harness for this delegate path yet, so this is verified by code review plus your manual device testing rather than an automated test. Given how small and low-risk the change is, that's enough for me here.
Approving, want to get this into the next release.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9229 +/- ##
============================================
+ Coverage 68.48% 68.49% +0.01%
Complexity 1914 1914
============================================
Files 522 522
Lines 38116 38116
Branches 5189 5189
============================================
+ Hits 26100 26102 +2
+ Misses 10226 10225 -1
+ Partials 1790 1789 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@russellwheatley |
Description
On iOS,
onMessageis never emitted for a foreground push whose payload setsaps.content-available: 0.willPresentNotificationguards emission on key presence(
!notificationDict[@"contentAvailable"]), but the serializer stores@(NO)for0, which isnon-nil — so the event is skipped as if it were a silent push. The comment above the guard
describes the intent in terms of the value ("if contentAvailable is true").
Compare the value instead:
Genuine silent pushes (
content-available: 1) are still skipped, preserving de-duplicationwith
application:didReceiveRemoteNotification:.Full analysis, reproduction payloads and history in #9228.
Related issues
Fixes #9228
Release Summary
iOS:
onMessageis now emitted for foreground pushes that explicitly setcontent-available: 0.Checklist
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/**/e2ejesttests added or updated inpackages/**/__tests__Test Plan
Manual on a physical iOS 26.5.1 device (
@react-native-firebase/messaging19.3.0), nativedelegate streamed via
xcrun devicectl device process launch --console.content-available: 0payload reacheswillPresentNotification, nomessaging_message_receivedemitted, JSonMessagenever called. Same payload without thekey fires normally.
onMessage; serialized message carries"contentAvailable": false.No ObjC test harness exists for this delegate path; happy to add a payload-variant e2e case if
maintainers point at the preferred shape.