ios, android, desktop: show the badge privacy policy in the app

This commit is contained in:
spaced4ndy committed 2026-10-19 18:13:09 +04:00
1 parent e2119cef14
commit 9e62d09941
2 files changed
+26 -5

No files matched your search

@@ -17,6 +17,7 @@ struct BadgesCheckOrderView: View {
let level: BadgeLevel
let period: BadgePeriod
@State private var purchasing = false
@State private var privacyPolicyActive = false
// presented from this view, not AlertManager: its host is behind the sheet these views open in
@State private var alert: SomeAlert?
@@ -65,7 +66,19 @@ struct BadgesCheckOrderView: View {
BadgeBillingFooter(period: period)
HStack(spacing: 20) {
Link("Terms of use", destination: appleStandardEULAURL)
Link("Privacy policy", destination: conditionsURL)
ZStack {
Button("Privacy policy") { privacyPolicyActive = true }
NavigationLink(isActive: $privacyPolicyActive) {
ConditionsTextView()
.padding(.horizontal, 25)
.navigationTitle("Privacy policy")
.modifier(ThemedBackground())
} label: {
EmptyView()
}
.frame(width: 1, height: 1)
.hidden()
}
}
.font(.footnote)
}
@@ -9,7 +9,6 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
@@ -19,7 +18,7 @@ import chat.simplex.common.platform.*
import chat.simplex.common.ui.theme.*
import chat.simplex.common.views.helpers.*
import chat.simplex.common.views.onboarding.OnboardingActionButton
import chat.simplex.common.views.usersettings.networkAndServers.defaultConditionsLink
import chat.simplex.common.views.usersettings.networkAndServers.ConditionsTextView
import chat.simplex.res.*
@Composable
@@ -72,10 +71,9 @@ fun BadgesCheckOrderView(level: BadgeLevel, period: BadgePeriod, modalManager: M
Column(horizontalAlignment = Alignment.CenterHorizontally) {
PayButton(level, period, purchasing)
BadgeBillingFooter(period)
val uriHandler = LocalUriHandler.current
Text(
stringResource(MR.strings.badges_privacy_policy),
Modifier.clickable { uriHandler.openUriCatching(defaultConditionsLink) },
Modifier.clickable { modalManager.showModal { BadgeConditionsView() } },
style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.primary
)
@@ -83,6 +81,16 @@ fun BadgesCheckOrderView(level: BadgeLevel, period: BadgePeriod, modalManager: M
}
}
@Composable
private fun BadgeConditionsView() {
ColumnWithScrollBar(Modifier.fillMaxSize().padding(horizontal = DEFAULT_PADDING)) {
AppBarTitle(stringResource(MR.strings.badges_privacy_policy), enableAlphaChanges = false, withPadding = false, bottomPadding = DEFAULT_PADDING)
Column(Modifier.weight(1f).padding(bottom = DEFAULT_PADDING, top = DEFAULT_PADDING_HALF)) {
ConditionsTextView(chatModel.remoteHostId())
}
}
}
@Composable
private fun Footnote(text: String) {
Text(