Fix behavior of back button when adding additional accounts

This commit is contained in:
cketti 2023-08-14 16:38:51 +02:00
parent 3702eaee02
commit 41435cb7f6
2 changed files with 6 additions and 1 deletions

View file

@ -16,6 +16,7 @@ import org.koin.compose.koinInject
fun FeatureLauncherNavHost(
navController: NavHostController,
startDestination: String?,
onBack: () -> Unit,
modifier: Modifier = Modifier,
importSettingsLauncher: ImportSettingsLauncher = koinInject(),
accountSetupFinishedLauncher: AccountSetupFinishedLauncher = koinInject(),
@ -30,7 +31,7 @@ fun FeatureLauncherNavHost(
onImport = { importSettingsLauncher.launch() },
)
accountSetupRoute(
onBack = navController::popBackStack,
onBack = onBack,
onFinish = { accountSetupFinishedLauncher.launch(it) },
)
}

View file

@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.rememberNavController
import app.k9mail.core.ui.compose.common.activity.LocalActivity
import app.k9mail.core.ui.compose.designsystem.atom.Background
import app.k9mail.core.ui.compose.theme.K9Theme
import app.k9mail.feature.launcher.navigation.FeatureLauncherNavHost
@ -23,9 +24,12 @@ fun FeatureLauncherApp(
.safeDrawingPadding()
.then(modifier),
) {
val activity = LocalActivity.current
FeatureLauncherNavHost(
navController = navController,
startDestination = startDestination,
onBack = { activity.finish() },
)
}
}