mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 03:18:23 +00:00
fix nav routing
This commit is contained in:
@@ -499,7 +499,7 @@ fun MainScreen(
|
||||
var showDialog by remember { mutableStateOf(false) }
|
||||
|
||||
if (BuildConfig.FLAVOR != "offline") {
|
||||
LaunchedEffect(Unit, route.value) {
|
||||
LaunchedEffect(Unit) {
|
||||
launch(Dispatchers.IO) {
|
||||
askNotificationPermission(
|
||||
context,
|
||||
@@ -508,12 +508,6 @@ fun MainScreen(
|
||||
showDialog = true
|
||||
}
|
||||
}
|
||||
launch(Dispatchers.Main) {
|
||||
if (route.value != null) {
|
||||
navController.navigate(route.value!!)
|
||||
route.value = null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,9 +654,22 @@ fun MainScreen(
|
||||
}
|
||||
}
|
||||
) { padding ->
|
||||
var localRoute by remember { mutableStateOf(route.value ?: Route.Home.route) }
|
||||
|
||||
if (BuildConfig.FLAVOR != "offline") {
|
||||
LaunchedEffect(Unit, route.value) {
|
||||
launch(Dispatchers.Main) {
|
||||
if (route.value != null) {
|
||||
localRoute = route.value!!
|
||||
route.value = null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NavHost(
|
||||
navController,
|
||||
startDestination = route.value ?: Route.Home.route,
|
||||
startDestination = localRoute,
|
||||
enterTransition = { fadeIn(animationSpec = tween(200)) },
|
||||
exitTransition = { fadeOut(animationSpec = tween(200)) }
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user