From 7f92f5012585f05454e30a7304bf07ce7808c018 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:57:58 +0400 Subject: [PATCH] scan --- .../networkAndServers/NetworkAndServers.kt | 1 - .../networkAndServers/ProtocolServersView.kt | 22 ++++++++++++------- 2 files changed, 14 insertions(+), 9 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 e12d1a6888..05e57032da 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 @@ -192,7 +192,6 @@ fun ModalData.NetworkAndServersView(close: () -> Unit) { SectionItemView({ ModalManager.start.showModal { YourServersView( - currUserServers = currUserServers, userServers = userServers, serverErrors = serverErrors, operatorIndex = nullOperatorIndex, 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 552e2e358b..4f6e32a722 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 @@ -23,11 +23,11 @@ import chat.simplex.common.model.* import chat.simplex.common.platform.* import chat.simplex.common.views.usersettings.SettingsActionItem import chat.simplex.res.MR +import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch @Composable fun ModalData.YourServersView( - currUserServers: MutableState>, userServers: MutableState>, serverErrors: MutableState>, operatorIndex: Int, @@ -41,7 +41,7 @@ fun ModalData.YourServersView( ColumnWithScrollBar { AppBarTitle(stringResource(MR.strings.your_servers)) YourServersViewLayout( - currUserServers, + scope, userServers, serverErrors, operatorIndex, @@ -62,7 +62,7 @@ fun ModalData.YourServersView( @Composable fun YourServersViewLayout( - currUserServers: MutableState>, + scope: CoroutineScope, userServers: MutableState>, serverErrors: MutableState>, operatorIndex: Int, @@ -152,7 +152,7 @@ fun YourServersViewLayout( SettingsActionItem( painterResource(MR.images.ic_add), stringResource(MR.strings.smp_servers_add), - click = { showAddServerDialog(userServers, serverErrors, operatorIndex, rhId) }, + click = { showAddServerDialog(scope, userServers, serverErrors, rhId) }, disabled = testing.value, textColor = if (testing.value) MaterialTheme.colors.secondary else MaterialTheme.colors.primary, iconColor = if (testing.value) MaterialTheme.colors.secondary else MaterialTheme.colors.primary @@ -216,9 +216,9 @@ fun TestServersButton( } fun showAddServerDialog( + scope: CoroutineScope, userServers: MutableState>, serverErrors: MutableState>, - operatorIndex: Int, rhId: Long? ) { AlertManager.shared.showAlertDialogButtonsColumn( @@ -237,9 +237,15 @@ fun showAddServerDialog( SectionItemView({ AlertManager.shared.hideAlert() ModalManager.start.showModalCloseable { close -> - ScanProtocolServer(rhId) { - close() - // TODO reuse logic from NewServerView + ScanProtocolServer(rhId) { server -> + addServer( + scope, + server, + userServers, + serverErrors, + rhId, + close = close + ) } } }