diff --git a/driver-app/app/src/main/java/de/motis/prima/Home.kt b/driver-app/app/src/main/java/de/motis/prima/Home.kt index adb79b4..bed66d2 100644 --- a/driver-app/app/src/main/java/de/motis/prima/Home.kt +++ b/driver-app/app/src/main/java/de/motis/prima/Home.kt @@ -60,9 +60,6 @@ fun Home( viewModel.logoutEvent.collect { Log.d("Logout", "Logout event triggered.") navController.navigate("login") { - popUpTo(navController.graph.startDestinationId) { - inclusive = true - } launchSingleTop = true } } diff --git a/driver-app/app/src/main/java/de/motis/prima/Login.kt b/driver-app/app/src/main/java/de/motis/prima/Login.kt index c58ecd6..315ca3d 100644 --- a/driver-app/app/src/main/java/de/motis/prima/Login.kt +++ b/driver-app/app/src/main/java/de/motis/prima/Login.kt @@ -1,6 +1,8 @@ package de.motis.prima +import android.app.Activity import android.util.Log +import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column @@ -25,6 +27,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.KeyboardType @@ -81,6 +84,11 @@ fun Login( val networkErrorMessage = stringResource(id = R.string.network_error_message) + val activity = (LocalContext.current as? Activity) + BackHandler { + activity?.finish() + } + LaunchedEffect(key1 = viewModel) { // Catching successful login event and navigation to the next screen launch { diff --git a/driver-app/app/src/main/java/de/motis/prima/Tours.kt b/driver-app/app/src/main/java/de/motis/prima/Tours.kt index 120eb00..dfc9353 100644 --- a/driver-app/app/src/main/java/de/motis/prima/Tours.kt +++ b/driver-app/app/src/main/java/de/motis/prima/Tours.kt @@ -60,9 +60,6 @@ fun Tours( viewModel.logoutEvent.collect { Log.d("Logout", "Logout event triggered.") navController.navigate("login") { - popUpTo(navController.graph.startDestinationId) { - inclusive = true - } launchSingleTop = true } } diff --git a/driver-app/app/src/main/java/de/motis/prima/Vehicles.kt b/driver-app/app/src/main/java/de/motis/prima/Vehicles.kt index 90d6ee6..67b939b 100644 --- a/driver-app/app/src/main/java/de/motis/prima/Vehicles.kt +++ b/driver-app/app/src/main/java/de/motis/prima/Vehicles.kt @@ -60,9 +60,6 @@ fun Vehicles( viewModel.logoutEvent.collect { Log.d("Logout", "Logout event triggered.") navController.navigate("login") { - popUpTo(navController.graph.startDestinationId) { - inclusive = true - } launchSingleTop = true } }