Othman El Jazouli
11/28/2023, 4:30 PMIntroScreen
can be the startDestination - which would later navigate to DashboardScreen
and have a popUpTo to exclude it when closing
case2: DashboardScreen
is the startDestination - which can just open IntroScreen
like any other
as you see below, I want to either pop the stack if Dashboard already exists, or navigate to it and set popUpTo
val launchApp: () -> Unit = {
val found = try {
navController.getBackStackEntry(Dashboard.route)
true
} catch (_: Exception) {
false
}
if (found) {
navController.popBackStack(route = Dashboard.route, inclusive = false)
} else {
navController.navigate(Dashboard.route) {
popUpTo(Intro.route) {
inclusive = true
}
}
}
}
thoughts please, I feel like this is a hackandriyo
11/28/2023, 7:40 PMIan Lake
11/29/2023, 1:41 AMIan Lake
11/29/2023, 1:42 AMIan Lake
11/29/2023, 1:43 AMIan Lake
11/29/2023, 1:46 AMIan Lake
11/29/2023, 1:48 AMandriyo
11/29/2023, 5:39 AMIan Lake
11/29/2023, 5:41 AMandriyo
11/29/2023, 5:44 AMOthman El Jazouli
11/29/2023, 12:47 PM