ui: operator information (#5343)

* ios: operator information

* android, desktop: operator information

* move texts, simplify navigation
This commit is contained in:
Evgeny
2024-12-07 14:41:54 +00:00
committed by GitHub
parent cbb3da8f83
commit fe0d811bf7
43 changed files with 254 additions and 273 deletions
@@ -3669,14 +3669,13 @@ enum class ServerProtocol {
@Serializable
enum class OperatorTag {
@SerialName("simplex") SimpleX,
@SerialName("flux") Flux,
@SerialName("xyz") XYZ,
@SerialName("demo") Demo
@SerialName("flux") Flux
}
data class ServerOperatorInfo(
val description: List<String>,
val website: String,
val selfhost: Pair<String, String>? = null,
val logo: ImageResource,
val largeLogo: ImageResource,
val logoDarkMode: ImageResource,
@@ -3696,31 +3695,17 @@ val operatorsInfo: Map<OperatorTag, ServerOperatorInfo> = mapOf(
),
OperatorTag.Flux to ServerOperatorInfo(
description = listOf(
"Flux is the largest decentralized cloud infrastructure, leveraging a global network of user-operated computational nodes.",
"Flux offers a powerful, scalable, and affordable platform designed to support individuals, businesses, and cutting-edge technologies like AI. With high uptime and worldwide distribution, Flux ensures reliable, accessible cloud computing for all."
"Flux is the largest decentralized cloud, based on a global network of user-operated nodes.",
"Flux offers a powerful, scalable, and affordable cutting edge technology platform for all.",
"Flux operates servers in SimpleX network to improve its privacy and decentralization."
),
website = "https://runonflux.com",
selfhost = "Self-host SimpleX servers on Flux" to "https://home.runonflux.io/apps/marketplace?q=simplex",
logo = MR.images.flux_logo_symbol,
largeLogo = MR.images.flux_logo,
logoDarkMode = MR.images.flux_logo_symbol,
largeLogoDarkMode = MR.images.flux_logo_light
),
OperatorTag.XYZ to ServerOperatorInfo(
description = listOf("XYZ servers"),
website = "XYZ website",
logo = MR.images.shield,
largeLogo = MR.images.logo,
logoDarkMode = MR.images.shield,
largeLogoDarkMode = MR.images.logo_light
),
OperatorTag.Demo to ServerOperatorInfo(
description = listOf("Demo operator"),
website = "Demo website",
logo = MR.images.decentralized,
largeLogo = MR.images.logo,
logoDarkMode = MR.images.decentralized_light,
largeLogoDarkMode = MR.images.logo_light
)
)
@Serializable
@@ -3800,7 +3785,7 @@ data class ServerOperator(
companion object {
val dummyOperatorInfo = ServerOperatorInfo(
description = listOf("Default"),
website = "Default",
website = "https://simplex.chat",
logo = MR.images.decentralized,
largeLogo = MR.images.logo,
logoDarkMode = MR.images.decentralized_light,
@@ -3818,30 +3803,6 @@ data class ServerOperator(
smpRoles = ServerRoles(storage = true, proxy = true),
xftpRoles = ServerRoles(storage = true, proxy = true)
)
val sampleData2 = ServerOperator(
operatorId = 2,
operatorTag = OperatorTag.XYZ,
tradeName = "XYZ",
legalName = null,
serverDomains = listOf("xyz.com"),
conditionsAcceptance = ConditionsAcceptance.Required(deadline = null),
enabled = false,
smpRoles = ServerRoles(storage = false, proxy = true),
xftpRoles = ServerRoles(storage = false, proxy = true)
)
val sampleData3 = ServerOperator(
operatorId = 3,
operatorTag = OperatorTag.Demo,
tradeName = "Demo",
legalName = null,
serverDomains = listOf("demo.com"),
conditionsAcceptance = ConditionsAcceptance.Required(deadline = null),
enabled = false,
smpRoles = ServerRoles(storage = true, proxy = false),
xftpRoles = ServerRoles(storage = true, proxy = false)
)
}
val id: Long
@@ -14,8 +14,10 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import chat.simplex.common.model.*
import chat.simplex.common.model.ChatController.appPrefs
import chat.simplex.common.platform.*
@@ -72,6 +74,7 @@ fun ModalData.ChooseServerOperators(
}
Spacer(Modifier.height(DEFAULT_PADDING_HALF))
SectionTextFooter(annotatedStringResource(MR.strings.onboarding_network_operators_simplex_flux_agreement), textAlign = TextAlign.Center)
SectionTextFooter(annotatedStringResource(MR.strings.onboarding_network_operators_configure_via_settings), textAlign = TextAlign.Center)
}
Spacer(Modifier.weight(1f))
@@ -427,23 +427,27 @@ fun OperatorInfoView(serverOperator: ServerOperator) {
SectionDividerSpaced(maxBottomPadding = false)
val uriHandler = LocalUriHandler.current
SectionView {
SectionItemView {
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
serverOperator.info.description.forEach { d ->
Text(d)
}
val website = serverOperator.info.website
Text(website, color = MaterialTheme.colors.primary, modifier = Modifier.clickable { uriHandler.openUriCatching(website) })
}
}
}
SectionDividerSpaced()
SectionView(generalGetString(MR.strings.operator_website).uppercase()) {
SectionItemView {
val website = serverOperator.info.website
val uriHandler = LocalUriHandler.current
Text(website, color = MaterialTheme.colors.primary, modifier = Modifier.clickable { uriHandler.openUriCatching(website) })
val selfhost = serverOperator.info.selfhost
if (selfhost != null) {
SectionDividerSpaced(maxBottomPadding = false)
SectionView {
SectionItemView {
val (text, link) = selfhost
Text(text, color = MaterialTheme.colors.primary, modifier = Modifier.clickable { uriHandler.openUriCatching(link) })
}
}
}
}
@@ -1077,6 +1077,7 @@
<!-- ChooseServerOperators.kt -->
<string name="onboarding_choose_server_operators">Server operators</string>
<string name="onboarding_network_operators">Network operators</string>
<string name="onboarding_network_operators_simplex_flux_agreement">SimpleX Chat and Flux made an agreement to include Flux-operated servers into the app.</string>
<string name="onboarding_network_operators_app_will_use_different_operators">The app protects your privacy by using different operators in each conversation.</string>
<string name="onboarding_network_operators_cant_see_who_talks_to_whom">When more than one operator is enabled, none of them has metadata to learn who communicates with whom.</string>
<string name="onboarding_network_operators_app_will_use_for_routing">For example, if your contact receives messages via a SimpleX Chat server, your app will deliver them via a Flux server.</string>
@@ -2320,6 +2320,7 @@
<string name="one_time_link_can_be_used_with_one_contact_only"><![CDATA[Одноразовая ссылка может быть использована <i>только с одним контактом</i> - поделитесь при встрече или через любой мессенджер.]]></string>
<string name="no_message_servers_configured_for_private_routing">Нет серверов для доставки сообщений.</string>
<string name="onboarding_network_operators_configure_via_settings">Вы можете настроить серверы позже.</string>
<string name="onboarding_network_operators_simplex_flux_agreement">SimpleX Chat и Flux заключили соглашение добавить серверы под управлением Flux в приложение.</string>
<string name="onboarding_network_operators_app_will_use_different_operators">Приложение улучшает конфиденциальность используя разных операторов в каждом разговоре.</string>
<string name="onboarding_network_operators_cant_see_who_talks_to_whom">Когда больше чем один оператор включен, ни один из них не видит метаданные, чтобы определить, кто соединен с кем.</string>
<string name="failed_to_save_servers">Ошибка сохранения серверов</string>