fix: stop polluting backstack with unlive channels

This commit is contained in:
Infi 2023-03-05 04:11:20 +01:00
parent 61bfda37f2
commit 8c6fa7ac1c
2 changed files with 11 additions and 7 deletions

View File

@ -67,7 +67,11 @@ fun RowScope.ChannelList(
)
} ?: false,
onClick = {
navController.navigate("channel/${channel.id}")
navController.navigate("channel/${channel.id}") {
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route)
}
}
coroutineScope.launch { drawerState.focusCenter() }
},
onLongClick = {
@ -109,8 +113,8 @@ fun RowScope.ChannelList(
onClick = {
coroutineScope.launch { drawerState.focusCenter() }
navController.navigate("channel/${ch.id}") {
popUpTo("home") {
inclusive = true
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route)
}
}
},

View File

@ -64,8 +64,8 @@ class ChatRouterViewModel : ViewModel() {
if (serverId == "home") {
navController.navigate("home") {
popUpTo("home") {
inclusive = true
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route)
}
}
return
@ -73,8 +73,8 @@ class ChatRouterViewModel : ViewModel() {
val channelId = RevoltAPI.serverCache[serverId]?.channels?.firstOrNull()
navController.navigate("channel/$channelId") {
popUpTo("home") {
inclusive = true
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route)
}
}
}