mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
open conditions
This commit is contained in:
+2
-1
@@ -38,6 +38,7 @@ import chat.simplex.common.views.newchat.*
|
||||
import chat.simplex.common.views.onboarding.*
|
||||
import chat.simplex.common.views.showInvalidNameAlert
|
||||
import chat.simplex.common.views.usersettings.*
|
||||
import chat.simplex.common.views.usersettings.networkAndServers.ConditionsLinkButton
|
||||
import chat.simplex.common.views.usersettings.networkAndServers.UsageConditionsView
|
||||
import chat.simplex.res.MR
|
||||
import kotlinx.coroutines.*
|
||||
@@ -125,7 +126,7 @@ fun ChatListView(chatModel: ChatModel, userPickerState: MutableStateFlow<Animate
|
||||
delay(1000L)
|
||||
ModalManager.center.showCustomModal { close -> WhatsNewView(close = close, showWhatsNew = remember { mutableStateOf(true) }, updatedConditions = showUpdatedConditions) }
|
||||
} else if (showUpdatedConditions) {
|
||||
ModalManager.center.showModalCloseable { close ->
|
||||
ModalManager.center.showModalCloseable(endButtons = { ConditionsLinkButton() }) { close ->
|
||||
LaunchedEffect(Unit) {
|
||||
val conditionsId = chatModel.conditions.value.currentConditions.conditionsId
|
||||
try {
|
||||
|
||||
+4
-4
@@ -17,11 +17,11 @@ import chat.simplex.common.model.ServerOperator
|
||||
import chat.simplex.common.platform.*
|
||||
import chat.simplex.common.ui.theme.*
|
||||
import chat.simplex.common.views.helpers.*
|
||||
import chat.simplex.common.views.usersettings.networkAndServers.ConditionsTextView
|
||||
import chat.simplex.common.views.usersettings.networkAndServers.UsageConditionsView
|
||||
import chat.simplex.common.views.usersettings.networkAndServers.*
|
||||
import chat.simplex.res.MR
|
||||
import dev.icerock.moko.resources.compose.painterResource
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import java.net.URI
|
||||
|
||||
@Composable
|
||||
fun ModalData.ChooseServerOperators(onboarding: Boolean) {
|
||||
@@ -85,7 +85,7 @@ fun ModalData.ChooseServerOperators(onboarding: Boolean) {
|
||||
}
|
||||
if (onboarding && reviewForOperators.isEmpty()) {
|
||||
TextButtonBelowOnboardingButton(stringResource(MR.strings.operator_conditions_of_use)) {
|
||||
ModalManager.fullscreen.showModalCloseable { close ->
|
||||
ModalManager.fullscreen.showModalCloseable(endButtons = { ConditionsLinkButton() }) { close ->
|
||||
UsageConditionsView(
|
||||
currUserServers = remember { mutableStateOf(emptyList()) },
|
||||
userServers = remember { mutableStateOf(emptyList()) },
|
||||
@@ -174,7 +174,7 @@ private fun ReviewConditionsButton(
|
||||
onboarding = null,
|
||||
enabled = enabled,
|
||||
onclick = {
|
||||
ModalManager.fullscreen.showModalCloseable { close ->
|
||||
ModalManager.fullscreen.showModalCloseable(endButtons = { ConditionsLinkButton() }) { close ->
|
||||
ReviewConditionsView(onboarding, selectedOperators, selectedOperatorIds, close)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ fun ModalData.NetworkAndServersView(close: () -> Unit) {
|
||||
@Composable
|
||||
fun ConditionsButton(conditionsAction: UsageConditionsAction, rhId: Long?) {
|
||||
SectionItemView(
|
||||
click = { ModalManager.start.showModalCloseable { close -> UsageConditionsView(currUserServers, userServers, close, rhId) } },
|
||||
click = { ModalManager.start.showModalCloseable(endButtons = { ConditionsLinkButton() }) { close -> UsageConditionsView(currUserServers, userServers, close, rhId) } },
|
||||
) {
|
||||
Text(
|
||||
stringResource(if (conditionsAction is UsageConditionsAction.Review) MR.strings.operator_review_conditions else MR.strings.operator_conditions_accepted),
|
||||
|
||||
+32
-4
@@ -18,19 +18,22 @@ import androidx.compose.ui.graphics.*
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.text.*
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.DpOffset
|
||||
import androidx.compose.ui.unit.dp
|
||||
import chat.simplex.common.model.*
|
||||
import chat.simplex.common.model.ChatController.appPrefs
|
||||
import chat.simplex.common.model.ChatController.getUsageConditions
|
||||
import chat.simplex.common.platform.*
|
||||
import chat.simplex.common.ui.theme.*
|
||||
import chat.simplex.common.views.chat.item.ItemAction
|
||||
import chat.simplex.common.views.helpers.*
|
||||
import chat.simplex.common.views.onboarding.OnboardingActionButton
|
||||
import chat.simplex.common.views.onboarding.ReadableText
|
||||
import chat.simplex.common.views.onboarding.*
|
||||
import chat.simplex.res.MR
|
||||
import dev.icerock.moko.resources.compose.painterResource
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import java.net.URI
|
||||
|
||||
@Composable
|
||||
fun ModalData.OperatorView(
|
||||
@@ -452,7 +455,7 @@ private fun UseOperatorToggle(
|
||||
|
||||
is ConditionsAcceptance.Required -> {
|
||||
if (conditionsAcceptance.deadline == null) {
|
||||
ModalManager.start.showModalCloseable { close ->
|
||||
ModalManager.start.showModalCloseable(endButtons = { ConditionsLinkButton() }) { close ->
|
||||
SingleOperatorUsageConditionsView(
|
||||
currUserServers = currUserServers,
|
||||
userServers = userServers,
|
||||
@@ -542,7 +545,7 @@ private fun SingleOperatorUsageConditionsView(
|
||||
stringResource(MR.strings.view_conditions),
|
||||
color = MaterialTheme.colors.primary,
|
||||
modifier = Modifier.padding(top = DEFAULT_PADDING_HALF).clickable {
|
||||
ModalManager.start.showModalCloseable { close ->
|
||||
ModalManager.start.showModalCloseable(endButtons = { ConditionsLinkButton() }) { close ->
|
||||
UsageConditionsDestinationView(close)
|
||||
}
|
||||
}
|
||||
@@ -664,6 +667,31 @@ private fun ConditionsAppliedToOtherOperatorsText(userServers: List<UserOperator
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ConditionsLinkButton() {
|
||||
val showMenu = remember { mutableStateOf(false) }
|
||||
val uriHandler = LocalUriHandler.current
|
||||
val oneHandUI = remember { appPrefs.oneHandUI.state }
|
||||
Column {
|
||||
DefaultDropdownMenu(showMenu, offset = if (oneHandUI.value) DpOffset(0.dp, -AppBarHeight * fontSizeSqrtMultiplier * 3) else DpOffset.Zero) {
|
||||
val commit = chatModel.conditions.value.currentConditions.conditionsCommit
|
||||
ItemAction(stringResource(MR.strings.operator_open_conditions), painterResource(MR.images.ic_draft), onClick = {
|
||||
val mdUrl = "https://github.com/simplex-chat/simplex-chat/blob/$commit/PRIVACY.md"
|
||||
uriHandler.openUriCatching(mdUrl)
|
||||
showMenu.value = false
|
||||
})
|
||||
ItemAction(stringResource(MR.strings.operator_open_changes), painterResource(MR.images.ic_more_horiz), onClick = {
|
||||
val commitUrl = "https://github.com/simplex-chat/simplex-chat/commit/$commit"
|
||||
uriHandler.openUriCatching(commitUrl)
|
||||
showMenu.value = false
|
||||
})
|
||||
}
|
||||
IconButton({ showMenu.value = true }) {
|
||||
Icon(painterResource(MR.images.ic_outbound), null, tint = MaterialTheme.colors.primary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeOperatorEnabled(userServers: MutableState<List<UserOperatorServers>>, operatorIndex: Int, enabled: Boolean) {
|
||||
userServers.value = userServers.value.toMutableList().apply {
|
||||
this[operatorIndex] = this[operatorIndex].copy(
|
||||
|
||||
@@ -1709,7 +1709,7 @@
|
||||
<string name="operator_conditions_will_be_accepted_on">Conditions will be accepted on: %s.</string>
|
||||
<string name="operator">Operator</string>
|
||||
<string name="operator_use_operator_toggle_description">Use servers</string>
|
||||
<string name="use_servers_of_operator_x">Use servers of %s</string>
|
||||
<string name="use_servers_of_operator_x">Use %s</string>
|
||||
<string name="operator_conditions_failed_to_load">Current conditions text couldn\'t be loaded, you can review conditions via this link:</string>
|
||||
<string name="operator_conditions_accepted_for_some"><![CDATA[Conditions are already accepted for following operator(s): <b>%s</b>.]]></string>
|
||||
<string name="operator_same_conditions_will_be_applied"><![CDATA[Same conditions will apply to operator <b>%s</b>.]]></string>
|
||||
@@ -1731,6 +1731,8 @@
|
||||
<string name="operator_use_for_sending">To send</string>
|
||||
<string name="xftp_servers_per_user">The servers for new files of your current chat profile</string>
|
||||
<string name="operator_added_xftp_servers">Added media & file servers</string>
|
||||
<string name="operator_open_conditions">Open conditions</string>
|
||||
<string name="operator_open_changes">Open changes</string>
|
||||
|
||||
<!-- ProtocolServerView.kt -->
|
||||
<string name="error_updating_server_title">Error updating server</string>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="m346-306 235.5-235v125.5H639V-639H415.5v57.5H540L306-347l40 41ZM480.06-85q-80.97 0-153.13-31.26-72.15-31.27-125.79-85Q147.5-255 116.25-327.02 85-399.05 85-479.94q0-81.97 31.26-154.13 31.27-72.15 85-125.54Q255-813 327.02-844q72.03-31 152.92-31 81.97 0 154.13 31.13 72.17 31.13 125.55 84.5Q813-706 844-633.98q31 72.03 31 153.92 0 80.97-31.01 153.13-31.02 72.15-84.5 125.79Q706-147.5 633.98-116.25 561.95-85 480.06-85Zm-.09-57.5q140.53 0 239.03-98.97 98.5-98.96 98.5-238.5 0-140.53-98.47-239.03-98.46-98.5-239-98.5-139.53 0-238.53 98.47-99 98.46-99 239 0 139.53 98.97 238.53 98.96 99 238.5 99ZM480-480Z"/></svg>
|
||||
|
After Width: | Height: | Size: 724 B |
Reference in New Issue
Block a user