π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update frontend
Prateek Sunalf575a0aa8520
diff --git a/mobile/native/android/apps/ensu/.gitignore b/mobile/native/android/apps/ensu/.gitignoreindex 98051e180a..5fa84f5c40 100644--- a/mobile/native/android/apps/ensu/.gitignore+++ b/mobile/native/android/apps/ensu/.gitignore@@ -4,5 +4,9 @@# Build outputs**/build/+# Signing keys+*.keystore+key.properties+# OS.DS_Storediff --git a/mobile/native/android/apps/ensu/AGENTS.md b/mobile/native/android/apps/ensu/AGENTS.mdindex 9a4063959a..88986ad800 100644--- a/mobile/native/android/apps/ensu/AGENTS.md+++ b/mobile/native/android/apps/ensu/AGENTS.md@@ -14,6 +14,19 @@ Run commands from `android/apps/ensu`.- `./gradlew test`: Run unit tests for modules that include tests.- `./gradlew lint`: Run Android lint checks (if configured).+### Custom API Endpoint+Override the default API (`https://api.ente.io`) with `ENTE_API_ENDPOINT`:++```bash+ENTE_API_ENDPOINT=https://your-endpoint ./gradlew :app-ui:installDebug+```++Or via Gradle property:++```bash+./gradlew :app-ui:installDebug -PENTE_API_ENDPOINT=https://your-endpoint+```+## Coding Style & Naming Conventions- Kotlin: 4-space indentation, `camelCase` for functions/variables, `PascalCase` for classes/types.- Keep file/module names aligned with feature or domain (e.g., `app-ui`, `crypto-auth-core`).diff --git a/mobile/native/android/apps/ensu/README.md b/mobile/native/android/apps/ensu/README.mdindex ff238709a3..1018c0737b 100644--- a/mobile/native/android/apps/ensu/README.md+++ b/mobile/native/android/apps/ensu/README.md@@ -63,6 +63,20 @@ Note: If upgrading from a differently signed build, uninstall first:adb uninstall io.ente.ensu```+## Custom API Endpoint++Set `ENTE_API_ENDPOINT` to override the default (`https://api.ente.io`).++```bash+ENTE_API_ENDPOINT=https://your-endpoint ./gradlew :app-ui:installDebug+```++Or via Gradle property:++```bash+./gradlew :app-ui:installDebug -PENTE_API_ENDPOINT=https://your-endpoint+```+## Project Structure- `app-ui/` - Main application module (Compose UI)diff --git a/mobile/native/android/apps/ensu/app-ui/build.gradle.kts b/mobile/native/android/apps/ensu/app-ui/build.gradle.ktsindex 62fa4881a0..22c332a0fe 100644--- a/mobile/native/android/apps/ensu/app-ui/build.gradle.kts+++ b/mobile/native/android/apps/ensu/app-ui/build.gradle.kts@@ -1,27 +1,55 @@+import java.util.Properties+plugins {id("com.android.application")id("org.jetbrains.kotlin.android")}+val apiEndpointOverride = (System.getenv("ENTE_API_ENDPOINT")+ ?: project.findProperty("ENTE_API_ENDPOINT") as? String)+ ?.trim()+ .orEmpty()++if (apiEndpointOverride.isNotBlank()) {+ println("ENTE_API_ENDPOINT set for build: $apiEndpointOverride")+} else {+ println("ENTE_API_ENDPOINT not set; BuildConfig.API_ENDPOINT will be empty")+}++val keystorePropsFile = rootProject.file("key.properties")+val keystoreProps = Properties()+val hasReleaseKeystore = keystorePropsFile.exists()+if (hasReleaseKeystore) {+ keystorePropsFile.inputStream().use { keystoreProps.load(it) }+}+android {namespace = "io.ente.ensu"- compileSdk = 34+ compileSdk = 35signingConfigs {create("release") {- storeFile = file("../debug.keystore")- storePassword = "android"- keyAlias = "androiddebugkey"- keyPassword = "android"+ if (hasReleaseKeystore) {+ storeFile = file(keystoreProps["storeFile"] as String)+ storePassword = keystoreProps["storePassword"] as String+ keyAlias = keystoreProps["keyAlias"] as String+ keyPassword = keystoreProps["keyPassword"] as String+ } else {+ storeFile = file("../debug.keystore")+ storePassword = "android"+ keyAlias = "androiddebugkey"+ keyPassword = "android"+ }}}defaultConfig {applicationId = "io.ente.ensu"minSdk = 23- targetSdk = 34- versionCode = 1- versionName = "1.0"+ targetSdk = 35+ versionCode = 6+ versionName = "0.1.2"+ buildConfigField("String", "API_ENDPOINT", "\"$apiEndpointOverride\"")}buildTypes {@@ -32,6 +60,7 @@ android {buildFeatures {compose = true+ buildConfig = true}composeOptions {diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/AppViewModel.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/AppViewModel.ktindex 05a0d7c1ab..1a047caf26 100644--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/AppViewModel.kt+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/AppViewModel.kt@@ -26,10 +26,6 @@ class AppViewModel(application: Application) : AndroidViewModel(application) {private val endpointPreferences = EndpointPreferencesDataStore(application)private val credentialStore = CredentialStore(application)- private companion object {- const val fixedEndpoint = "https://1227635d8108.ngrok-free.app"- }-val logRepository = FileLogRepository(application)private val llmProvider = InferenceRsProvider(modelDir = File(application.filesDir, "llm")@@ -64,8 +60,18 @@ class AppViewModel(application: Application) : AndroidViewModel(application) {runBlocking {val endpoint = endpointPreferences.endpointFlow.first()+ val buildEndpoint = BuildConfig.API_ENDPOINT.trim()if (endpoint.isNullOrBlank()) {- endpointPreferences.setEndpoint(fixedEndpoint)+ val fallback = "https://api.ente.io"+ val resolved = if (buildEndpoint.isNotBlank()) buildEndpoint else fallback+ endpointPreferences.setEndpoint(resolved)+ } else if (buildEndpoint.isNotBlank() && buildEndpoint != endpoint) {+ logRepository.log(+ LogLevel.Info,+ "Build endpoint ignored",+ details = "stored=$endpoint build=$buildEndpoint",+ tag = "App"+ )}}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.ktindex 6ab0513355..c7e81f444e 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@@ -6,6 +6,7 @@ import android.content.Contextimport android.net.Uriimport android.provider.OpenableColumnsimport androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.PaddingValues@@ -23,6 +24,7 @@ import android.content.Intentimport android.webkit.MimeTypeMapimport android.widget.Toastimport androidx.activity.compose.BackHandler+import androidx.compose.animation.AnimatedVisibilityimport androidx.compose.animation.fadeInimport androidx.compose.animation.fadeOutimport androidx.compose.animation.slideInHorizontally@@ -31,6 +33,7 @@ import androidx.compose.animation.core.tweenimport androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.verticalScrollimport androidx.compose.material3.AlertDialog+import androidx.compose.material3.Buttonimport androidx.compose.material3.ButtonDefaultsimport androidx.compose.material3.CircularProgressIndicatorimport androidx.compose.material3.DrawerValue@@ -226,6 +229,12 @@ fun HomeView(isShowingAuth = false}+ BackHandler(enabled = !isChatRoute) {+ if (!navController.popBackStack()) {+ navController.navigate(HomeRoute.Chat) { launchSingleTop = true }+ }+ }+DisposableEffect(lifecycleOwner) {val observer = LifecycleEventObserver { _, event ->if (event == Lifecycle.Event.ON_RESUME) {@@ -244,11 +253,8 @@ fun HomeView(onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }}- androidx.compose.runtime.LaunchedEffect(currentRoute) {- if (!isChatRoute) {- drawerState.close()- }- }+ // Note: Drawer close is handled in navigation callbacks (onOpenSettings, onAccount, etc.)+ // to avoid race conditions with route changes during navigation transitions.val scaffoldContent: @Composable () -> Unit = {Scaffold(@@ -311,6 +317,7 @@ fun HomeView() {ChatView(chatState = appState.chat,+ isDrawerOpen = drawerState.currentValue == DrawerValue.Open,onMessageChange = store::updateMessageText,onSend = store::sendMessage,onStop = store::stopGeneration,@@ -348,8 +355,12 @@ fun HomeView(val currentEndpoint by currentEndpointFlow.collectAsState(initial = "https://api.ente.io")SettingsScreen(currentEndpoint = currentEndpoint,- onOpenModelSettings = { navController.navigate(HomeRoute.ModelSettings) },- onOpenLogs = { navController.navigate(HomeRoute.Logs) }+ isLoggedIn = appState.auth.isLoggedIn,+ userEmail = appState.auth.email,+ onOpenLogs = { navController.navigate(HomeRoute.Logs) },+ onSignOut = { isShowingSignOutDialog = true },+ onSignIn = { isShowingAuth = true },+ onDeleteAccount = { openDeleteAccountEmail(context) })}composable(@@ -386,6 +397,7 @@ fun HomeView(DeveloperSettingsScreen(authService = authService,currentEndpointFlow = currentEndpointFlow,+ onOpenModelSettings = { navController.navigate(HomeRoute.ModelSettings) },onSaved = { navController.popBackStack() })}@@ -398,57 +410,68 @@ fun HomeView(drawerState = drawerState,gesturesEnabled = isChatRoute,drawerContent = {- if (isChatRoute) {- SessionDrawer(- sessions = appState.chat.sessions,- selectedSessionId = appState.chat.currentSessionId,- isLoggedIn = appState.auth.isLoggedIn,- userEmail = appState.auth.email,- onNewChat = {- // We're already on the chat route when the drawer is visible.- // Avoid re-navigating to the same destination, which causes an unnecessary transition.- store.startNewSessionDraft()- store.persistSelectedSession(scope, null)- scope.launch { drawerState.close() }- },- onSelectSession = { session ->- // Same reason as above: just swap the session in-place.- store.selectSession(session.id)- store.persistSelectedSession(scope, session.id)- scope.launch { drawerState.close() }- },- onDeleteSession = { session ->- deleteSessionTarget = session- },- onSync = {- store.syncNow(- onSuccess = {- Toast.makeText(context, "Sync complete", Toast.LENGTH_SHORT).show()- },- onError = { message ->- Toast.makeText(context, message, Toast.LENGTH_SHORT).show()- }- )- },- onOpenSettings = {- navController.navigate(HomeRoute.Settings)- scope.launch { drawerState.close() }- },- onDeveloperTap = {- handleDeveloperTap()- },- onSignIn = { isShowingAuth = true },- onSignOut = { isShowingSignOutDialog = true }- )- } else {- Box(modifier = Modifier.width(1.dp))- }+ // Always render SessionDrawer - don't conditionally swap content based on route.+ // Changing drawer content while navigating can cause race conditions with the+ // navigation back stack. The drawer is already hidden via gesturesEnabled.+ SessionDrawer(+ sessions = appState.chat.sessions,+ selectedSessionId = appState.chat.currentSessionId,+ isLoggedIn = appState.auth.isLoggedIn,+ userEmail = appState.auth.email,+ onNewChat = {+ // We're already on the chat route when the drawer is visible.+ // Avoid re-navigating to the same destination, which causes an unnecessary transition.+ store.startNewSessionDraft()+ store.persistSelectedSession(scope, null)+ scope.launch { drawerState.close() }+ },+ onSelectSession = { session ->+ // Same reason as above: just swap the session in-place.+ store.selectSession(session.id)+ store.persistSelectedSession(scope, session.id)+ scope.launch { drawerState.close() }+ },+ onDeleteSession = { session ->+ deleteSessionTarget = session+ },+ onSync = {+ store.syncNow(+ onSuccess = {+ Toast.makeText(context, "Sync complete", Toast.LENGTH_SHORT).show()+ },+ onError = { message ->+ Toast.makeText(context, message, Toast.LENGTH_SHORT).show()+ }+ )+ },+ onOpenSettings = {+ navController.navigate(HomeRoute.Settings) {+ launchSingleTop = true+ restoreState = true+ popUpTo(HomeRoute.Chat) { inclusive = false }+ }+ scope.launch { drawerState.close() }+ },+ onDeveloperTap = {+ handleDeveloperTap()+ }+ )}) {scaffoldContent()}- if (isShowingAuth) {+ AnimatedVisibility(+ visible = isShowingAuth,+ enter = slideInHorizontally(+ initialOffsetX = { fullWidth -> fullWidth },+ animationSpec = tween(220)+ ) + fadeIn(animationSpec = tween(90)),+ exit = slideOutHorizontally(+ targetOffsetX = { fullWidth -> fullWidth },+ animationSpec = tween(220)+ ) + fadeOut(animationSpec = tween(90))+ ) {AuthFlowScreen(authService = authService,onLoggedIn = { email ->@@ -547,7 +570,11 @@ fun HomeView(TextButton(onClick = {showDeveloperDialog = false- navController.navigate(HomeRoute.DeveloperSettings)+ navController.navigate(HomeRoute.DeveloperSettings) {+ launchSingleTop = true+ restoreState = true+ popUpTo(HomeRoute.Chat) { inclusive = false }+ }scope.launch { drawerState.close() }},colors = ButtonDefaults.textButtonColors(contentColor = EnsuColor.textPrimary())@@ -819,7 +846,8 @@ private fun LogsTopBar(onBack: () -> Unit, onShare: () -> Unit) {IconButton(onClick = onShare) {Icon(painter = painterResource(HugeIcons.Upload01Icon),- contentDescription = "Share"+ contentDescription = "Share",+ modifier = Modifier.size(18.dp))}},@@ -934,6 +962,18 @@ private fun openAttachment(context: Context, attachment: Attachment) {}}+private fun openDeleteAccountEmail(context: Context) {+ val subject = Uri.encode("Request Deletion for Ente Account")+ val uri = Uri.parse("mailto:[email protected]?subject=$subject")+ val intent = Intent(Intent.ACTION_SENDTO, uri)+ val resolved = intent.resolveActivity(context.packageManager)+ if (resolved != null) {+ context.startActivity(intent)+ } else {+ Toast.makeText(context, "No email app available", Toast.LENGTH_SHORT).show()+ }+}+private fun queryDisplayName(resolver: android.content.ContentResolver, uri: Uri): String? {resolver.query(uri, arrayOf(OpenableColumns.DISPLAY_NAME), null, null, null)?.use { cursor ->if (cursor.moveToFirst()) {diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatView.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatView.ktindex 23805ffd91..5b498cb3c2 100644--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatView.kt+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatView.kt@@ -1,10 +1,6 @@-@file:OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)-package io.ente.ensu.chat-import androidx.compose.foundation.ExperimentalFoundationApiimport androidx.compose.foundation.background-import androidx.compose.foundation.borderimport androidx.compose.foundation.focusableimport androidx.compose.foundation.gestures.detectTapGesturesimport androidx.compose.foundation.isSystemInDarkTheme@@ -30,6 +26,7 @@ import androidx.compose.foundation.layout.navigationBarsPaddingimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.width+import androidx.compose.foundation.layout.wrapContentSizeimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.lazy.rememberLazyListState@@ -47,7 +44,6 @@ import androidx.compose.material3.DropdownMenuItemimport androidx.compose.material3.Iconimport androidx.compose.material3.IconButtonimport androidx.compose.material3.LinearProgressIndicator-import androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.runtime.LaunchedEffect@@ -59,7 +55,6 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.rotate-import androidx.compose.ui.draw.shadowimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.geometry.Offset@@ -68,15 +63,19 @@ import androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.hapticfeedback.HapticFeedbackTypeimport androidx.compose.ui.input.pointer.pointerInputimport androidx.compose.ui.platform.LocalClipboardManager-import androidx.compose.ui.platform.LocalDensity+import androidx.compose.ui.platform.LocalFocusManagerimport androidx.compose.ui.platform.LocalHapticFeedbackimport androidx.compose.ui.res.painterResource+import androidx.compose.material3.Surfaceimport androidx.compose.ui.text.AnnotatedStringimport androidx.compose.ui.text.input.KeyboardCapitalizationimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflow-import androidx.compose.ui.unit.DpOffset+import androidx.compose.ui.unit.IntOffsetimport androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Popup+import androidx.compose.ui.window.PopupProperties+import kotlin.math.roundToIntimport io.ente.ensu.components.BranchSwitcherimport io.ente.ensu.designsystem.EnsuColorimport io.ente.ensu.designsystem.EnsuCornerRadius@@ -97,6 +96,7 @@ import kotlinx.coroutines.delay@Composablefun ChatView(chatState: ChatState,+ isDrawerOpen: Boolean,onMessageChange: (String) -> Unit,onSend: () -> Unit,onStop: () -> Unit,@@ -115,19 +115,41 @@ fun ChatView(chatState.messages.isEmpty() &&!chatState.isGenerating+ val focusManager = LocalFocusManager.currentvar didAutoFocusInput by remember { mutableStateOf(false) }+ var focusRequestId by remember { mutableStateOf(0) }+ var wasDrawerOpen by remember { mutableStateOf(false) }+val shouldAutoFocusInput = chatState.isModelDownloaded &&!showDownloadOnboarding &&!chatState.isDownloading &&!chatState.isGenerating &&- !didAutoFocusInput+ !didAutoFocusInput &&+ !isDrawerOpenLaunchedEffect(shouldAutoFocusInput) {if (shouldAutoFocusInput) {+ focusRequestId += 1didAutoFocusInput = true}}+ LaunchedEffect(isDrawerOpen) {+ if (isDrawerOpen) {+ focusManager.clearFocus()+ wasDrawerOpen = true+ } else if (wasDrawerOpen) {+ val shouldRestoreFocus = chatState.isModelDownloaded &&+ !showDownloadOnboarding &&+ !chatState.isDownloading &&+ !chatState.isGenerating+ if (shouldRestoreFocus) {+ focusRequestId += 1+ }+ wasDrawerOpen = false+ }+ }+val shouldAutoDownload = chatState.hasRequestedModelDownload &&!chatState.isDownloading &&!chatState.isGenerating@@ -190,7 +212,7 @@ fun ChatView(onAttachmentSelected = onAttachmentSelected,onRemoveAttachment = onRemoveAttachment,onCancelEdit = onCancelEdit,- shouldRequestFocus = shouldAutoFocusInput+ focusRequestId = focusRequestId)}}@@ -245,7 +267,7 @@ private fun MessageList(} else {EmptyState(modifier = modifier,- title = "Welcome to ensu",+ title = "Welcome",subtitle = "Type a message to start chatting")}@@ -395,7 +417,7 @@ private fun EmptyState(Column(horizontalAlignment = Alignment.CenterHorizontally) {Text(text = title,- style = EnsuTypography.large,+ style = EnsuTypography.h2,color = EnsuColor.textPrimary(),textAlign = TextAlign.Center)@@ -508,7 +530,6 @@ private fun UserMessageBubble(var pressOffset by remember { mutableStateOf(Offset.Zero) }val bubbleShape = RoundedCornerShape(18.dp)val bubbleFill = if (isSystemInDarkTheme()) EnsuColor.fillFaint() else EnsuColor.border().copy(alpha = 0.2f)- val bubbleFill = if (isSystemInDarkTheme()) EnsuColor.fillFaint() else EnsuColor.border().copy(alpha = 0.2f)Column(modifier = Modifier@@ -558,66 +579,21 @@ private fun UserMessageBubble()}- val menuOffset = with(LocalDensity.current) {- DpOffset(pressOffset.x.toDp(), pressOffset.y.toDp())- }-- val menuSurface = if (isSystemInDarkTheme()) Color(0xFF1C1C1E) else Color.White- val menuColors = MaterialTheme.colorScheme.copy(- surface = menuSurface,- surfaceVariant = menuSurface,- surfaceTint = Color.Transparent,- primary = EnsuColor.textPrimary(),- primaryContainer = menuSurface,- secondary = EnsuColor.textPrimary(),- secondaryContainer = menuSurface,- onSurface = EnsuColor.textPrimary(),- onSurfaceVariant = EnsuColor.textPrimary()+ MessageActionsMenu(+ showMenu = showMenu,+ pressOffset = pressOffset,+ onDismiss = { showMenu = false },+ actions = listOf(+ MessageAction("Edit", HugeIcons.Edit01Icon) {+ haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)+ onEdit()+ },+ MessageAction("Copy", HugeIcons.Copy01Icon) {+ haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)+ clipboard.setText(AnnotatedString(message.text))+ }+ ))-- MaterialTheme(colorScheme = menuColors) {- DropdownMenu(- expanded = showMenu,- onDismissRequest = { showMenu = false },- offset = menuOffset,- modifier = Modifier- .shadow(8.dp, RoundedCornerShape(12.dp))- .border(1.dp, EnsuColor.border(), RoundedCornerShape(12.dp))- ) {- DropdownMenuItem(- text = { Text(text = "Edit", style = EnsuTypography.body, color = EnsuColor.textPrimary()) },- leadingIcon = {- Icon(- painter = painterResource(HugeIcons.Edit01Icon),- contentDescription = null,- modifier = Modifier.size(18.dp),- tint = EnsuColor.textPrimary()- )- },- onClick = {- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)- showMenu = false- onEdit()- }- )- DropdownMenuItem(- text = { Text(text = "Copy", style = EnsuTypography.body, color = EnsuColor.textPrimary()) },- leadingIcon = {- Icon(- painter = painterResource(HugeIcons.Copy01Icon),- contentDescription = null,- modifier = Modifier.size(18.dp),- tint = EnsuColor.textPrimary()- )- },- onClick = {- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)- showMenu = false- clipboard.setText(AnnotatedString(message.text))- }- )- }- }}Spacer(modifier = Modifier.height(EnsuSpacing.sm.dp))@@ -691,66 +667,21 @@ private fun AssistantMessageBubble(}}- val menuOffset = with(LocalDensity.current) {- DpOffset(pressOffset.x.toDp(), pressOffset.y.toDp())- }-- val menuSurface = if (isSystemInDarkTheme()) Color(0xFF1C1C1E) else Color.White- val menuColors = MaterialTheme.colorScheme.copy(- surface = menuSurface,- surfaceVariant = menuSurface,- surfaceTint = Color.Transparent,- primary = EnsuColor.textPrimary(),- primaryContainer = menuSurface,- secondary = EnsuColor.textPrimary(),- secondaryContainer = menuSurface,- onSurface = EnsuColor.textPrimary(),- onSurfaceVariant = EnsuColor.textPrimary()+ MessageActionsMenu(+ showMenu = showMenu,+ pressOffset = pressOffset,+ onDismiss = { showMenu = false },+ actions = listOf(+ MessageAction("Copy", HugeIcons.Copy01Icon) {+ haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)+ clipboard.setText(AnnotatedString(message.text))+ },+ MessageAction("Retry", HugeIcons.RepeatIcon) {+ haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)+ onRetry()+ }+ ))-- MaterialTheme(colorScheme = menuColors) {- DropdownMenu(- expanded = showMenu,- onDismissRequest = { showMenu = false },- offset = menuOffset,- modifier = Modifier- .shadow(8.dp, RoundedCornerShape(12.dp))- .border(1.dp, EnsuColor.border(), RoundedCornerShape(12.dp))- ) {- DropdownMenuItem(- text = { Text(text = "Copy", style = EnsuTypography.body, color = EnsuColor.textPrimary()) },- leadingIcon = {- Icon(- painter = painterResource(HugeIcons.Copy01Icon),- contentDescription = null,- modifier = Modifier.size(18.dp),- tint = EnsuColor.textPrimary()- )- },- onClick = {- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)- showMenu = false- clipboard.setText(AnnotatedString(message.text))- }- )- DropdownMenuItem(- text = { Text(text = "Retry", style = EnsuTypography.body, color = EnsuColor.textPrimary()) },- leadingIcon = {- Icon(- painter = painterResource(HugeIcons.RepeatIcon),- contentDescription = null,- modifier = Modifier.size(18.dp),- tint = EnsuColor.textPrimary()- )- },- onClick = {- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)- showMenu = false- onRetry()- }- )- }- }}Spacer(modifier = Modifier.height(EnsuSpacing.sm.dp))@@ -775,6 +706,68 @@ private fun AssistantMessageBubble(}}+private data class MessageAction(+ val label: String,+ val iconRes: Int,+ val onClick: () -> Unit+)++@Composable+private fun MessageActionsMenu(+ showMenu: Boolean,+ pressOffset: Offset,+ onDismiss: () -> Unit,+ actions: List<MessageAction>+) {+ if (!showMenu) return+ val menuSurface = if (isSystemInDarkTheme()) Color(0xFF1C1C1E) else Color.White+ val offset = IntOffset(pressOffset.x.roundToInt(), pressOffset.y.roundToInt())++ Popup(+ alignment = Alignment.TopStart,+ offset = offset,+ onDismissRequest = onDismiss,+ properties = PopupProperties(focusable = true)+ ) {+ Surface(+ modifier = Modifier.wrapContentSize(),+ color = menuSurface,+ shadowElevation = 4.dp,+ shape = RoundedCornerShape(12.dp)+ ) {+ Column(+ modifier = Modifier+ .width(IntrinsicSize.Min)+ .padding(vertical = EnsuSpacing.xs.dp)+ ) {+ actions.forEach { action ->+ DropdownMenuItem(+ text = {+ Text(+ text = action.label,+ style = EnsuTypography.body,+ color = EnsuColor.textPrimary()+ )+ },+ leadingIcon = {+ Icon(+ painter = painterResource(action.iconRes),+ contentDescription = null,+ modifier = Modifier.size(18.dp),+ tint = EnsuColor.textPrimary()+ )+ },+ onClick = {+ onDismiss()+ action.onClick()+ }+ )+ }+ }+ }+ }+}+@Composableprivate fun StreamingMessageBubble(text: String) {val bubbleShape = RoundedCornerShape(18.dp)@@ -1010,7 +1003,7 @@ private fun MessageInput(onAttachmentSelected: (AttachmentType) -> Unit,onRemoveAttachment: (Attachment) -> Unit,onCancelEdit: () -> Unit,- shouldRequestFocus: Boolean+ focusRequestId: Int) {val haptic = LocalHapticFeedback.currentval placeholder = when {@@ -1022,8 +1015,8 @@ private fun MessageInput(}val focusRequester = remember { FocusRequester() }- LaunchedEffect(shouldRequestFocus) {- if (shouldRequestFocus) {+ LaunchedEffect(focusRequestId) {+ if (focusRequestId > 0) {// Give the screen a moment to settle so IME shows reliably.delay(120)focusRequester.requestFocus()@@ -1165,7 +1158,7 @@ private fun MessageInput(Box(modifier = Modifier.size(22.dp)- .background(EnsuColor.textPrimary(), CircleShape),+ .background(Color.White, CircleShape),contentAlignment = Alignment.Center) {Icon(diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/SessionDrawer.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/SessionDrawer.ktindex 5106feefe2..f6361ae56d 100644--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/SessionDrawer.kt+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/SessionDrawer.kt@@ -20,8 +20,7 @@ import androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.ui.graphics.RectangleShapeimport androidx.compose.foundation.verticalScroll-import androidx.compose.material.icons.Icons-import androidx.compose.material.icons.outlined.Cloud+import androidx.compose.material3.HorizontalDividerimport androidx.compose.material3.Iconimport androidx.compose.material3.ModalDrawerSheet@@ -55,9 +54,7 @@ fun SessionDrawer(onDeleteSession: (ChatSession) -> Unit,onSync: () -> Unit,onOpenSettings: () -> Unit,- onDeveloperTap: () -> Unit,- onSignIn: () -> Unit,- onSignOut: () -> Unit+ onDeveloperTap: () -> Unit) {ModalDrawerSheet(drawerContainerColor = EnsuColor.backgroundBase(),@@ -70,9 +67,9 @@ fun SessionDrawer() {DrawerHeader(isLoggedIn = isLoggedIn,- userEmail = userEmail,- onOpenSettings = onOpenSettings,- onDeveloperTap = onDeveloperTap+ onDeveloperTap = onDeveloperTap,+ onNewChat = onNewChat,+ onSync = onSync)HorizontalDivider(color = EnsuColor.border())@@ -84,11 +81,6 @@ fun SessionDrawer(.padding(vertical = EnsuSpacing.lg.dp),verticalArrangement = Arrangement.spacedBy(EnsuSpacing.lg.dp)) {- DrawerNewChat(- onNewChat = onNewChat,- onSync = onSync,- isLoggedIn = isLoggedIn- )SessionGroups(sessions = sessions,selectedSessionId = selectedSessionId,@@ -101,8 +93,8 @@ fun SessionDrawer(DrawerFooter(isLoggedIn = isLoggedIn,- onSignIn = onSignIn,- onSignOut = onSignOut+ userEmail = userEmail,+ onOpenSettings = onOpenSettings)}}@@ -111,9 +103,9 @@ fun SessionDrawer(@Composableprivate fun DrawerHeader(isLoggedIn: Boolean,- userEmail: String?,- onOpenSettings: () -> Unit,- onDeveloperTap: () -> Unit+ onDeveloperTap: () -> Unit,+ onNewChat: () -> Unit,+ onSync: () -> Unit) {Column(modifier = Modifier@@ -122,48 +114,18 @@ private fun DrawerHeader(.padding(EnsuSpacing.lg.dp),verticalArrangement = Arrangement.spacedBy(EnsuSpacing.md.dp)) {- Row(- modifier = Modifier.fillMaxWidth(),- verticalAlignment = Alignment.CenterVertically+ Box(+ modifier = Modifier+ .clickable(enabled = !isLoggedIn) { onDeveloperTap() }) {- Box(- modifier = Modifier- .clickable(enabled = !isLoggedIn) { onDeveloperTap() }- ) {- EnsuLogo(height = 28.dp)- }- Spacer(modifier = Modifier.weight(1f))- DrawerIconButton(- iconRes = HugeIcons.Settings01Icon,- contentDescription = "Settings",- onClick = onOpenSettings- )- }-- if (isLoggedIn && !userEmail.isNullOrBlank()) {- CloudBadge(email = userEmail)+ EnsuLogo(height = 28.dp)}- }-}-@Composable-private fun DrawerIconButton(- iconRes: Int,- contentDescription: String,- onClick: () -> Unit,- isEnabled: Boolean = true-) {- Box(- modifier = Modifier- .size(40.dp)- .clickable(enabled = isEnabled, onClick = onClick),- contentAlignment = Alignment.Center- ) {- Icon(- painter = painterResource(iconRes),- contentDescription = contentDescription,- modifier = Modifier.size(18.dp),- tint = if (isEnabled) EnsuColor.textPrimary() else EnsuColor.textMuted()+ DrawerNewChat(+ modifier = Modifier.fillMaxWidth(),+ onNewChat = onNewChat,+ onSync = onSync,+ isLoggedIn = isLoggedIn)}}@@ -198,41 +160,16 @@ private fun DrawerPrimaryTile(}}-@Composable-private fun CloudBadge(email: String) {- Row(- verticalAlignment = Alignment.CenterVertically,- modifier = Modifier- .clip(RoundedCornerShape(EnsuCornerRadius.card.dp))- .background(EnsuColor.fillFaint())- .padding(horizontal = EnsuSpacing.md.dp, vertical = EnsuSpacing.sm.dp)- ) {- Icon(- imageVector = Icons.Outlined.Cloud,- contentDescription = null,- modifier = Modifier.size(16.dp),- tint = EnsuColor.textMuted()- )- Spacer(modifier = Modifier.width(EnsuSpacing.sm.dp))- Text(- text = email,- style = EnsuTypography.small,- color = EnsuColor.textMuted(),- maxLines = 1- )- }-}@Composableprivate fun DrawerNewChat(+ modifier: Modifier = Modifier,onNewChat: () -> Unit,onSync: () -> Unit,isLoggedIn: Boolean) {Row(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = EnsuSpacing.lg.dp),+ modifier = modifier.fillMaxWidth(),horizontalArrangement = Arrangement.spacedBy(EnsuSpacing.sm.dp)) {DrawerPrimaryTile(@@ -354,18 +291,53 @@ private fun SessionTile(@Composableprivate fun DrawerFooter(isLoggedIn: Boolean,- onSignIn: () -> Unit,- onSignOut: () -> Unit+ userEmail: String?,+ onOpenSettings: () -> Unit) {- val label = if (isLoggedIn) "Sign Out" else "Sign In to Backup"- Row(- modifier = Modifier- .fillMaxWidth()- .clickable(onClick = if (isLoggedIn) onSignOut else onSignIn)- .padding(EnsuSpacing.lg.dp),- verticalAlignment = Alignment.CenterVertically- ) {- Text(text = label, style = EnsuTypography.body, color = EnsuColor.textPrimary())+ if (isLoggedIn) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .clickable(onClick = onOpenSettings)+ .padding(EnsuSpacing.lg.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(EnsuSpacing.md.dp)+ ) {+ Text(+ text = userEmail.orEmpty(),+ style = EnsuTypography.body,+ color = EnsuColor.textPrimary(),+ modifier = Modifier.weight(1f)+ )+ Icon(+ painter = painterResource(HugeIcons.ArrowRight01Icon),+ contentDescription = "Settings",+ modifier = Modifier.size(18.dp),+ tint = EnsuColor.textMuted()+ )+ }+ } else {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .clickable(onClick = onOpenSettings)+ .padding(EnsuSpacing.lg.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(EnsuSpacing.md.dp)+ ) {+ Text(+ text = "Settings",+ style = EnsuTypography.body,+ color = EnsuColor.textPrimary(),+ modifier = Modifier.weight(1f)+ )+ Icon(+ painter = painterResource(HugeIcons.ArrowRight01Icon),+ contentDescription = "Settings",+ modifier = Modifier.size(18.dp),+ tint = EnsuColor.textMuted()+ )+ }}}diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/DeveloperSettingsScreen.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/DeveloperSettingsScreen.ktindex 2db10d9bdd..cd6edeeafb 100644--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/DeveloperSettingsScreen.kt+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/settings/DeveloperSettingsScreen.kt@@ -1,12 +1,16 @@package io.ente.ensu.settings+import androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.fillMaxSizeimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.heightimport androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.Iconimport androidx.compose.material3.OutlinedTextFieldimport androidx.compose.material3.Textimport androidx.compose.material3.TextFieldDefaults@@ -17,7 +21,9 @@ import androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberimport androidx.compose.runtime.rememberCoroutineScopeimport androidx.compose.runtime.setValue+import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.res.painterResourceimport androidx.compose.ui.unit.dpimport io.ente.ensu.auth.PrimaryButtonimport io.ente.ensu.data.auth.EnsuAuthService@@ -25,6 +31,7 @@ import io.ente.ensu.designsystem.EnsuColorimport io.ente.ensu.designsystem.EnsuCornerRadiusimport io.ente.ensu.designsystem.EnsuSpacingimport io.ente.ensu.designsystem.EnsuTypography+import io.ente.ensu.designsystem.HugeIconsimport kotlinx.coroutines.flow.Flowimport kotlinx.coroutines.launch@@ -32,6 +39,7 @@ import kotlinx.coroutines.launchfun DeveloperSettingsScreen(authService: EnsuAuthService,currentEndpointFlow: Flow<String>,+ onOpenModelSettings: () -> Unit,onSaved: () -> Unit) {val currentEndpoint by currentEndpointFlow.collectAsState(initial = "https://api.ente.io")@@ -47,6 +55,14 @@ fun DeveloperSettingsScreen(.fillMaxSize().padding(EnsuSpacing.pageHorizontal.dp)) {+ DeveloperSettingsRow(+ title = "Model settings",+ subtitle = "Model URL, mmproj, context length, max output",+ onClick = onOpenModelSettings+ )++ Spacer(modifier = Modifier.height(EnsuSpacing.xxl.dp))+Text(text = "Endpoint configuration", style = EnsuTypography.h3Bold, color = EnsuColor.textPrimary())Spacer(modifier = Modifier.height(EnsuSpacing.md.dp))@@ -105,3 +121,29 @@ fun DeveloperSettingsScreen(}}}++@Composable+private fun DeveloperSettingsRow(+ title: String,+ subtitle: String,+ onClick: () -> Unit+) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .clickable(onClick = onClick)+ .padding(vertical = EnsuSpacing.sm.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(text = title, style = EnsuTypography.body, color = EnsuColor.textPrimary())+ Text(text = subtitle, style = EnsuTypography.small, color = EnsuColor.textMuted())+ }+ Icon(+ painter = painterResource(HugeIcons.ArrowRight01Icon),+ contentDescription = null,+ tint = EnsuColor.textMuted(),+ modifier = Modifier.size(18.dp)+ )+ }+}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 d584aa6b55..339e77cdbc 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@@ -11,6 +11,7 @@ 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@@ -26,6 +27,7 @@ import androidx.compose.ui.Modifierimport androidx.compose.ui.res.painterResourceimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dp+import androidx.compose.ui.draw.clipimport io.ente.ensu.designsystem.EnsuColorimport io.ente.ensu.designsystem.EnsuCornerRadiusimport io.ente.ensu.designsystem.EnsuSpacing@@ -35,24 +37,49 @@ import io.ente.ensu.designsystem.HugeIcons@Composablefun SettingsScreen(currentEndpoint: String,- onOpenModelSettings: () -> Unit,- onOpenLogs: () -> Unit+ isLoggedIn: Boolean,+ userEmail: String?,+ onOpenLogs: () -> Unit,+ onSignOut: () -> Unit,+ onSignIn: () -> Unit,+ onDeleteAccount: () -> Unit) {var query by remember { mutableStateOf("") }- val allItems = remember(onOpenModelSettings, onOpenLogs) {- listOf(- SettingsItem(- title = "Model settings",- subtitle = "Model URL, mmproj, context length, max output",- onClick = onOpenModelSettings- ),- SettingsItem(- title = "Logs",- subtitle = "View, export, and share logs",- onClick = onOpenLogs+ val allItems = remember(onOpenLogs, onSignOut, onSignIn, onDeleteAccount, isLoggedIn) {+ buildList {+ add(+ SettingsItem(+ title = "Logs",+ subtitle = "View, export, and share logs",+ onClick = onOpenLogs+ ))- )+ if (isLoggedIn) {+ add(+ SettingsItem(+ title = "Sign Out",+ subtitle = "Stop syncing this device",+ onClick = onSignOut+ )+ )+ add(+ SettingsItem(+ title = "Delete Account",+ subtitle = "Email support to delete your account",+ onClick = onDeleteAccount+ )+ )+ } else {+ add(+ SettingsItem(+ title = "Sign In to Backup",+ subtitle = "Sync your chats across devices",+ onClick = onSignIn+ )+ )+ }+ }}val filteredItems = remember(query, allItems) {@@ -82,6 +109,28 @@ fun SettingsScreen(Spacer(modifier = Modifier.size(EnsuSpacing.lg.dp))+ if (isLoggedIn && !userEmail.isNullOrBlank()) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .clip(RoundedCornerShape(EnsuCornerRadius.card.dp))+ .background(EnsuColor.fillFaint())+ .padding(EnsuSpacing.lg.dp)+ ) {+ Text(+ text = "Signed in as",+ style = EnsuTypography.small,+ color = EnsuColor.textMuted()+ )+ Text(+ text = userEmail,+ style = EnsuTypography.body,+ color = EnsuColor.textPrimary()+ )+ }+ Spacer(modifier = Modifier.size(EnsuSpacing.md.dp))+ }+val normalizedEndpoint = currentEndpoint.trim().trimEnd('/')val defaultEndpoint = "https://api.ente.io"val isCustomEndpoint = query.isBlank() && normalizedEndpoint.isNotBlank() && normalizedEndpoint != defaultEndpointdiff --git a/mobile/native/android/apps/ensu/build.gradle.kts b/mobile/native/android/apps/ensu/build.gradle.ktsindex 3361df3cf5..57154b5379 100644--- a/mobile/native/android/apps/ensu/build.gradle.kts+++ b/mobile/native/android/apps/ensu/build.gradle.kts@@ -1,6 +1,6 @@plugins {- id("com.android.application") version "8.3.2" apply false- id("com.android.library") version "8.3.2" apply false+ id("com.android.application") version "8.5.2" apply false+ id("com.android.library") version "8.5.2" apply falseid("org.jetbrains.kotlin.android") version "1.9.23" apply falseid("org.jetbrains.kotlin.jvm") version "1.9.23" apply falseid("org.jetbrains.kotlin.plugin.serialization") version "1.9.23" apply falsediff --git a/mobile/native/android/apps/ensu/key.properties.example b/mobile/native/android/apps/ensu/key.properties.examplenew file mode 100644index 0000000000..c940767d48--- /dev/null+++ b/mobile/native/android/apps/ensu/key.properties.example@@ -0,0 +1,6 @@+# Copy to key.properties and fill in values.+# Use an absolute or relative path from mobile/native/android/apps/ensu+storeFile=../ensu-release.keystore+storePassword=YOUR_STORE_PASSWORD+keyAlias=ensu+keyPassword=YOUR_KEY_PASSWORDdiff --git a/mobile/native/darwin/Apps/ensu/README.md b/mobile/native/darwin/Apps/ensu/README.mdnew file mode 100644index 0000000000..89d3e79780--- /dev/null+++ b/mobile/native/darwin/Apps/ensu/README.md@@ -0,0 +1,21 @@+# Ensu Apple Platforms++## Build++Open the Xcode project:++```bash+open darwin/Apps/ensu/ensu.xcodeproj+```++## Custom API Endpoint++Set the `ENTE_API_ENDPOINT` value in the appβs Info.plist (or via an Xcode build setting) to override the default `https://api.ente.io`.++**Option A: Info.plist**+- Add a new key `ENTE_API_ENDPOINT` with your endpoint URL as the value.++**Option B: Build Setting**+- In Xcode, add a User-Defined Setting `ENTE_API_ENDPOINT` and reference it in Info.plist as `$(ENTE_API_ENDPOINT)`.++If the key is missing or empty, the app defaults to `https://api.ente.io`.diff --git a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxprojindex 6e6fe5cf8f..7c2f20b6d6 100644--- a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj+++ b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj@@ -13,6 +13,7 @@DAB0F20D2F5E123400ABCD01 /* InferenceRS in Frameworks */ = {isa = PBXBuildFile; productRef = DAB0F20C2F5E123400ABCD01 /* InferenceRS */; };DAB0F20E2F5E123400ABCD01 /* InferenceRS in Frameworks (macOS) */ = {isa = PBXBuildFile; productRef = DAB0F20C2F5E123400ABCD01 /* InferenceRS */; };DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = DAF584662E61BB8300F8A08F /* ZIPFoundation */; };+ DAF584682E61BB8300F8A08F /* ZIPFoundation in Frameworks (macOS) */ = {isa = PBXBuildFile; productRef = DAF584662E61BB8300F8A08F /* ZIPFoundation */; };/* End PBXBuildFile section */@@ -62,6 +63,7 @@files = (DACC3DC92E618D6A00DAF993 /* EnteNetwork in Frameworks */,DAB0F20D2F5E123400ABCD01 /* InferenceRS in Frameworks */,+ DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */,);runOnlyForDeploymentPostprocessing = 0;};@@ -71,6 +73,7 @@files = (21BBA57867859DAD206D6A46 /* EnteNetwork in Frameworks (macOS) */,DAB0F20E2F5E123400ABCD01 /* InferenceRS in Frameworks (macOS) */,+ DAF584682E61BB8300F8A08F /* ZIPFoundation in Frameworks (macOS) */,);runOnlyForDeploymentPostprocessing = 0;};@@ -139,6 +142,7 @@packageProductDependencies = (DACC3DC82E618D6A00DAF993 /* EnteNetwork */,DAB0F20C2F5E123400ABCD01 /* InferenceRS */,+ DAF584662E61BB8300F8A08F /* ZIPFoundation */,);productName = ensu;productReference = DA72BC612E5F87A000D128FF /* ensu.app */;@@ -164,6 +168,7 @@packageProductDependencies = (DACC3DC82E618D6A00DAF993 /* EnteNetwork */,DAB0F20C2F5E123400ABCD01 /* InferenceRS */,+ DAF584662E61BB8300F8A08F /* ZIPFoundation */,);productName = Ensu;productReference = 77E1DDDF900AB047CB554122 /* Ensu.app */;@@ -492,7 +497,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 6;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -507,7 +512,7 @@"$(inherited)","@executable_path/Frameworks",);- MARKETING_VERSION = 1.0;+ MARKETING_VERSION = 0.1.2;PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = "$(TARGET_NAME)";PROVISIONING_PROFILE_SPECIFIER = "";@@ -552,7 +557,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 5;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -567,7 +572,7 @@"$(inherited)","@executable_path/Frameworks",);- MARKETING_VERSION = 1.0;+ MARKETING_VERSION = 0.1.2;PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = "$(TARGET_NAME)";PROVISIONING_PROFILE_SPECIFIER = "";@@ -612,7 +617,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 5;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -625,8 +630,8 @@"@executable_path/../Frameworks",);MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 1.0;- PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu.mac;+ MARKETING_VERSION = 0.1.2;+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = Ensu;HEADER_SEARCH_PATHS = ("$(inherited)",@@ -672,7 +677,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 5;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -685,8 +690,8 @@"@executable_path/../Frameworks",);MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 1.0;- PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu.mac;+ MARKETING_VERSION = 0.1.2;+ PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = Ensu;HEADER_SEARCH_PATHS = ("$(inherited)",@@ -733,7 +738,7 @@CURRENT_PROJECT_VERSION = 1;DEVELOPMENT_TEAM = SN6GQPQWGV;GENERATE_INFOPLIST_FILE = YES;- MARKETING_VERSION = 1.0;+ MARKETING_VERSION = 0.1.0;PRODUCT_BUNDLE_IDENTIFIER = io.ente.photos.tv.castTests;PRODUCT_NAME = "$(TARGET_NAME)";SWIFT_EMIT_LOC_STRINGS = NO;@@ -752,7 +757,7 @@CURRENT_PROJECT_VERSION = 1;DEVELOPMENT_TEAM = SN6GQPQWGV;GENERATE_INFOPLIST_FILE = YES;- MARKETING_VERSION = 1.0;+ MARKETING_VERSION = 0.1.0;PRODUCT_BUNDLE_IDENTIFIER = io.ente.photos.tvTests;PRODUCT_NAME = "$(TARGET_NAME)";SWIFT_EMIT_LOC_STRINGS = NO;@@ -770,7 +775,7 @@CURRENT_PROJECT_VERSION = 1;DEVELOPMENT_TEAM = SN6GQPQWGV;GENERATE_INFOPLIST_FILE = YES;- MARKETING_VERSION = 1.0;+ MARKETING_VERSION = 0.1.0;PRODUCT_BUNDLE_IDENTIFIER = io.ente.photos.tv.castUITests;PRODUCT_NAME = "$(TARGET_NAME)";SWIFT_EMIT_LOC_STRINGS = NO;@@ -787,7 +792,7 @@CURRENT_PROJECT_VERSION = 1;DEVELOPMENT_TEAM = SN6GQPQWGV;GENERATE_INFOPLIST_FILE = YES;- MARKETING_VERSION = 1.0;+ MARKETING_VERSION = 0.1.0;PRODUCT_BUNDLE_IDENTIFIER = io.ente.photos.tvUITests;PRODUCT_NAME = "$(TARGET_NAME)";SWIFT_EMIT_LOC_STRINGS = NO;diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swiftindex 57b257a9e9..3f81097f80 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift@@ -10,8 +10,6 @@ struct ChatView: View {@State private var isDrawerOpen = false@State private var showSettings = false- @State private var showModelSettings = false- @State private var showLogs = false@State private var toastMessage: ToastMessage?@StateObject private var keyboard = KeyboardObserver()@State private var deleteSession: ChatSession?@@ -23,6 +21,9 @@ struct ChatView: View {@State private var showSignOutAlert = false@State private var showAttachmentDownloads = false@State private var didAutoFocusInput = false+ @State private var focusRequestId = 0+ @State private var dismissKeyboardId = 0+ @State private var wasDrawerOpen = falseprivate var editingMessage: ChatMessage? {guard let editingId = viewModel.editingMessageId else { return nil }@@ -68,6 +69,18 @@ struct ChatView: View {isDrawerOpen = false}}+ .onChange(of: isDrawerOpen) { isOpen in+ if isOpen {+ dismissKeyboardId += 1+ wasDrawerOpen = true+ } else if wasDrawerOpen {+ let shouldRestoreFocus = viewModel.isModelDownloaded && !viewModel.isDownloading && !viewModel.isGenerating+ if shouldRestoreFocus {+ focusRequestId += 1+ }+ wasDrawerOpen = false+ }+ }.onChange(of: viewModel.syncErrorMessage) { message inguard let message else { return }showToast(message, duration: 2)@@ -90,20 +103,20 @@ struct ChatView: View {}.sheet(isPresented: $showSettings) {SettingsView(- onOpenModelSettings: {- showModelSettings = true+ isLoggedIn: appState.isLoggedIn,+ email: CredentialStore.shared.email,+ onSignOut: {+ showSettings = false+ showSignOutAlert = true},- onOpenLogs: {- showLogs = true+ onSignIn: {+ showSettings = false+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) {+ isShowingAuth = true+ }})}- .sheet(isPresented: $showModelSettings) {- ModelSettingsView()- }- .sheet(isPresented: $showLogs) {- LogsView()- }.sheet(isPresented: $showAttachmentDownloads) {AttachmentDownloadsSheet(downloads: viewModel.attachmentDownloads,@@ -200,7 +213,7 @@ struct ChatView: View {streamingParentId: viewModel.displayedStreamingParentId,isGenerating: viewModel.isGenerating,keyboardHeight: keyboard.height,- emptyStateTitle: "Welcome to ensu",+ emptyStateTitle: "Welcome",emptyStateSubtitle: "Start typing to begin a conversation",onEdit: { message inviewModel.beginEditing(message: message)@@ -219,7 +232,7 @@ struct ChatView: View {}if !showDownloadOnboarding {- let shouldAutoFocus = viewModel.isModelDownloaded && !viewModel.isDownloading && !viewModel.isGenerating && !didAutoFocusInput+ let shouldAutoFocus = viewModel.isModelDownloaded && !viewModel.isDownloading && !viewModel.isGenerating && !didAutoFocusInput && !isDrawerOpenMessageInputView(text: $viewModel.draftText,@@ -229,7 +242,8 @@ struct ChatView: View {editingMessage: editingMessage,isProcessingAttachments: viewModel.isProcessingAttachments,isAttachmentDownloadBlocked: viewModel.isAttachmentDownloadBlocked,- autoFocus: shouldAutoFocus,+ focusRequestId: focusRequestId,+ dismissKeyboardId: dismissKeyboardId,onSend: {viewModel.sendDraft()},@@ -251,6 +265,13 @@ struct ChatView: View {).onAppear {if shouldAutoFocus {+ focusRequestId += 1+ didAutoFocusInput = true+ }+ }+ .onChange(of: shouldAutoFocus) { newValue in+ if newValue {+ focusRequestId += 1didAutoFocusInput = true}}@@ -305,13 +326,6 @@ struct ChatView: View {},onDeveloperTap: {handleDeveloperTap()- },- onSignOut: {- showSignOutAlert = true- },- onSignIn: {- isDrawerOpen = false- isShowingAuth = true}).frame(width: drawerWidth)diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swiftindex 93f49cd2e3..0c37719018 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift@@ -11,7 +11,8 @@ struct MessageInputView: View {let editingMessage: ChatMessage?let isProcessingAttachments: Boollet isAttachmentDownloadBlocked: Bool- let autoFocus: Bool+ let focusRequestId: Int+ let dismissKeyboardId: Intlet onSend: () -> Voidlet onStop: () -> Voidlet onCancelEdit: () -> Void@@ -197,6 +198,24 @@ struct MessageInputView: View {}.padding(.top, EnsuSpacing.sm).background(EnsuColor.backgroundBase)+ .onAppear {+ if focusRequestId > 0 {+ requestFocus()+ }+ }+ .onChange(of: focusRequestId) { _ in+ requestFocus()+ }+ .onChange(of: dismissKeyboardId) { _ in+ isFocused = false+ hideKeyboard()+ }+ }++ private func requestFocus() {+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {+ isFocused = true+ }}private var attachmentIconSize: CGFloat {diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swiftindex 45ecb60302..de3d65ce6d 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift@@ -35,7 +35,7 @@ struct MessageListView: View {if messages.isEmpty && !isGenerating {VStack(spacing: EnsuSpacing.sm) {Text(emptyStateTitle)- .font(EnsuTypography.large)+ .font(EnsuTypography.h2).foregroundStyle(EnsuColor.textPrimary)if let emptyStateSubtitle {Text(emptyStateSubtitle)diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swiftindex 64792c8a86..dfb705a53b 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift@@ -12,8 +12,6 @@ struct SessionDrawerView: View {let onSync: () -> Voidlet onOpenSettings: () -> Voidlet onDeveloperTap: () -> Void- let onSignOut: () -> Void- let onSignIn: () -> Voidvar body: some View {VStack(spacing: 0) {@@ -21,8 +19,6 @@ struct SessionDrawerView: View {ScrollView {VStack(alignment: .leading, spacing: EnsuSpacing.lg) {- newChatTile-ForEach(sectionedSessions) { section inVStack(alignment: .leading, spacing: EnsuSpacing.sm) {Text(section.title)@@ -63,23 +59,9 @@ struct SessionDrawerView: View {}Spacer()-- iconButton(symbol: "Settings01Icon", action: onOpenSettings)}- if isLoggedIn, let email {- HStack(spacing: EnsuSpacing.sm) {- Image(systemName: "cloud")- Text(email)- .font(EnsuTypography.small)- .foregroundStyle(EnsuColor.textMuted)- .lineLimit(1)- }- .padding(.horizontal, EnsuSpacing.md)- .padding(.vertical, EnsuSpacing.sm)- .background(EnsuColor.fillFaint)- .clipShape(RoundedRectangle(cornerRadius: EnsuCornerRadius.card, style: .continuous))- }+ newChatTile(horizontalPadding: 0)}.padding(EnsuSpacing.lg).background(@@ -91,7 +73,7 @@ struct SessionDrawerView: View {)}- private var newChatTile: some View {+ private func newChatTile(horizontalPadding: CGFloat = EnsuSpacing.lg) -> some View {HStack(spacing: EnsuSpacing.sm) {drawerPrimaryTile(icon: "PlusSignIcon",@@ -108,7 +90,7 @@ struct SessionDrawerView: View {}}// Make the tiles take equal width (50/50) and keep some space between.- .padding(.horizontal, EnsuSpacing.lg)+ .padding(.horizontal, horizontalPadding)}private func sessionTile(_ session: ChatSession) -> some View {@@ -139,40 +121,52 @@ struct SessionDrawerView: View {private var footer: some View {HStack {if isLoggedIn {- Button("Sign Out") {- hapticWarning()- onSignOut()+ Button {+ hapticTap()+ onOpenSettings()+ } label: {+ HStack(spacing: EnsuSpacing.md) {+ Text(email ?? "")+ .font(EnsuTypography.body)+ .foregroundStyle(EnsuColor.textPrimary)+ .lineLimit(1)+ .frame(maxWidth: .infinity, alignment: .leading)+ Image("ArrowRight01Icon")+ .resizable()+ .scaledToFit()+ .frame(width: 18, height: 18)+ .foregroundStyle(EnsuColor.textMuted)+ }+ .frame(maxWidth: .infinity)+ .contentShape(Rectangle())}- .font(EnsuTypography.body)- .foregroundStyle(EnsuColor.textPrimary)+ .buttonStyle(.plain)} else {- Button("Sign In to Backup") {+ Button {hapticTap()- onSignIn()+ onOpenSettings()+ } label: {+ HStack(spacing: EnsuSpacing.md) {+ Text("Settings")+ .font(EnsuTypography.body)+ .foregroundStyle(EnsuColor.textPrimary)+ .frame(maxWidth: .infinity, alignment: .leading)+ Image("ArrowRight01Icon")+ .resizable()+ .scaledToFit()+ .frame(width: 18, height: 18)+ .foregroundStyle(EnsuColor.textMuted)+ }+ .frame(maxWidth: .infinity)+ .contentShape(Rectangle())}- .font(EnsuTypography.body)- .foregroundStyle(EnsuColor.textPrimary)+ .buttonStyle(.plain)}- Spacer()+ Spacer(minLength: 0)}.padding(EnsuSpacing.lg)}- private func iconButton(symbol: String, action: @escaping () -> Void) -> some View {- Button(action: {- hapticTap()- action()- }) {- Image(symbol)- .resizable()- .scaledToFit()- .frame(width: 18, height: 18)- .frame(width: 40, height: 40)- .foregroundStyle(EnsuColor.textPrimary)- }- .buttonStyle(.plain)- }-private func drawerPrimaryTile(icon: String, title: String, action: @escaping () -> Void) -> some View {Button(action: {hapticTap()@@ -228,6 +222,7 @@ private struct SessionSection: Identifiable {let title: Stringlet sessions: [ChatSession]}+#elseimport SwiftUIdiff --git a/mobile/native/darwin/Apps/ensu/ensu/Info.plist b/mobile/native/darwin/Apps/ensu/ensu/Info.plistindex 54919f148f..572d0c9c40 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Info.plist+++ b/mobile/native/darwin/Apps/ensu/ensu/Info.plist@@ -21,7 +21,7 @@<string>APPL</string><key>CFBundleShortVersionString</key>- <string>1.0</string>+ <string>0.1.0</string><key>CFBundleVersion</key><string>1</string>diff --git a/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swift b/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swiftindex f71911039c..9c21cbe5ba 100644--- a/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swift@@ -1,7 +1,9 @@+#if canImport(EnteCore)import SwiftUIstruct ModelSettingsView: View {@Environment(\.dismiss) private var dismiss+ let embeddedInNavigation: Bool@ObservedObject private var settings = ModelSettingsStore.shared@State private var modelUrl: String = ""@@ -42,21 +44,42 @@ struct ModelSettingsView: View {)]+ init(embeddedInNavigation: Bool = false) {+ self.embeddedInNavigation = embeddedInNavigation+ }+var body: some View {Group {- #if os(iOS)- NavigationStack {+ if embeddedInNavigation {content- .navigationTitle("Model Settings")+ .navigationBarTitleDisplayMode(.inline).toolbar {- ToolbarItem(placement: .primaryAction) {- Button("Done") { dismiss() }+ ToolbarItem(placement: .principal) {+ Text("Model Settings")+ .font(EnsuTypography.large)+ .foregroundStyle(EnsuColor.textPrimary)}}+ } else {+ #if os(iOS)+ NavigationStack {+ content+ .navigationBarTitleDisplayMode(.inline)+ .toolbar {+ ToolbarItem(placement: .principal) {+ Text("Model Settings")+ .font(EnsuTypography.large)+ .foregroundStyle(EnsuColor.textPrimary)+ }+ ToolbarItem(placement: .primaryAction) {+ Button("Done") { dismiss() }+ }+ }+ }+ #else+ content+ #endif}- #else- content- #endif}.onAppear {modelUrl = settings.modelUrl@@ -67,24 +90,28 @@ struct ModelSettingsView: View {}#if os(macOS).safeAreaInset(edge: .top) {- MacSheetHeader(- leading: {- EmptyView()- },- center: {- Text("Model Settings")- .font(EnsuTypography.large)- .foregroundStyle(EnsuColor.textPrimary)- },- trailing: {- Button("Done") {- dismiss()+ if embeddedInNavigation {+ EmptyView()+ } else {+ MacSheetHeader(+ leading: {+ EmptyView()+ },+ center: {+ Text("Model Settings")+ .font(EnsuTypography.large)+ .foregroundStyle(EnsuColor.textPrimary)+ },+ trailing: {+ Button("Done") {+ dismiss()+ }+ .font(EnsuTypography.small)+ .foregroundStyle(EnsuColor.textMuted)+ .buttonStyle(.plain)}- .font(EnsuTypography.small)- .foregroundStyle(EnsuColor.textMuted)- .buttonStyle(.plain)- }- )+ )+ }}#endif}@@ -356,3 +383,13 @@ private struct SuggestedModel: Identifiable {self.mmproj = mmproj}}++#else+import SwiftUI++struct ModelSettingsView: View {+ var body: some View {+ Text("Model settings unavailable")+ }+}+#endifdiff --git a/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift b/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swiftindex dc27a69b38..56b84d8946 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift@@ -1,16 +1,35 @@import Foundation+#if canImport(EnteNetwork)import EnteNetwork+#else+struct NetworkConfiguration {+ let apiEndpoint: URL++ static var `default`: NetworkConfiguration {+ NetworkConfiguration(apiEndpoint: URL(string: "https://api.ente.io")!)+ }++ static func selfHosted(baseURL: URL) -> NetworkConfiguration {+ NetworkConfiguration(apiEndpoint: baseURL)+ }+}+#endifenum EnsuDeveloperSettings {private static let endpointKey = "ensu.customEndpoint"- private static let fixedEndpoint = URL(string: "https://1227635d8108.ngrok-free.app")+ private static let infoPlistKey = "ENTE_API_ENDPOINT"static var currentEndpoint: URL? {- guard let stored = UserDefaults.standard.string(forKey: endpointKey),- let url = URL(string: stored) else {- return fixedEndpoint+ if let stored = UserDefaults.standard.string(forKey: endpointKey),+ let url = URL(string: stored) {+ return url+ }+ if let plistValue = Bundle.main.object(forInfoDictionaryKey: infoPlistKey) as? String,+ !plistValue.isEmpty,+ let url = URL(string: plistValue) {+ return url}- return url+ return nil}static var currentEndpointString: String {diff --git a/mobile/native/darwin/Apps/ensu/ensu/Services/Logging/EnsuLogging.swift b/mobile/native/darwin/Apps/ensu/ensu/Services/Logging/EnsuLogging.swiftindex 73e91eb8ab..ec469d679e 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Services/Logging/EnsuLogging.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Services/Logging/EnsuLogging.swift@@ -1,4 +1,7 @@import Foundation+#if canImport(ZIPFoundation)+import ZIPFoundation+#endifenum EnsuLogLevel: String {case info = "INFO"@@ -140,10 +143,12 @@ final class EnsuLogging {try? FileManager.default.removeItem(at: dest)}+ #if canImport(ZIPFoundation)if #available(iOS 16.0, macOS 13.0, *) {try FileManager.default.zipItem(at: logsDirectory, to: dest, shouldKeepParent: true)return dest}+ #endif// Fallback: concatenate logs into a single text file.let fallback = dest.deletingPathExtension().appendingPathExtension("txt")diff --git a/mobile/native/darwin/Apps/ensu/ensu/Settings/DeveloperSettingsView.swift b/mobile/native/darwin/Apps/ensu/ensu/Settings/DeveloperSettingsView.swiftindex bdd0c6522d..831e16930b 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Settings/DeveloperSettingsView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Settings/DeveloperSettingsView.swift@@ -1,4 +1,6 @@+#if canImport(EnteCore)import SwiftUI+import Foundationstruct DeveloperSettingsView: View {@Environment(\.dismiss) private var dismiss@@ -9,14 +11,20 @@ struct DeveloperSettingsView: View {@State private var currentEndpoint: String = EnsuDeveloperSettings.currentEndpointString@State private var isSaving = false@State private var alert: DeveloperSettingsAlert?+ @State private var showModelSettings = falsevar body: some View {Group {#if os(iOS)NavigationStack {content- .navigationTitle("Developer settings")+ .navigationBarTitleDisplayMode(.inline).toolbar {+ ToolbarItem(placement: .principal) {+ Text("Developer settings")+ .font(EnsuTypography.large)+ .foregroundStyle(EnsuColor.textPrimary)+ }ToolbarItem(placement: .primaryAction) {Button("Close") {dismiss()@@ -37,6 +45,9 @@ struct DeveloperSettingsView: View {)}#if os(macOS)+ .sheet(isPresented: $showModelSettings) {+ ModelSettingsView(embeddedInNavigation: true)+ }.safeAreaInset(edge: .top) {MacSheetHeader(leading: {@@ -62,6 +73,22 @@ struct DeveloperSettingsView: View {private var content: some View {VStack(alignment: .leading, spacing: EnsuSpacing.xxl) {+ #if os(iOS)+ NavigationLink {+ ModelSettingsView(embeddedInNavigation: true)+ } label: {+ settingsRow(title: "Model settings", subtitle: "Model URL, mmproj, context length")+ }+ .buttonStyle(.plain)+ #else+ Button {+ showModelSettings = true+ } label: {+ settingsRow(title: "Model settings", subtitle: "Model URL, mmproj, context length")+ }+ .buttonStyle(.plain)+ #endif+VStack(alignment: .leading, spacing: 6) {Text("Server endpoint").font(EnsuTypography.small)@@ -93,6 +120,30 @@ struct DeveloperSettingsView: View {.padding(EnsuSpacing.lg)}+ private func settingsRow(title: String, subtitle: String?) -> some View {+ HStack {+ VStack(alignment: .leading, spacing: 4) {+ Text(title)+ .font(EnsuTypography.body)+ .foregroundStyle(EnsuColor.textPrimary)+ if let subtitle {+ Text(subtitle)+ .font(EnsuTypography.small)+ .foregroundStyle(EnsuColor.textMuted)+ }+ }+ Spacer()+ Image("ArrowRight01Icon")+ .resizable()+ .scaledToFit()+ .frame(width: 18, height: 18)+ .foregroundStyle(EnsuColor.textMuted)+ }+ .padding(EnsuSpacing.lg)+ .background(EnsuColor.fillFaint)+ .clipShape(RoundedRectangle(cornerRadius: EnsuCornerRadius.card, style: .continuous))+ }+private var isSavable: Bool {!endpoint.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty && !isSaving}@@ -147,3 +198,12 @@ private struct DeveloperSettingsAlert: Identifiable {let title: Stringlet message: String}+#else+import SwiftUI++struct DeveloperSettingsView: View {+ var body: some View {+ Text("Developer settings unavailable")+ }+}+#endifdiff --git a/mobile/native/darwin/Apps/ensu/ensu/Settings/LogsView.swift b/mobile/native/darwin/Apps/ensu/ensu/Settings/LogsView.swiftindex d141fb7c03..51875da259 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Settings/LogsView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Settings/LogsView.swift@@ -1,7 +1,9 @@+#if canImport(EnteCore)import SwiftUIstruct LogsView: View {@Environment(\.dismiss) private var dismiss+ let embeddedInNavigation: Bool@State private var selectedFile: URL?@State private var logText: String = ""@@ -12,23 +14,57 @@ struct LogsView: View {private let logger = EnsuLogging.shared.logger("LogsView")+ init(embeddedInNavigation: Bool = false) {+ self.embeddedInNavigation = embeddedInNavigation+ }+var body: some View {- NavigationStack {- VStack(spacing: 0) {- content- }- .background(EnsuColor.backgroundBase)- .navigationTitle("Logs")- .toolbar {- ToolbarItem(placement: .cancellationAction) {- Button("Close") { dismiss() }+ Group {+ if embeddedInNavigation {+ VStack(spacing: 0) {+ content+ }+ .background(EnsuColor.backgroundBase)+ .navigationBarTitleDisplayMode(.inline)+ .toolbar {+ ToolbarItem(placement: .principal) {+ Text("Logs")+ .font(EnsuTypography.large)+ .foregroundStyle(EnsuColor.textPrimary)+ }+ ToolbarItem(placement: .primaryAction) {+ Menu {+ Button("Share") { shareTapped() }+ Button("Export") { exportTapped() }+ } label: {+ Image(systemName: "square.and.arrow.up")+ }+ }}- ToolbarItem(placement: .primaryAction) {- Menu {- Button("Share") { shareTapped() }- Button("Export") { exportTapped() }- } label: {- Image(systemName: "square.and.arrow.up")+ } else {+ NavigationStack {+ VStack(spacing: 0) {+ content+ }+ .background(EnsuColor.backgroundBase)+ .navigationBarTitleDisplayMode(.inline)+ .toolbar {+ ToolbarItem(placement: .principal) {+ Text("Logs")+ .font(EnsuTypography.large)+ .foregroundStyle(EnsuColor.textPrimary)+ }+ ToolbarItem(placement: .cancellationAction) {+ Button("Close") { dismiss() }+ }+ ToolbarItem(placement: .primaryAction) {+ Menu {+ Button("Share") { shareTapped() }+ Button("Export") { exportTapped() }+ } label: {+ Image(systemName: "square.and.arrow.up")+ }+ }}}}@@ -163,3 +199,13 @@ private final class MacShareSheet: NSObject {}}#endif++#else+import SwiftUI++struct LogsView: View {+ var body: some View {+ Text("Logs unavailable")+ }+}+#endifdiff --git a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swiftindex e8635ca191..1549183bc5 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift@@ -1,32 +1,57 @@+#if canImport(EnteCore)import SwiftUI+import Foundationstruct SettingsView: View {- @Environment(\.dismiss) private var dismiss+ let isLoggedIn: Bool+ let email: String?+ let onSignOut: () -> Void+ let onSignIn: () -> Void- let onOpenModelSettings: () -> Void- let onOpenLogs: () -> Void+ @Environment(\.dismiss) private var dismiss+ @Environment(\.openURL) private var openURL@State private var query: String = ""var body: some View {NavigationStack {List {+ if let email, isLoggedIn, trimmedQuery.isEmpty {+ VStack(alignment: .leading, spacing: 4) {+ Text("Signed in as")+ .font(EnsuTypography.small)+ .foregroundStyle(EnsuColor.textMuted)+ Text(email)+ .font(EnsuTypography.body)+ .foregroundStyle(EnsuColor.textPrimary)+ .frame(maxWidth: .infinity, alignment: .leading)+ }+ .padding(EnsuSpacing.lg)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(EnsuColor.fillFaint)+ .clipShape(RoundedRectangle(cornerRadius: EnsuCornerRadius.card, style: .continuous))+ .listRowInsets(EdgeInsets(top: 0, leading: EnsuSpacing.lg, bottom: EnsuSpacing.md, trailing: EnsuSpacing.lg))+ .listRowBackground(EnsuColor.backgroundBase)+ }+ForEach(filteredItems) { item in- Button {- item.action()- dismiss()+ NavigationLink {+ item.destination} label: {- VStack(alignment: .leading, spacing: 4) {- Text(item.title)- .font(EnsuTypography.body)- .foregroundStyle(EnsuColor.textPrimary)- if let subtitle = item.subtitle {- Text(subtitle)- .font(EnsuTypography.small)- .foregroundStyle(EnsuColor.textMuted)- }- }- .padding(.vertical, 6)+ settingsRow(title: item.title, subtitle: item.subtitle)+ }+ }++ ForEach(filteredAccountItems) { item in+ Button(action: item.action) {+ settingsRow(title: item.title, subtitle: item.subtitle)+ }+ .buttonStyle(.plain)+ }++ if shouldShowSignInRow {+ Button(action: onSignIn) {+ settingsRow(title: signInTitle, subtitle: signInSubtitle)}.buttonStyle(.plain)}@@ -44,8 +69,13 @@ struct SettingsView: View {.scrollContentBackground(.hidden).background(EnsuColor.backgroundBase).searchable(text: $query, placement: .navigationBarDrawer(displayMode: .always))- .navigationTitle("Settings")+ .navigationBarTitleDisplayMode(.inline).toolbar {+ ToolbarItem(placement: .principal) {+ Text("Settings")+ .font(EnsuTypography.large)+ .foregroundStyle(EnsuColor.textPrimary)+ }ToolbarItem(placement: .primaryAction) {Button("Close") { dismiss() }}@@ -54,31 +84,58 @@ struct SettingsView: View {}private var filteredItems: [SettingsItem] {- let trimmed = query.trimmingCharacters(in: .whitespacesAndNewlines)- guard !trimmed.isEmpty else { return allItems }- let q = trimmed.lowercased()+ guard !trimmedQuery.isEmpty else { return allItems }+ let q = trimmedQuery.lowercased()return allItems.filter { item initem.title.lowercased().contains(q) || (item.subtitle?.lowercased().contains(q) == true)}}+ private var accountItems: [SettingsActionItem] {+ guard isLoggedIn else { return [] }+ return [+ SettingsActionItem(+ title: "Sign Out",+ subtitle: "Stop syncing this device",+ action: onSignOut+ ),+ SettingsActionItem(+ title: "Delete Account",+ subtitle: "Email support to delete your account",+ action: { openDeleteAccountEmail() }+ )+ ]+ }++ private var filteredAccountItems: [SettingsActionItem] {+ guard !trimmedQuery.isEmpty else { return accountItems }+ let q = trimmedQuery.lowercased()+ return accountItems.filter { item in+ item.title.lowercased().contains(q) || (item.subtitle?.lowercased().contains(q) == true)+ }+ }++ private var shouldShowSignInRow: Bool {+ guard !isLoggedIn else { return false }+ guard !trimmedQuery.isEmpty else { return true }+ let q = trimmedQuery.lowercased()+ return signInTitle.lowercased().contains(q) || signInSubtitle.lowercased().contains(q)+ }++ private var signInTitle: String { "Sign In to Backup" }+ private var signInSubtitle: String { "Sync your chats across devices" }+private var allItems: [SettingsItem] {[- SettingsItem(- title: "Model settings",- subtitle: "Model URL, mmproj, context length",- action: onOpenModelSettings- ),SettingsItem(title: "Logs",subtitle: "View, export, and share logs",- action: onOpenLogs+ destination: AnyView(LogsView(embeddedInNavigation: true)))]}private var endpointInfoText: String? {- let trimmedQuery = query.trimmingCharacters(in: .whitespacesAndNewlines)guard trimmedQuery.isEmpty else { return nil }let defaultEndpoint = "https://api.ente.io"@@ -89,11 +146,65 @@ struct SettingsView: View {guard !endpoint.isEmpty, endpoint != defaultEndpoint else { return nil }return "Endpoint: \(endpoint)"}++ private var trimmedQuery: String {+ query.trimmingCharacters(in: .whitespacesAndNewlines)+ }++ private func openDeleteAccountEmail() {+ let subject = "Request Deletion for Ente Account"+ let encoded = subject.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? subject+ guard let url = URL(string: "mailto:[email protected]?subject=\(encoded)") else { return }+ openURL(url)+ }++ private func settingsRow(title: String, subtitle: String?) -> some View {+ HStack {+ VStack(alignment: .leading, spacing: 4) {+ Text(title)+ .font(EnsuTypography.body)+ .foregroundStyle(EnsuColor.textPrimary)+ if let subtitle {+ Text(subtitle)+ .font(EnsuTypography.small)+ .foregroundStyle(EnsuColor.textMuted)+ }+ }+ Spacer()+ Image("ArrowRight01Icon")+ .resizable()+ .scaledToFit()+ .frame(width: 18, height: 18)+ .foregroundStyle(EnsuColor.textMuted)+ }+ .padding(.vertical, 6)+ }}private struct SettingsItem: Identifiable {+ let id = UUID()+ let title: String+ let subtitle: String?+ let destination: AnyView+}++private struct SettingsActionItem: Identifiable {let id = UUID()let title: Stringlet subtitle: String?let action: () -> Void}+#else+import SwiftUI++struct SettingsView: View {+ let isLoggedIn: Bool+ let email: String?+ let onSignOut: () -> Void+ let onSignIn: () -> Void++ var body: some View {+ Text("Settings unavailable")+ }+}+#endif