Repository navigation
Conversation
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. |
… report unheard display messages firebase-inappmessaging-display removes all listeners on every activity pause, so the lifecycle streams went silent on Android after the app was backgrounded or a campaign opened another activity. The listeners are now added again when an activity resumes. A campaign sent to onMessageDisplay while nothing listened was dropped and never reported, which on iOS blocks every later campaign. It is now held for the first listener and reported as a display error if none subscribes within 5 seconds.
A message that arrives on `onMessageDisplay` while nothing listens is still held for the first listener for a few seconds. When none arrives: - iOS reports it as a display error, as before, so the SDK releases its display lock and can show the next campaign. `onMessageDisplayError` fires for it. - Android now only drops it. `displayErrorEncountered` stores a campaign impression there, and for app open campaigns uses up the one a day app open limit, for a message nobody saw. Android has no display lock, so the campaign stays eligible and triggers again. On Android, disabling custom display while it is already off, which `onDetachedFromEngine` also does, no longer pauses and resumes the default display on the current activity. That restarted a default message on screen and dropped the listeners of other engines. The plugin's SDK calls now go through an internal seam, so JUnit tests drive its activity lifecycle wiring against a fake `Application`.
6a21b26 to
6aeb37b
Compare
Description
Fixes three event bugs in the lifecycle events (#18584) and custom display (#18586) added in 0.10.0.
1. Android: event listeners stop after the first activity pause.
The SDK's default display removes every listener on each activity pause. The plugin added them only once, so after the app went to the background,
onMessageClicked,onMessageImpression,onMessageDismissedandonMessageDisplayErrorstayed silent. Fix: the plugin adds them again when an activity resumes.2. Messages sent to
onMessageDisplayare lost when nothing listens yet.On iOS, the SDK then waits forever for a click, dismiss or error, and shows no other campaign. Fix: a message is held for the first listener. If nobody listens within 5 seconds, or a newer campaign replaces it:
The docs now say to listen to
onMessageDisplaybefore enabling custom display.3. Android: turning off custom display when it is already off flickers the default display.
It now does nothing in that case.
Tests
method_channel_firebase_in_app_messaging_test.dart, run as Android and iOS): a message sent before the first listener reaches it; on iOS an unheard or replaced message is reported as a display error; on Android it is dropped without a report.FirebaseInAppMessagingPluginTest:listenersAreAddedAgainWhenAnActivityResumesfails without fix 1.disablingCustomDisplayThatIsOff_leavesTheDefaultDisplayAloneandonDetachedFromEngine_withCustomDisplayOff_leavesTheDefaultDisplayAlonefail without fix 3.EventListenerRegistrationTestcovers when listeners are added and removed.android_unit_tests.yamlnow also runs:firebase_in_app_messaging:testDebugUnitTest.Related Issues
Follow-up to #18584 and #18586.
Checklist
///).melos run analyze) does not report any problems on my PR.Breaking Change