* refactor(#103): centralize navigation mutations through NavigationController.resetTo() * fix(chat): fix scroll-to-bottom FAB compilation errors
This commit is contained in:
@@ -326,8 +326,7 @@ fun MainNavigation(sessionId: String? = null) {
|
|||||||
entry<ConnectScreen> {
|
entry<ConnectScreen> {
|
||||||
ConnectScreenContent(
|
ConnectScreenContent(
|
||||||
onConnected = {
|
onConnected = {
|
||||||
backStack.clear()
|
NavigationController.resetTo(ChatScreen)
|
||||||
backStack.add(ChatScreen)
|
|
||||||
},
|
},
|
||||||
modifier = Modifier.safeDrawingPadding(),
|
modifier = Modifier.safeDrawingPadding(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -49,8 +49,11 @@ object NavigationController {
|
|||||||
stack.add(key)
|
stack.add(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(key: NavKey) {
|
/** Clear the stack and navigate to the given screen atomically. */
|
||||||
backStack?.add(key)
|
fun resetTo(screen: NavKey) {
|
||||||
|
val stack = backStack ?: return
|
||||||
|
stack.clear()
|
||||||
|
stack.add(screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user