-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
✍️ Issue Description
Context
- Single-activity app utilizing Jetpack Compose / Jetpack Navigation
- We have logic in place to show pending in-app messages via a
LifecycleStartEffectwhenever the user navigates to a new screen (if there is a pending in-app message to show). ThisLifecycleStartEffectruns as soon as the screen comes into the composition.
📋 Steps to Reproduce
- Create a bottom-anchored in-app message in Iterable
- Have a
LifecycleStartEffectthat runs immediately upon navigating to a new screen, checking for and showing a pending in-app message if one exists. Code snippet:
LifecycleStartEffect(screenName) {
val inAppManager = IterableApi.getInstance().inAppManager
inAppManager.messages.find { pendingInAppMessage ->
// Logic for determining if in-app message is valid for display
}?.let { pendingInAppMessage ->
inAppManager.showMessage(pendingInAppMessage)
}
onStopOrDispose {}
}
- Send a test in-app message
- Navigate to a screen that checks for pending in-app messages
Expected result: In-app message displays as expected. Screenshot
Actual result: In-app message intermittently displays anchored to the top (roughly ~30% of the time in my testing). Video:
Screen_recording_20251112_115429.mp4
Theory
It seems like there is some race condition between Jetpack Navigation and Iterable showing the in-app message, but I haven't been able to pinpoint any code that could potentially be at fault. Adding a delay of 2 seconds before calling inAppManager.showMessage(pendingInAppMessage) seems to fix the issue, but it's a bandaid solution. I'm happy to debug further if you have any suggestions. Thanks!
👤 Iterable orgId:
📦 Iterable SDK version: 3.6.2
📲 Android OS version: All versions that we support (Android 10+)
Metadata
Metadata
Labels
No labels