Skip to content

Centered and bottom-anchored in-app messages intermittently display anchored to the top #962

@keiferstone

Description

@keiferstone

✍️ Issue Description

Context

  • Single-activity app utilizing Jetpack Compose / Jetpack Navigation
  • We have logic in place to show pending in-app messages via a LifecycleStartEffect whenever the user navigates to a new screen (if there is a pending in-app message to show). This LifecycleStartEffect runs as soon as the screen comes into the composition.

📋 Steps to Reproduce

  1. Create a bottom-anchored in-app message in Iterable
  2. Have a LifecycleStartEffect that 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 {}
}
  1. Send a test in-app message
  2. Navigate to a screen that checks for pending in-app messages

Expected result: In-app message displays as expected. Screenshot

Image

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
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions