diff --git a/formula-android/src/main/java/com/instacart/formula/android/internal/ActivityManager.kt b/formula-android/src/main/java/com/instacart/formula/android/internal/ActivityManager.kt index af00e8d9..c057af2c 100644 --- a/formula-android/src/main/java/com/instacart/formula/android/internal/ActivityManager.kt +++ b/formula-android/src/main/java/com/instacart/formula/android/internal/ActivityManager.kt @@ -83,7 +83,6 @@ internal class ActivityManager( uiSubscription?.dispose() uiSubscription = null - fragmentRenderView?.dispose() fragmentRenderView = null delegate.detachActivity(activity) diff --git a/formula-android/src/main/java/com/instacart/formula/android/internal/FragmentFlowRenderView.kt b/formula-android/src/main/java/com/instacart/formula/android/internal/FragmentFlowRenderView.kt index ec3fb35c..63e830a5 100644 --- a/formula-android/src/main/java/com/instacart/formula/android/internal/FragmentFlowRenderView.kt +++ b/formula-android/src/main/java/com/instacart/formula/android/internal/FragmentFlowRenderView.kt @@ -105,7 +105,7 @@ internal class FragmentFlowRenderView( super.onFragmentDetached(fm, f) // Only trigger detach, when fragment is actually being removed from the backstack - if (FragmentLifecycle.shouldTrack(f) && f.isRemoving) { + if (FragmentLifecycle.shouldTrack(f) && f.isRemoving && !activity.isChangingConfigurations) { val formulaFragment = f as? BaseFormulaFragment<*> val event = FragmentLifecycleEvent.Removed( fragmentId = f.getFormulaFragmentId(), @@ -137,13 +137,6 @@ internal class FragmentFlowRenderView( return false } - /** - * This method must be invoked in [android.app.Activity.onDestroy] - */ - fun dispose() { - activity.supportFragmentManager.unregisterFragmentLifecycleCallbacks(callback) - } - fun viewFactory(fragment: FormulaFragment): ViewFactory { return FormulaFragmentViewFactory( environment = fragmentEnvironment,