Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

ensu: disable sign-in and developer tools on android and iOS

Prateek Sunal846924e61d90
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeNavigation.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeNavigation.kt
index 73f24cb99c..ef8d299faa 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeNavigation.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeNavigation.kt
@@ -35,6 +35,7 @@ import io.ente.ensu.modelsettings.ModelSettingsScreen
import io.ente.ensu.settings.DeveloperSettingsScreen
import io.ente.ensu.settings.LogViewerScreen
import io.ente.ensu.settings.SettingsScreen
+import io.ente.ensu.utils.EnsuFeatureFlags
import kotlinx.coroutines.flow.Flow
@Composable
@@ -68,6 +69,7 @@ internal fun HomeNavigation(
sessionTitle = currentSession?.title,
showBrand = appState.chat.messages.isEmpty(),
isLoggedIn = appState.auth.isLoggedIn,
+ signInEnabled = EnsuFeatureFlags.enableSignIn,
attachmentDownloads = appState.chat.attachmentDownloads,
attachmentDownloadProgress = appState.chat.attachmentDownloadProgress,
modelDownloadStatus = appState.chat.downloadStatus,
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeTopBars.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeTopBars.kt
index bddd4d1e7e..352cc6f340 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeTopBars.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeTopBars.kt
@@ -36,6 +36,7 @@ internal fun EnsuTopBar(
sessionTitle: String?,
showBrand: Boolean,
isLoggedIn: Boolean,
+ signInEnabled: Boolean,
attachmentDownloads: List<AttachmentDownloadItem>,
attachmentDownloadProgress: Int?,
modelDownloadStatus: String?,
@@ -71,7 +72,7 @@ internal fun EnsuTopBar(
val isLoading = modelDownloadStatus?.contains("Loading", ignoreCase = true) == true
val showModelProgress = isLoading
- if (!isLoggedIn) {
+ if (!isLoggedIn && signInEnabled) {
if (showModelProgress) {
ModelProgressIndicator(
isLoading = isLoading,
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeView.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeView.kt
index ad37b5affe..81882e46a5 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeView.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/HomeView.kt
@@ -103,16 +103,13 @@ fun HomeView(
var lastDeveloperTapAt by remember { mutableStateOf<Long?>(null) }
var showDeveloperDialog by remember { mutableStateOf(false) }
- val handleSignInRequest: () -> Unit = {
- if (EnsuFeatureFlags.enableSignIn) {
- isShowingAuth = true
- } else {
- showSignInComingSoon = true
- }
+ val handleSignInRequest: () -> Unit = handle@{
+ if (!EnsuFeatureFlags.enableSignIn) return@handle
+ isShowingAuth = true
}
val handleDeveloperTap: () -> Unit = handle@{
- if (!EnsuFeatureFlags.enableSignIn) return@handle
+ if (!EnsuFeatureFlags.enableDeveloperTools) return@handle
// Don't allow switching endpoints for logged-in users.
if (appState.auth.isLoggedIn) return@handle
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.kt
index eca4721e1c..435d1389af 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
@@ -33,6 +33,7 @@ import io.ente.ensu.designsystem.EnsuCornerRadius
import io.ente.ensu.designsystem.EnsuSpacing
import io.ente.ensu.designsystem.EnsuTypography
import io.ente.ensu.designsystem.HugeIcons
+import io.ente.ensu.utils.EnsuFeatureFlags
@Composable
fun SettingsScreen(
@@ -70,7 +71,7 @@ fun SettingsScreen(
onClick = onSignOut
)
)
- } else {
+ } else if (EnsuFeatureFlags.enableSignIn) {
add(
SettingsItem(
title = "Sign In to Backup",
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/FeatureFlags.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/FeatureFlags.kt
index 0df2984034..507271977a 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/FeatureFlags.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/FeatureFlags.kt
@@ -1,7 +1,8 @@
package io.ente.ensu.utils
object EnsuFeatureFlags {
- const val enableSignIn = true
+ const val enableSignIn = false
+ const val enableDeveloperTools = false
const val enableImageUploads = true
const val enableModelSettings = false
}
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
index 2fc53f62b6..400b596040 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
@@ -242,7 +242,7 @@ struct ChatView: View {
ChatAppBar(
sessionTitle: viewModel.currentSessionId.map { viewModel.sessionTitle(for: $0) } ?? "New chat",
showBrand: viewModel.messages.isEmpty,
- showSignIn: !appState.isLoggedIn,
+ showSignIn: EnsuFeatureFlags.enableSignIn && !appState.isLoggedIn,
showsMenuButton: showsMenuButton,
attachmentDownloadSummary: viewModel.attachmentDownloadSummary,
modelDownloadState: viewModel.downloadToast,
@@ -482,7 +482,7 @@ struct ChatView: View {
}
private func handleDeveloperTap() {
- guard EnsuFeatureFlags.enableSignIn else { return }
+ guard EnsuFeatureFlags.enableDeveloperTools else { return }
// Don't allow switching endpoints for logged-in users.
guard !appState.isLoggedIn else { return }
diff --git a/mobile/native/darwin/Apps/ensu/ensu/FeatureFlags.swift b/mobile/native/darwin/Apps/ensu/ensu/FeatureFlags.swift
index 7095322899..6b5c85fe1a 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/FeatureFlags.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/FeatureFlags.swift
@@ -2,7 +2,8 @@
import Foundation
enum EnsuFeatureFlags {
- static let enableSignIn = true
+ static let enableSignIn = false
+ static let enableDeveloperTools = false
static let enableImageUploads = true
static let enableModelSettings = false
}
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift
index 65f14c6ff2..284d715994 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift
@@ -73,7 +73,7 @@ struct SettingsView: View {
Button("Close") { dismiss() }
}
}
- .alert("Sign out of Ente SU?", isPresented: $showSignOutConfirm) {
+ .alert("Sign out of Ensu?", isPresented: $showSignOutConfirm) {
Button("Sign Out", role: .destructive) {
onSignOut()
}
@@ -117,6 +117,7 @@ struct SettingsView: View {
}
private var shouldShowSignInRow: Bool {
+ guard EnsuFeatureFlags.enableSignIn else { return false }
guard !isLoggedIn else { return false }
guard !trimmedQuery.isEmpty else { return true }
let q = trimmedQuery.lowercased()