mirror of
https://github.com/igorescodro/alkaa.git
synced 2025-05-17 19:16:02 +08:00
🚷 Improve navigation flow
Additional functions called to improve the navigation. The improvements are: - Avoid navigating to the same place if it's already on top - Save and restore state for the TopLevel destinations
This commit is contained in:
@ -49,13 +49,18 @@ private fun NavigationLoader(
|
||||
|
||||
is TopLevel -> {
|
||||
navHostController.navigate(destination) {
|
||||
popUpTo(navHostController.graph.findStartDestination().id)
|
||||
popUpTo(navHostController.graph.findStartDestination().id) {
|
||||
saveState = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
restoreState = true
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
navHostController.navigate(destination)
|
||||
navHostController.navigate(destination) {
|
||||
launchSingleTop = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user