tinypass / piano-sdk-for-android

Piano SDK for Android
https://docs.piano.io/mobile-app-experiences
Apache License 2.0
15 stars 11 forks source link

Crash in ShowTemplateController's show() method #26

Closed njboro closed 3 years ago

njboro commented 3 years ago

Hi,

I am using Piano SDK 2.0.5. I am trying to show template after 10 sec(configured in Dashboard) in screen A, and when I move to screen B after 5 sec and when PIANO SDK tries to show the template in screen A after 10 sec, then app is crashing.

Issue is inside ShowTemplateController's show() method which is handled by Piano SDK. So

Crash logs : java.lang.IllegalStateException: at androidx.fragment.app.FragmentManager.checkStateLoss (FragmentManager.java:1703) at androidx.fragment.app.FragmentManager.enqueueAction (FragmentManager.java:1743) at androidx.fragment.app.BackStackRecord.commitInternal (BackStackRecord.java:321) at androidx.fragment.app.BackStackRecord.commit (BackStackRecord.java:286) at androidx.fragment.app.DialogFragment.show (DialogFragment.java:181) at io.piano.android.composer.showtemplate.ShowTemplateController$Companion$showModal$$inlined$with$lambda$1.invoke (ShowTemplateController.kt:135) at io.piano.android.composer.showtemplate.ShowTemplateController$Companion$showModal$$inlined$with$lambda$1.invoke (ShowTemplateController.kt:34) at io.piano.android.composer.showtemplate.ShowTemplateController$Companion$processDelay$func$1.invoke (ShowTemplateController.kt:145) at io.piano.android.composer.showtemplate.ShowTemplateController$Companion$processDelay$func$1.invoke (ShowTemplateController.kt:34) at io.piano.android.composer.showtemplate.ShowTemplateController$sam$i$java_lang_Runnable$0.run (Unknown Source:2) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:236) at android.app.ActivityThread.main (ActivityThread.java:8060) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:967)

DeKaN commented 3 years ago

Do you use fragments or activities for these screens? Can you check with SDK 2.2.1 (it has a newer AndroidX Activity library)?

njboro commented 3 years ago

I use activities. Can I get SDK documentation for 2.2.1 and Migration document from 2.0.5 to 2.2.1 ?

njboro commented 3 years ago

Another crash :

Fatal Exception: kotlin.UninitializedPropertyAccessException lateinit property jsInterface has not been initialized io.piano.android.composer.showtemplate.ShowTemplateDialogFragment.onCreateDialog (ShowTemplateDialogFragment.kt:26)

DeKaN commented 3 years ago

Current documentation is always available in the repo. You can use "sample" history as a migration guide. We have only one big change in Composer initialization.

Can you provide some code for your case? How do you move between activities: startForResult B, simple start B, or finishing A? You can share thecode via gist/repo or via a support ticket, if your code isn't for public (please add link to Github issue for this option)

lateinit property jsInterface has not been initialized had been fixed in 2.2.0

njboro commented 3 years ago

PFA code for simple start B :

Intent intent = new Intent(context, BActivity.class); intent.putExtra("key", from); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); context.startActivity(intent);

DeKaN commented 3 years ago

Thanks for the information, I'll check it and will fix bug

njboro commented 3 years ago

Hi Dekan, is the bug fixed?

DeKaN commented 3 years ago

@njboro Yes, but the new version will be released in a week. I'll notify you after release in this issue

DeKaN commented 3 years ago

@njboro Fixed with version 2.3.0