π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add privacy/terms links to Ensu settings
Prateek Sunal95b49d6c132e
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/SettingsScreen.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/SettingsScreen.ktindex eca4721e1c..75d7d79376 100644--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/SettingsScreen.kt+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/SettingsScreen.kt@@ -1,5 +1,9 @@package io.ente.ensu.settings+import android.content.Context+import android.content.Intent+import android.net.Uri+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Column@@ -11,7 +15,6 @@ import androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.foundation.backgroundimport androidx.compose.material3.HorizontalDividerimport androidx.compose.material3.Iconimport androidx.compose.material3.OutlinedTextField@@ -24,10 +27,12 @@ import androidx.compose.runtime.rememberimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.res.painterResourceimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dp-import androidx.compose.ui.draw.clip+import androidx.core.content.ContextCompatimport io.ente.ensu.designsystem.EnsuColorimport io.ente.ensu.designsystem.EnsuCornerRadiusimport io.ente.ensu.designsystem.EnsuSpacing@@ -45,8 +50,9 @@ fun SettingsScreen(onDeleteAccount: () -> Unit) {var query by remember { mutableStateOf("") }+ val context = LocalContext.current- val allItems = remember(onOpenLogs, onSignOut, onSignIn, onDeleteAccount, isLoggedIn) {+ val allItems = remember(context, onOpenLogs, onSignOut, onSignIn, onDeleteAccount, isLoggedIn) {buildList {add(SettingsItem(@@ -79,6 +85,21 @@ fun SettingsScreen())}++ add(+ SettingsItem(+ title = "Privacy Policy",+ subtitle = "ente.io/privacy",+ onClick = { context.openExternalLink("https://ente.io/privacy") }+ )+ )+ add(+ SettingsItem(+ title = "Terms of Service",+ subtitle = "ente.io/terms",+ onClick = { context.openExternalLink("https://ente.io/terms") }+ )+ )}}@@ -189,3 +210,12 @@ private fun SettingsRow(item: SettingsItem) {)}}++private fun Context.openExternalLink(url: String) {+ runCatching {+ val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+ }+ ContextCompat.startActivity(this, intent, null)+ }+}diff --git a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swiftindex 859d31eb2d..5c71a5fe23 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift@@ -32,6 +32,13 @@ struct SettingsView: View {.buttonStyle(.plain)}+ ForEach(filteredLinkItems) { item in+ Button(action: item.action) {+ settingsCard(title: item.title, subtitle: item.subtitle, showsChevron: false)+ }+ .buttonStyle(.plain)+ }+ForEach(filteredAccountItems) { item inButton(action: item.action) {settingsCard(title: item.title, subtitle: item.subtitle, showsChevron: false)@@ -93,6 +100,21 @@ struct SettingsView: View {}}+ private var linkItems: [SettingsActionItem] {+ [+ SettingsActionItem(+ title: "Privacy Policy",+ subtitle: "ente.io/privacy",+ action: { openExternalLink("https://ente.io/privacy") }+ ),+ SettingsActionItem(+ title: "Terms of Service",+ subtitle: "ente.io/terms",+ action: { openExternalLink("https://ente.io/terms") }+ )+ ]+ }+private var accountItems: [SettingsActionItem] {guard isLoggedIn else { return [] }return [@@ -117,6 +139,14 @@ struct SettingsView: View {}}+ private var filteredLinkItems: [SettingsActionItem] {+ guard !trimmedQuery.isEmpty else { return linkItems }+ let q = trimmedQuery.lowercased()+ return linkItems.filter { item in+ item.title.lowercased().contains(q) || (item.subtitle?.lowercased().contains(q) == true)+ }+ }+private var shouldShowSignInRow: Bool {guard showsSignInOption else { return false }guard !isLoggedIn else { return false }@@ -161,6 +191,11 @@ struct SettingsView: View {openURL(url)}+ private func openExternalLink(_ urlString: String) {+ guard let url = URL(string: urlString) else { return }+ openURL(url)+ }+private func signedInCard(email: String) -> some View {VStack(alignment: .leading, spacing: 4) {Text("Signed in as")