firebase / firebase-cpp-sdk

Firebase C++ SDK
http://firebase.google.com
Apache License 2.0
278 stars 114 forks source link

Always forward received UNNotifications #1604

Closed smarty-concrete closed 4 months ago

smarty-concrete commented 5 months ago

to an overridden user delegate, even before the messaging SDK is initialized.

Description

Provide details of the change, and generalize the change in the PR title above.

messaging.mm sets up a UNUserNotificationCenterDelegate in RequestPermission. If any other delegate was already set, it is designed to forward incoming notifications to the previous delegate in -[UIApplication userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:]. However, RequestPermission may be called before Messaging is initialized, in which case these notifications were not being forwarded. If any user notifications come in before Firebase Messaging is initialized, the notification is lost.

This is the cause of https://github.com/firebase/firebase-unity-sdk/issues/377 as well as https://github.com/Unity-Technologies/com.unity.mobile.notifications/issues/316

Notifications should now be forwarded to the overridden delegate, whether Messaging is initialized or not.


Type of Change

Place an x the applicable box:

github-actions[bot] commented 5 months ago

✅  Integration test succeeded!

Requested by @jonsimantov on commit refs/pull/1604/merge Last updated: Tue Jun 11 15:55 PDT 2024 View integration test log & download artifacts