Skip to content

Commit

Permalink
When resetting the NavHostFragment, use the navigation visit callback…
Browse files Browse the repository at this point in the history
… to ensure that the WebView is detached first. This allows the normal visit flow to work properly when the nav graph is recreated.
  • Loading branch information
jayohms committed Oct 20, 2021
1 parent 947c188 commit d17ef8b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ abstract class TurboSessionNavHostFragment : NavHostFragment() {
}

fun reset(onReset: () -> Unit = {}) {
currentNavDestination.clearBackStack {
session.reset()
initControllerGraph()
onReset()
currentNavDestination.delegate().navigator.onNavigationVisit {
currentNavDestination.clearBackStack {
session.reset()
initControllerGraph()
onReset()
}
}
}

Expand Down

0 comments on commit d17ef8b

Please sign in to comment.