From 716a1f8393f7c44880cd941ea4ea832a5922d185 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:31:24 +0400 Subject: [PATCH] fix validation --- .../usersettings/networkAndServers/NetworkAndServers.kt | 3 +-- .../views/usersettings/networkAndServers/NewServerView.kt | 7 ------- .../views/usersettings/networkAndServers/OperatorView.kt | 3 +-- .../usersettings/networkAndServers/ProtocolServersView.kt | 7 +++++++ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt index 73ee789e7b..cf3288be44 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NetworkAndServers.kt @@ -39,7 +39,6 @@ import chat.simplex.common.views.onboarding.ReadableText import chat.simplex.common.views.usersettings.* import chat.simplex.res.MR import kotlinx.coroutines.launch -import java.time.Clock @Composable fun ModalData.NetworkAndServersView(close: () -> Unit) { @@ -816,7 +815,7 @@ fun updateOperatorsConditionsAcceptance(usvs: MutableState, serverErrors: MutableState> diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NewServerView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NewServerView.kt index a2ff6fdf2a..1ec2534ab1 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NewServerView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/NewServerView.kt @@ -22,13 +22,6 @@ fun ModalData.NewServerView( val scope = rememberCoroutineScope() val newServer = remember { mutableStateOf(UserServer.empty) } - LaunchedEffect(userServers) { - snapshotFlow { userServers.value } - .collect { updatedServers -> - validateServers(rhId = rhId, userServersToValidate = updatedServers, serverErrors = serverErrors) - } - } - ModalView(close = { addServer( scope, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/OperatorView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/OperatorView.kt index 34c3ca194d..56c4ddc91f 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/OperatorView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/OperatorView.kt @@ -6,7 +6,6 @@ import SectionDividerSpaced import SectionItemView import SectionTextFooter import SectionView -import TextIconSpaced import androidx.compose.foundation.* import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape @@ -48,7 +47,7 @@ fun ModalData.OperatorView( LaunchedEffect(userServers) { snapshotFlow { userServers.value } .collect { updatedServers -> - validateServers(rhId = rhId, userServersToValidate = updatedServers, serverErrors = serverErrors) + validateServers_(rhId = rhId, userServersToValidate = updatedServers, serverErrors = serverErrors) } } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/ProtocolServersView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/ProtocolServersView.kt index c0659b80aa..63bf8b1dc4 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/ProtocolServersView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/networkAndServers/ProtocolServersView.kt @@ -37,6 +37,13 @@ fun ModalData.YourServersView( val currentUser = remember { chatModel.currentUser }.value val scope = rememberCoroutineScope() + LaunchedEffect(userServers) { + snapshotFlow { userServers.value } + .collect { updatedServers -> + validateServers_(rhId = rhId, userServersToValidate = updatedServers, serverErrors = serverErrors) + } + } + Box { ColumnWithScrollBar { AppBarTitle(stringResource(MR.strings.your_servers))