From a04e8a311041d0a9b94aef8260c9074acff934f8 Mon Sep 17 00:00:00 2001 From: Diogo Date: Wed, 20 Nov 2024 14:51:54 +0000 Subject: [PATCH] use for files --- .../networkAndServers/OperatorView.kt | 36 +++++++++++++++++++ .../commonMain/resources/MR/base/strings.xml | 2 ++ 2 files changed, 38 insertions(+) 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 dfcc58eb35..1964d8b856 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 @@ -207,6 +207,42 @@ fun OperatorViewLayout( } } } + + if (userServers.value[operatorIndex].xftpServers.any { !it.deleted }) { + SectionDividerSpaced() + SectionView(generalGetString(MR.strings.operator_use_for_sending).uppercase()) { + SectionItemView(padding = PaddingValues(horizontal = DEFAULT_PADDING)) { + Text( + stringResource(MR.strings.operator_use_for_files), + Modifier.padding(end = 24.dp), + color = Color.Unspecified + ) + Spacer(Modifier.fillMaxWidth().weight(1f)) + DefaultSwitch( + checked = userServers.value[operatorIndex].operator_.xftpRoles.storage, + onCheckedChange = { enabled -> + userServers.value = userServers.value.toMutableList().apply { + this[operatorIndex] = this[operatorIndex].copy( + operator = this[operatorIndex].operator?.copy( + xftpRoles = this[operatorIndex].operator?.xftpRoles?.copy(storage = enabled) ?: ServerRoles(storage = enabled, proxy = false) + ) + ) + } + scope.launch { + validateServers(rhId, userServers, serverErrors) + } + } + ) + } + } + val xftpErrors = globalXFTPServersError(serverErrors.value) + if (xftpErrors != null) { + SectionCustomFooter { + ServerErrorsView(xftpErrors) + } + } + } + } } } diff --git a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml index 70b87e0f22..43325e69e3 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -1704,6 +1704,8 @@ For receiving For private routing Added message servers + Use for files + For sending TCP connection