From e0c2272fcb3099d3e9ac87eb02108ec7d57dc5e0 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:35:10 +0400 Subject: [PATCH] android, desktop: operators info on onboarding (#5341) --- .../views/onboarding/ChooseServerOperators.kt | 50 ++++++++++++++++--- .../networkAndServers/OperatorView.kt | 2 +- .../commonMain/resources/MR/base/strings.xml | 1 + 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/ChooseServerOperators.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/ChooseServerOperators.kt index 132381294f..e706a0d8e9 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/ChooseServerOperators.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/onboarding/ChooseServerOperators.kt @@ -1,7 +1,11 @@ package chat.simplex.common.views.onboarding import SectionBottomSpacer +import SectionDividerSpaced +import SectionItemView import SectionTextFooter +import SectionView +import TextIconSpaced import androidx.compose.foundation.* import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.* @@ -12,8 +16,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import chat.simplex.common.model.* import chat.simplex.common.model.ChatController.appPrefs -import chat.simplex.common.model.ServerOperator import chat.simplex.common.platform.* import chat.simplex.common.ui.theme.* import chat.simplex.common.views.helpers.* @@ -339,11 +343,45 @@ private fun enabledOperators(operators: List, selectedOperatorId @Composable private fun ChooseServerOperatorsInfoView() { - ColumnWithScrollBar(Modifier.padding(horizontal = DEFAULT_PADDING)) { - AppBarTitle(stringResource(MR.strings.onboarding_network_operators), withPadding = false) - ReadableText(stringResource(MR.strings.onboarding_network_operators_app_will_use_different_operators)) - ReadableText(stringResource(MR.strings.onboarding_network_operators_cant_see_who_talks_to_whom)) - ReadableText(stringResource(MR.strings.onboarding_network_operators_app_will_use_for_routing)) + ColumnWithScrollBar { + AppBarTitle(stringResource(MR.strings.onboarding_network_operators)) + + Column( + Modifier.padding(horizontal = DEFAULT_PADDING) + ) { + ReadableText(stringResource(MR.strings.onboarding_network_operators_app_will_use_different_operators)) + ReadableText(stringResource(MR.strings.onboarding_network_operators_cant_see_who_talks_to_whom)) + ReadableText(stringResource(MR.strings.onboarding_network_operators_app_will_use_for_routing)) + } + + SectionDividerSpaced() + + SectionView(title = stringResource(MR.strings.onboarding_network_about_operators).uppercase()) { + chatModel.conditions.value.serverOperators.forEach { op -> + ServerOperatorRow(op) + } + } SectionBottomSpacer() } } + +@Composable() +private fun ServerOperatorRow( + operator: ServerOperator +) { + SectionItemView( + { + ModalManager.start.showModalCloseable { close -> + OperatorInfoView(operator) + } + } + ) { + Image( + painterResource(operator.logo), + operator.tradeName, + modifier = Modifier.size(24.dp) + ) + TextIconSpaced() + Text(operator.tradeName) + } +} 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 3836d5b6df..28ca88584d 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 @@ -410,7 +410,7 @@ fun OperatorViewLayout( } @Composable -private fun OperatorInfoView(serverOperator: ServerOperator) { +fun OperatorInfoView(serverOperator: ServerOperator) { ColumnWithScrollBar { AppBarTitle(stringResource(MR.strings.operator_info_title)) 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 c412ec42ee..29df338079 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -1080,6 +1080,7 @@ The app protects your privacy by using different operators in each conversation. When more than one operator is enabled, none of them has metadata to learn who communicates with whom. For example, if your contact receives messages via a SimpleX Chat server, your app will deliver them via a Flux server. + About operators Select network operators to use. How it helps privacy You can configure servers via settings.