Skip to content

Commit

Permalink
[Android] Keep fragment listener alive.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laimiux committed Oct 16, 2024
1 parent 21955e6 commit f401347
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ internal class ActivityManager<Activity : FragmentActivity>(
uiSubscription?.dispose()
uiSubscription = null

fragmentRenderView?.dispose()
fragmentRenderView = null

delegate.detachActivity(activity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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<Any> {
return FormulaFragmentViewFactory(
environment = fragmentEnvironment,
Expand Down

0 comments on commit f401347

Please sign in to comment.