Don't show login screen when already logged in

This commit is contained in:
Lonami Exo 2022-10-20 20:35:07 +02:00
parent cd37c5aa14
commit a341466749
1 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import dev.lonami.talaria.bindings.Native
import dev.lonami.talaria.ui.ChatScreen
import dev.lonami.talaria.ui.DialogScreen
import dev.lonami.talaria.ui.LoginScreen
@ -46,6 +47,7 @@ fun TalariaApp() {
val currentScreen =
TalariaScreen.valueOf(backStackEntry?.destination?.route ?: TalariaScreen.Login.name)
val loggedIn by remember { mutableStateOf(!Native.needLogin()) }
var selectedDialog by remember { mutableStateOf("") }
Scaffold(
@ -59,7 +61,11 @@ fun TalariaApp() {
) { innerPadding ->
NavHost(
navController = navController,
startDestination = TalariaScreen.Login.name,
startDestination = if (loggedIn) {
TalariaScreen.Login.name
} else {
TalariaScreen.Dialog.name
},
Modifier.padding(innerPadding)
) {
composable(route = TalariaScreen.Dialog.name) {