Repository navigation
Conversation
willPresentNotification answered UNNotificationPresentationOptionNone for every notification when AppDelegate owned the notification center, which hid banners posted by other plugins.
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
A forwarded remote notification must call the completion handler even when the app has not opted into presentation, so the banner stays hidden and iOS is not left waiting.
Description
On iOS,
willPresentNotificationcalled the shared completion handler withUNNotificationPresentationOptionNonewhenever this plugin had not replaced another delegate. UIScene apps that assignUNUserNotificationCenter.delegatetoAppDelegateforward that callback to every plugin. Messaging answeringNonehid foreground banners posted by other plugins, includingflutter_local_notifications, after 16.7.0.The handler is now called only when:
apsandgcm.message_id) and the app opted into foreground presentation viasetForegroundNotificationPresentationOptions.A forwarded local notification is left for the plugin that posted it. The same split is applied to
didReceiveNotificationResponseso a tap on that local notification is not consumed. APNs registration from #18620 is unchanged.Related Issues
Fixes #18699
Checklist
///).melos run analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
Test plan
AppDelegateownsUNUserNotificationCenter.delegate, nosetForegroundNotificationPresentationOptions: a data-only FCM message in the foreground still reachesonMessage, and a local notification posted from it is displayed.FLTFirebaseMessagingPlugin.configureNotificationCenterDelegate()called before the host sets the delegate.getToken()resolves and an APNs token is received ([firebase_messaging]: 16.5.0 never receives APNs token under UIScene (apns-token-not-set) — regression from 16.4.3 #18555 / fix(messaging,ios): register for APNs when UIScene plugins miss launch callbacks #18620).setForegroundNotificationPresentationOptions(alert: true)still shows an FCM notification message in the foreground.onMessageOpenedApp.