mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 13:57:10 +09:00
DROID-2067 Onboarding | Fix | Back navigation is broken when rapidly pressing back button twice on set-profile-name screen (#716)
This commit is contained in:
parent
120e5948cc
commit
af717fe79b
1 changed files with 18 additions and 11 deletions
|
@ -280,16 +280,22 @@ class OnboardingFragment : Fragment() {
|
|||
}
|
||||
) {
|
||||
val focus = LocalFocusManager.current
|
||||
val onBackClicked : () -> Unit = {
|
||||
val lastDestination = navController.currentBackStackEntry
|
||||
if (lastDestination?.destination?.route == OnboardingNavigation.setProfileName) {
|
||||
focus.clearFocus(true)
|
||||
navController.popBackStack()
|
||||
} else {
|
||||
Timber.d("Skipping exit click...")
|
||||
}
|
||||
}
|
||||
currentPage.value = OnboardingPage.SET_PROFILE_NAME
|
||||
backButtonCallback.value = {
|
||||
focus.clearFocus(true)
|
||||
navController.popBackStack()
|
||||
}
|
||||
SetProfileName(navController = navController)
|
||||
BackHandler {
|
||||
focus.clearFocus(true)
|
||||
navController.popBackStack()
|
||||
}
|
||||
backButtonCallback.value = onBackClicked
|
||||
SetProfileName(
|
||||
navController = navController,
|
||||
onBackClicked = onBackClicked
|
||||
)
|
||||
BackHandler { onBackClicked() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +409,8 @@ class OnboardingFragment : Fragment() {
|
|||
|
||||
@Composable
|
||||
private fun SetProfileName(
|
||||
navController: NavHostController
|
||||
navController: NavHostController,
|
||||
onBackClicked: () -> Unit
|
||||
) {
|
||||
val component = componentManager().onboardingSoulCreationComponent
|
||||
val vm = daggerViewModel { component.get().getViewModel() }
|
||||
|
@ -414,7 +421,7 @@ class OnboardingFragment : Fragment() {
|
|||
|
||||
SetProfileNameWrapper(
|
||||
viewModel = vm,
|
||||
onBackClicked = { navController.popBackStack() }
|
||||
onBackClicked = onBackClicked
|
||||
)
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue