From 664b7a42ceedcc7b8126e788906221cb8d17a796 Mon Sep 17 00:00:00 2001 From: Syer10 Date: Wed, 5 Jul 2023 21:26:50 -0400 Subject: [PATCH] Fix basic auth settings not saving when not hosting the server on desktop --- .../settings/DesktopSettingsServerScreen.kt | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt index 8715cf88..ff8ec4d7 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt @@ -124,15 +124,17 @@ actual class SettingsServerHostViewModel val authPassword = serverPreferences.authPassword().asStateIn(scope) init { - combine(basicAuthEnabled, basicAuthUsername, basicAuthPassword) { enabled, username, password -> - if (enabled) { - auth.value = Auth.BASIC - authUsername.value = username - authPassword.value = password - } else { - auth.value = Auth.NONE - authUsername.value = "" - authPassword.value = "" + combine(host, basicAuthEnabled, basicAuthUsername, basicAuthPassword) { host, enabled, username, password -> + if (host) { + if (enabled) { + auth.value = Auth.BASIC + authUsername.value = username + authPassword.value = password + } else { + auth.value = Auth.NONE + authUsername.value = "" + authPassword.value = "" + } } }.launchIn(scope) }