braze-inc / braze-android-sdk

https://www.braze.com
Other
19 stars 7 forks source link

[Bug]: ContentCardFragment does not display first in-app message #21

Closed ruialmeidah19 closed 4 months ago

ruialmeidah19 commented 6 months ago

Braze Android SDK Version

29.0.1

Steps To Reproduce

We currently have a content card that displays an in-app messaged when tapped. This in-app message creates an InAppMessageHtmlView. When we try to display this in-app message for the first time, or any other in-app message for that matter, while the ContentCardFragment is displaying, we get the error thrown in the logs below. After closing the screen and opening again, it works as intended. But with the first time after killing the app, this always happens, and the common denominator seems to be the ContentCardFragment.

  1. Open a screen with a ContentCardFragment.
  2. Try to display an in-app message.
  3. Check that the in-app message does not display if it's the first we're trying to display after a cold start.
  4. Leave the screen.
  5. Re-enter the screen.
  6. Try to display an in-app message.
  7. Check that the in-app message now displays properly.

Expected Behavior

The expected behaviour is like version 29.0.0. No error is thrown and the in-app message opens the first time. Everything appears to be working with no issues with version 29.0.0.

Verbose Logs

E  Child job of BrazeCoroutineScope got exception: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:11199)
at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:2487)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at androidx.recyclerview.widget.RecyclerView.requestLayout(RecyclerView.java:4881)
at android.view.View.requestLayout(View.java:27053)
at android.view.View.requestLayout(View.java:27053)
at androidx.constraintlayout.widget.ConstraintLayout.requestLayout(ConstraintLayout.java:3605)
at android.view.View.requestLayout(View.java:27053)
at android.widget.ImageView.setImageDrawable(ImageView.java:606)
at androidx.appcompat.widget.AppCompatImageView.setImageDrawable(AppCompatImageView.java:112)
at android.widget.ImageView.setImageBitmap(ImageView.java:772)
at androidx.appcompat.widget.AppCompatImageView.setImageBitmap(AppCompatImageView.java:124)
at com.braze.images.DefaultBrazeImageLoader$q.invokeSuspend(SourceFile:13)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

Additional Information

No response

radixdev commented 5 months ago

Hi @ruialmeidah19 ,

Apologies for the late response. We've internally filed a bug ticket about the change we made here and will update this issue once that's live.

ruialmeidah19 commented 4 months ago

Thanks for the update @radixdev, appreciate it!

radixdev commented 4 months ago

Hi @ruialmeidah19 ,

We made an update to this in 30.0.0 that should fix it for you. Please let us know!