Don't show login screen when already logged in
This commit is contained in:
parent
cd37c5aa14
commit
a341466749
|
@ -12,6 +12,7 @@ import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
|
import dev.lonami.talaria.bindings.Native
|
||||||
import dev.lonami.talaria.ui.ChatScreen
|
import dev.lonami.talaria.ui.ChatScreen
|
||||||
import dev.lonami.talaria.ui.DialogScreen
|
import dev.lonami.talaria.ui.DialogScreen
|
||||||
import dev.lonami.talaria.ui.LoginScreen
|
import dev.lonami.talaria.ui.LoginScreen
|
||||||
|
@ -46,6 +47,7 @@ fun TalariaApp() {
|
||||||
val currentScreen =
|
val currentScreen =
|
||||||
TalariaScreen.valueOf(backStackEntry?.destination?.route ?: TalariaScreen.Login.name)
|
TalariaScreen.valueOf(backStackEntry?.destination?.route ?: TalariaScreen.Login.name)
|
||||||
|
|
||||||
|
val loggedIn by remember { mutableStateOf(!Native.needLogin()) }
|
||||||
var selectedDialog by remember { mutableStateOf("") }
|
var selectedDialog by remember { mutableStateOf("") }
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
|
@ -59,7 +61,11 @@ fun TalariaApp() {
|
||||||
) { innerPadding ->
|
) { innerPadding ->
|
||||||
NavHost(
|
NavHost(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
startDestination = TalariaScreen.Login.name,
|
startDestination = if (loggedIn) {
|
||||||
|
TalariaScreen.Login.name
|
||||||
|
} else {
|
||||||
|
TalariaScreen.Dialog.name
|
||||||
|
},
|
||||||
Modifier.padding(innerPadding)
|
Modifier.padding(innerPadding)
|
||||||
) {
|
) {
|
||||||
composable(route = TalariaScreen.Dialog.name) {
|
composable(route = TalariaScreen.Dialog.name) {
|
||||||
|
|
Loading…
Reference in New Issue