Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

update icon and animation + haptic

Prateek Sunal9706ca9cbd1b
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/AndroidManifest.xml b/mobile/native/android/apps/ensu/app-ui/src/main/AndroidManifest.xml
index f2b17bf0e9..aee8a484e4 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/AndroidManifest.xml
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/AndroidManifest.xml
@@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.VIBRATE" />
<application
android:label="@string/app_name"
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 c7e81f444e..a932d73df1 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
@@ -32,6 +32,7 @@ import androidx.compose.animation.slideOutHorizontally
import androidx.compose.animation.core.tween
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
+import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
@@ -78,6 +79,7 @@ import io.ente.ensu.components.EnsuLogo
import io.ente.ensu.data.auth.EnsuAuthService
import io.ente.ensu.data.logging.FileLogRepository
import io.ente.ensu.designsystem.EnsuColor
+import io.ente.ensu.designsystem.EnsuCornerRadius
import io.ente.ensu.designsystem.HugeIcons
import io.ente.ensu.designsystem.EnsuSpacing
import io.ente.ensu.designsystem.EnsuTypography
@@ -92,6 +94,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
import kotlinx.coroutines.launch
import java.io.File
@@ -122,11 +125,20 @@ fun HomeView(
var showAttachmentDownloads by remember { mutableStateOf(false) }
var deleteSessionTarget by remember { mutableStateOf<io.ente.ensu.domain.model.ChatSession?>(null) }
var showLogShareDialog by remember { mutableStateOf(false) }
+ var showSignInComingSoon by remember { mutableStateOf(false) }
var developerTapCount by remember { mutableStateOf(0) }
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 handleDeveloperTap: () -> Unit = handle@{
// Don't allow switching endpoints for logged-in users.
if (appState.auth.isLoggedIn) return@handle
@@ -273,7 +285,7 @@ fun HomeView(
modelDownloadStatus = appState.chat.downloadStatus,
modelDownloadPercent = appState.chat.downloadPercent,
onOpenDrawer = { scope.launch { drawerState.open() } },
- onSignIn = { isShowingAuth = true },
+ onSignIn = handleSignInRequest,
onAttachmentDownloads = { showAttachmentDownloads = true }
)
androidx.compose.material3.HorizontalDivider(color = EnsuColor.border())
@@ -359,7 +371,7 @@ fun HomeView(
userEmail = appState.auth.email,
onOpenLogs = { navController.navigate(HomeRoute.Logs) },
onSignOut = { isShowingSignOutDialog = true },
- onSignIn = { isShowingAuth = true },
+ onSignIn = handleSignInRequest,
onDeleteAccount = { openDeleteAccountEmail(context) }
)
}
@@ -482,6 +494,14 @@ fun HomeView(
)
}
+ if (showSignInComingSoon) {
+ ComingSoonDialog(
+ title = "Sign in",
+ message = "Coming soon",
+ onDismiss = { showSignInComingSoon = false }
+ )
+ }
+
if (showAttachmentDownloads) {
AttachmentDownloadsDialog(
downloads = appState.chat.attachmentDownloads,
@@ -735,6 +755,46 @@ private fun ModelProgressIndicator(
}
}
+@Composable
+private fun ComingSoonDialog(
+ title: String,
+ message: String,
+ onDismiss: () -> Unit
+) {
+ AlertDialog(
+ onDismissRequest = onDismiss,
+ title = {
+ Text(text = title, style = EnsuTypography.h3Bold)
+ },
+ text = {
+ Column(verticalArrangement = Arrangement.spacedBy(EnsuSpacing.md.dp)) {
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(140.dp)
+ .background(
+ EnsuColor.fillFaint(),
+ RoundedCornerShape(EnsuCornerRadius.card.dp)
+ ),
+ contentAlignment = Alignment.Center
+ ) {
+ Text(text = "Illustration", style = EnsuTypography.small, color = EnsuColor.textMuted())
+ }
+ Text(text = message, style = EnsuTypography.body, color = EnsuColor.textMuted())
+ }
+ },
+ confirmButton = {
+ TextButton(
+ onClick = onDismiss,
+ colors = ButtonDefaults.textButtonColors(contentColor = EnsuColor.textPrimary())
+ ) {
+ Text(text = "Got it")
+ }
+ },
+ containerColor = EnsuColor.backgroundBase()
+ )
+}
+
@Composable
private fun AttachmentDownloadsDialog(
downloads: List<AttachmentDownloadItem>,
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.kt
index abd68c803a..71d920a455 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,5 +1,16 @@
package io.ente.ensu.chat
+import androidx.compose.animation.AnimatedContent
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.slideInVertically
+import androidx.compose.animation.slideOutVertically
+import androidx.compose.animation.togetherWith
+import androidx.compose.animation.core.FastOutSlowInEasing
+import androidx.compose.animation.core.Spring
+import androidx.compose.animation.core.spring
+import androidx.compose.animation.core.tween
+import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.gestures.detectTapGestures
@@ -64,7 +75,6 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalFocusManager
-import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.material3.Surface
import androidx.compose.ui.text.AnnotatedString
@@ -83,6 +93,8 @@ import io.ente.ensu.designsystem.HugeIcons
import io.ente.ensu.designsystem.EnsuSpacing
import io.ente.ensu.designsystem.EnsuTypography
import io.ente.ensu.domain.model.Attachment
+import io.ente.ensu.utils.EnsuFeatureFlags
+import io.ente.ensu.utils.rememberEnsuHaptics
import io.ente.ensu.domain.model.AttachmentType
import io.ente.ensu.domain.model.ChatMessage
import io.ente.ensu.domain.model.MessageAuthor
@@ -160,60 +172,79 @@ fun ChatView(
}
}
- Box(modifier = Modifier.fillMaxSize()) {
- Column(modifier = Modifier.fillMaxSize().imePadding()) {
- MessageList(
- modifier = Modifier
- .weight(1f)
- .padding(
- start = EnsuSpacing.pageHorizontal.dp,
- end = EnsuSpacing.pageHorizontal.dp
- ),
- messages = chatState.messages,
- streamingResponse = chatState.streamingResponse,
- streamingParentId = chatState.streamingParentId,
- isGenerating = chatState.isGenerating,
- isModelDownloaded = chatState.isModelDownloaded,
- isDownloading = chatState.isDownloading,
- downloadPercent = chatState.downloadPercent,
- downloadStatus = chatState.downloadStatus,
- modelDownloadSizeBytes = chatState.modelDownloadSizeBytes,
- branchSelections = chatState.branchSelections,
- imePadding = imePadding,
- onEditMessage = onEditMessage,
- onRetryMessage = onRetryMessage,
- onBranchChange = onBranchChange,
- onOpenAttachment = onOpenAttachment,
- onStartDownload = onStartDownload
- )
+ val sessionKey = chatState.currentSessionId ?: "new-session"
- val editingMessage = chatState.editingMessageId?.let { editingId ->
- chatState.messages.firstOrNull { it.id == editingId }
- }
-
- if (!showDownloadOnboarding) {
- MessageInput(
+ Box(modifier = Modifier.fillMaxSize()) {
+ AnimatedContent(
+ targetState = sessionKey,
+ modifier = Modifier
+ .fillMaxSize()
+ .imePadding(),
+ transitionSpec = {
+ val enter = fadeIn(animationSpec = tween(220, easing = FastOutSlowInEasing)) +
+ slideInVertically(
+ animationSpec = tween(220, easing = FastOutSlowInEasing)
+ ) { it / 14 }
+ val exit = fadeOut(animationSpec = tween(180)) +
+ slideOutVertically(animationSpec = tween(180)) { -it / 14 }
+ enter.togetherWith(exit)
+ },
+ label = "session-change"
+ ) {
+ Column(modifier = Modifier.fillMaxSize()) {
+ MessageList(
modifier = Modifier
- .fillMaxWidth()
- .navigationBarsPadding()
- .background(EnsuColor.backgroundBase()),
- messageText = chatState.messageText,
- attachments = chatState.attachments,
- editingMessage = editingMessage,
- isProcessingAttachments = chatState.isProcessingAttachments,
+ .weight(1f)
+ .padding(
+ start = EnsuSpacing.pageHorizontal.dp,
+ end = EnsuSpacing.pageHorizontal.dp
+ ),
+ messages = chatState.messages,
+ streamingResponse = chatState.streamingResponse,
+ streamingParentId = chatState.streamingParentId,
isGenerating = chatState.isGenerating,
+ isModelDownloaded = chatState.isModelDownloaded,
isDownloading = chatState.isDownloading,
downloadPercent = chatState.downloadPercent,
- isAttachmentDownloadBlocked = chatState.isAttachmentDownloadBlocked,
- attachmentDownloadPercent = chatState.attachmentDownloadProgress,
- onMessageChange = onMessageChange,
- onSend = onSend,
- onStop = onStop,
- onAttachmentSelected = onAttachmentSelected,
- onRemoveAttachment = onRemoveAttachment,
- onCancelEdit = onCancelEdit,
- focusRequestId = focusRequestId
+ downloadStatus = chatState.downloadStatus,
+ modelDownloadSizeBytes = chatState.modelDownloadSizeBytes,
+ branchSelections = chatState.branchSelections,
+ imePadding = imePadding,
+ onEditMessage = onEditMessage,
+ onRetryMessage = onRetryMessage,
+ onBranchChange = onBranchChange,
+ onOpenAttachment = onOpenAttachment,
+ onStartDownload = onStartDownload
)
+
+ val editingMessage = chatState.editingMessageId?.let { editingId ->
+ chatState.messages.firstOrNull { it.id == editingId }
+ }
+
+ if (!showDownloadOnboarding) {
+ MessageInput(
+ modifier = Modifier
+ .fillMaxWidth()
+ .navigationBarsPadding()
+ .background(EnsuColor.backgroundBase()),
+ messageText = chatState.messageText,
+ attachments = chatState.attachments,
+ editingMessage = editingMessage,
+ isProcessingAttachments = chatState.isProcessingAttachments,
+ isGenerating = chatState.isGenerating,
+ isDownloading = chatState.isDownloading,
+ downloadPercent = chatState.downloadPercent,
+ isAttachmentDownloadBlocked = chatState.isAttachmentDownloadBlocked,
+ attachmentDownloadPercent = chatState.attachmentDownloadProgress,
+ onMessageChange = onMessageChange,
+ onSend = onSend,
+ onStop = onStop,
+ onAttachmentSelected = onAttachmentSelected,
+ onRemoveAttachment = onRemoveAttachment,
+ onCancelEdit = onCancelEdit,
+ focusRequestId = focusRequestId
+ )
+ }
}
}
@@ -275,7 +306,7 @@ private fun MessageList(
}
val listState = rememberLazyListState()
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
var autoScrollEnabled by remember { mutableStateOf(true) }
var lastHapticLength by remember { mutableStateOf(0) }
var shouldJumpToBottomOnLoad by remember { mutableStateOf(true) }
@@ -328,7 +359,7 @@ private fun MessageList(
if (!isGenerating) return@LaunchedEffect
val length = streamingResponse.length
if (length > lastHapticLength) {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
lastHapticLength = length
}
}
@@ -337,7 +368,11 @@ private fun MessageList(
if (!autoScrollEnabled) return@LaunchedEffect
val targetIndex = messages.size
if (targetIndex >= 0) {
- listState.animateScrollToItem(targetIndex)
+ if (isGenerating) {
+ listState.animateScrollToItem(targetIndex)
+ } else {
+ listState.scrollToItem(targetIndex)
+ }
}
}
@@ -366,34 +401,39 @@ private fun MessageList(
verticalArrangement = Arrangement.spacedBy(EnsuSpacing.lg.dp)
) {
items(messages, key = { it.id }) { message ->
- when (message.author) {
- MessageAuthor.User -> {
- UserMessageBubble(
- message = message,
- branchSelections = branchSelections,
- onEdit = { onEditMessage(message) },
- onBranchChange = onBranchChange,
- onOpenAttachment = onOpenAttachment
- )
- }
- MessageAuthor.Assistant -> {
- AssistantMessageBubble(
- message = message,
- branchSelections = branchSelections,
- onRetry = { onRetryMessage(message) },
- onBranchChange = onBranchChange
- )
+ Column(
+ modifier = Modifier
+ .fillMaxWidth()
+ ) {
+ when (message.author) {
+ MessageAuthor.User -> {
+ UserMessageBubble(
+ message = message,
+ branchSelections = branchSelections,
+ onEdit = { onEditMessage(message) },
+ onBranchChange = onBranchChange,
+ onOpenAttachment = onOpenAttachment
+ )
+ }
+ MessageAuthor.Assistant -> {
+ AssistantMessageBubble(
+ message = message,
+ branchSelections = branchSelections,
+ onRetry = { onRetryMessage(message) },
+ onBranchChange = onBranchChange
+ )
+ }
}
- }
- if (isGenerating && streamingParentId == message.id) {
- Spacer(modifier = Modifier.height(EnsuSpacing.sm.dp))
- StreamingMessageBubble(text = streamingResponse)
+ if (isGenerating && streamingParentId == message.id) {
+ Spacer(modifier = Modifier.height(EnsuSpacing.sm.dp))
+ StreamingMessageBubble(text = streamingResponse)
+ }
}
}
if (isGenerating && streamingParentId == null) {
- items(1) {
+ item(key = "streaming") {
StreamingMessageBubble(text = streamingResponse)
}
}
@@ -443,7 +483,7 @@ private fun DownloadOnboarding(
modelDownloadSizeBytes: Long?,
onDownload: () -> Unit
) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
val sizeText = modelDownloadSizeBytes?.let { "Approx. ${formatBytes(it)}" } ?: "Approx. size varies by model"
Box(
modifier = modifier.fillMaxSize(),
@@ -496,7 +536,7 @@ private fun DownloadOnboarding(
} else {
Button(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onDownload()
},
shape = RoundedCornerShape(EnsuCornerRadius.button.dp),
@@ -525,7 +565,7 @@ private fun UserMessageBubble(
onOpenAttachment: (Attachment) -> Unit
) {
val clipboard = LocalClipboardManager.current
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
var showMenu by remember { mutableStateOf(false) }
var pressOffset by remember { mutableStateOf(Offset.Zero) }
val bubbleShape = RoundedCornerShape(18.dp)
@@ -563,7 +603,7 @@ private fun UserMessageBubble(
.pointerInput(Unit) {
detectTapGestures(
onLongPress = { offset ->
- haptic.performHapticFeedback(HapticFeedbackType.LongPress)
+ haptic.perform(HapticFeedbackType.LongPress)
pressOffset = offset
showMenu = true
}
@@ -585,11 +625,11 @@ private fun UserMessageBubble(
onDismiss = { showMenu = false },
actions = listOf(
MessageAction("Edit", HugeIcons.Edit01Icon) {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onEdit()
},
MessageAction("Copy", HugeIcons.Copy01Icon) {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
clipboard.setText(AnnotatedString(message.text))
}
)
@@ -628,7 +668,7 @@ private fun AssistantMessageBubble(
onBranchChange: (String, Int) -> Unit
) {
val clipboard = LocalClipboardManager.current
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
var showMenu by remember { mutableStateOf(false) }
var pressOffset by remember { mutableStateOf(Offset.Zero) }
Column(
@@ -641,7 +681,7 @@ private fun AssistantMessageBubble(
.pointerInput(Unit) {
detectTapGestures(
onLongPress = { offset ->
- haptic.performHapticFeedback(HapticFeedbackType.LongPress)
+ haptic.perform(HapticFeedbackType.LongPress)
pressOffset = offset
showMenu = true
}
@@ -667,11 +707,11 @@ private fun AssistantMessageBubble(
onDismiss = { showMenu = false },
actions = listOf(
MessageAction("Copy", HugeIcons.Copy01Icon) {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
clipboard.setText(AnnotatedString(message.text))
},
MessageAction("Retry", HugeIcons.RepeatIcon) {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onRetry()
}
)
@@ -764,17 +804,39 @@ private fun MessageActionsMenu(
@Composable
private fun StreamingMessageBubble(text: String) {
+ var showCursor by remember { mutableStateOf(true) }
+ val shouldBlink = text.isNotBlank()
+
+ LaunchedEffect(shouldBlink) {
+ if (!shouldBlink) {
+ showCursor = true
+ return@LaunchedEffect
+ }
+ while (true) {
+ delay(520)
+ showCursor = !showCursor
+ }
+ }
+
Column(
modifier = Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.Start
) {
Column(
- modifier = Modifier.padding(horizontal = EnsuSpacing.sm.dp, vertical = EnsuSpacing.md.dp)
+ modifier = Modifier
+ .animateContentSize(
+ animationSpec = spring(
+ dampingRatio = 0.9f,
+ stiffness = Spring.StiffnessMediumLow
+ )
+ )
+ .padding(horizontal = EnsuSpacing.sm.dp, vertical = EnsuSpacing.md.dp)
) {
if (text.isBlank()) {
LoadingDotsText()
} else {
- MarkdownView(markdown = text, enableSelection = false)
+ val displayText = if (showCursor) "$text▍" else text
+ MarkdownView(markdown = displayText, enableSelection = false)
}
}
}
@@ -795,7 +857,7 @@ private fun LoadingDotsText() {
Text(
text = phrase + ".".repeat(dotCount),
style = EnsuTypography.message,
- color = EnsuColor.textMuted()
+ color = EnsuColor.textPrimary()
)
}
@@ -844,7 +906,7 @@ private fun DownloadToastOverlay(
isLoading: Boolean,
onCancel: () -> Unit
) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
Box(
modifier = Modifier
.fillMaxWidth()
@@ -865,7 +927,7 @@ private fun DownloadToastOverlay(
Spacer(modifier = Modifier.weight(1f))
IconButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.LongPress)
+ haptic.perform(HapticFeedbackType.LongPress)
onCancel()
},
modifier = Modifier.size(28.dp)
@@ -913,7 +975,7 @@ private fun TimestampText(timestampMillis: Long) {
@Composable
private fun EditBanner(message: ChatMessage, onCancelEdit: () -> Unit) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
Row(
modifier = Modifier
.fillMaxWidth()
@@ -956,7 +1018,7 @@ private fun EditBanner(message: ChatMessage, onCancelEdit: () -> Unit) {
)
IconButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onCancelEdit()
},
modifier = Modifier.size(24.dp)
@@ -992,7 +1054,7 @@ private fun MessageInput(
onCancelEdit: () -> Unit,
focusRequestId: Int
) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
val placeholder = when {
isAttachmentDownloadBlocked -> {
val percent = attachmentDownloadPercent?.let { " ($it%)" } ?: ""
@@ -1099,10 +1161,10 @@ private fun MessageInput(
Spacer(modifier = Modifier.width(EnsuSpacing.sm.dp))
- if (editingMessage == null) {
+ if (EnsuFeatureFlags.enableImageUploads && editingMessage == null) {
IconButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onAttachmentSelected(AttachmentType.Image)
},
enabled = !isGenerating && !isDownloading && !isAttachmentDownloadBlocked,
@@ -1121,10 +1183,10 @@ private fun MessageInput(
IconButton(
onClick = {
if (isGenerating) {
- haptic.performHapticFeedback(HapticFeedbackType.LongPress)
+ haptic.perform(HapticFeedbackType.LongPress)
onStop()
} else {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onSend()
}
},
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/ActionButtons.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/ActionButtons.kt
index e12fe4b680..c39d8694a1 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/ActionButtons.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/ActionButtons.kt
@@ -11,11 +11,11 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
-import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import io.ente.ensu.designsystem.EnsuColor
import io.ente.ensu.designsystem.EnsuTypography
+import io.ente.ensu.utils.rememberEnsuHaptics
@Composable
fun ActionButton(
@@ -24,10 +24,10 @@ fun ActionButton(
contentDescription: String,
color: Color = EnsuColor.textMuted()
) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
IconButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onTap()
},
modifier = Modifier.size(36.dp),
@@ -48,10 +48,10 @@ fun ActionButton(
contentDescription: String,
color: Color = EnsuColor.textMuted()
) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
IconButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onTap()
},
modifier = Modifier.size(36.dp),
@@ -70,9 +70,9 @@ fun TextActionButton(
text: String,
onTap: () -> Unit
) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
TextButton(onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onTap()
}) {
Text(text = text, style = EnsuTypography.small, color = EnsuColor.textMuted())
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/AttachmentChip.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/AttachmentChip.kt
index 9d2e77a18b..1cb175001f 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/AttachmentChip.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/AttachmentChip.kt
@@ -19,7 +19,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
-import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@@ -28,6 +27,7 @@ import io.ente.ensu.designsystem.EnsuCornerRadius
import io.ente.ensu.designsystem.HugeIcons
import io.ente.ensu.designsystem.EnsuSpacing
import io.ente.ensu.designsystem.EnsuTypography
+import io.ente.ensu.utils.rememberEnsuHaptics
@Composable
fun AttachmentChip(
@@ -38,10 +38,10 @@ fun AttachmentChip(
onDelete: (() -> Unit)? = null,
onClick: (() -> Unit)? = null
) {
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
val clickModifier = if (onClick != null) {
Modifier.clickable {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onClick()
}
} else {
@@ -93,7 +93,7 @@ fun AttachmentChip(
Spacer(modifier = Modifier.width(EnsuSpacing.xs.dp))
IconButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.LongPress)
+ haptic.perform(HapticFeedbackType.LongPress)
onDelete()
},
modifier = Modifier.size(24.dp)
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/BranchSwitcher.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/BranchSwitcher.kt
index 34b0cd71c6..a17e8ae415 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/BranchSwitcher.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/components/BranchSwitcher.kt
@@ -11,10 +11,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
-import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.unit.dp
import io.ente.ensu.designsystem.EnsuColor
import io.ente.ensu.designsystem.EnsuTypography
+import io.ente.ensu.utils.rememberEnsuHaptics
@Composable
fun BranchSwitcher(
@@ -25,11 +25,11 @@ fun BranchSwitcher(
) {
if (totalCount <= 1) return
- val haptic = LocalHapticFeedback.current
+ val haptic = rememberEnsuHaptics()
Row(verticalAlignment = Alignment.CenterVertically) {
TextButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onPrevious()
},
enabled = currentIndex > 1,
@@ -47,7 +47,7 @@ fun BranchSwitcher(
Spacer(modifier = Modifier.width(4.dp))
TextButton(
onClick = {
- haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
+ haptic.perform(HapticFeedbackType.TextHandleMove)
onNext()
},
enabled = currentIndex < totalCount,
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
new file mode 100644
index 0000000000..9a3e12a7b6
--- /dev/null
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/FeatureFlags.kt
@@ -0,0 +1,6 @@
+package io.ente.ensu.utils
+
+object EnsuFeatureFlags {
+ const val enableSignIn = false
+ const val enableImageUploads = true
+}
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/Haptics.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/Haptics.kt
new file mode 100644
index 0000000000..8e7940023a
--- /dev/null
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/utils/Haptics.kt
@@ -0,0 +1,109 @@
+package io.ente.ensu.utils
+
+import android.content.Context
+import android.os.Build
+import android.os.VibrationEffect
+import android.os.Vibrator
+import android.os.VibratorManager
+import android.provider.Settings
+import android.view.HapticFeedbackConstants
+import android.view.View
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.remember
+import androidx.compose.ui.hapticfeedback.HapticFeedbackType
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalView
+
+class EnsuHaptics(
+ private val context: Context,
+ private val view: View?
+) {
+ fun perform(type: HapticFeedbackType) {
+ if (!isHapticsEnabled(context)) return
+
+ if (shouldForceVibrationFallback()) {
+ vibrate(type)
+ return
+ }
+
+ val performed = view?.performHapticFeedback(mapToHapticConstant(type)) ?: false
+ if (!performed) {
+ vibrate(type)
+ }
+ }
+
+ private fun shouldForceVibrationFallback(): Boolean {
+ val manufacturer = Build.MANUFACTURER?.lowercase().orEmpty()
+ val brand = Build.BRAND?.lowercase().orEmpty()
+ return manufacturer.contains("nothing") || brand.contains("nothing")
+ }
+
+ private fun mapToHapticConstant(type: HapticFeedbackType): Int {
+ return when (type) {
+ HapticFeedbackType.LongPress -> HapticFeedbackConstants.LONG_PRESS
+ HapticFeedbackType.TextHandleMove -> {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
+ HapticFeedbackConstants.TEXT_HANDLE_MOVE
+ } else {
+ HapticFeedbackConstants.KEYBOARD_TAP
+ }
+ }
+ else -> HapticFeedbackConstants.KEYBOARD_TAP
+ }
+ }
+
+ private fun vibrate(type: HapticFeedbackType) {
+ val vibrator = getVibrator() ?: return
+ if (!vibrator.hasVibrator()) return
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ val effect = when (type) {
+ HapticFeedbackType.LongPress -> VibrationEffect.EFFECT_HEAVY_CLICK
+ HapticFeedbackType.TextHandleMove -> VibrationEffect.EFFECT_TICK
+ else -> VibrationEffect.EFFECT_TICK
+ }
+ vibrator.vibrate(VibrationEffect.createPredefined(effect))
+ return
+ }
+
+ val (duration, amplitude) = when (type) {
+ HapticFeedbackType.LongPress -> 40L to 180
+ HapticFeedbackType.TextHandleMove -> 10L to 60
+ else -> 10L to 60
+ }
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ vibrator.vibrate(VibrationEffect.createOneShot(duration, amplitude))
+ } else {
+ @Suppress("DEPRECATION")
+ vibrator.vibrate(duration)
+ }
+ }
+
+ private fun getVibrator(): Vibrator? {
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ val manager = context.getSystemService(VibratorManager::class.java)
+ manager?.defaultVibrator
+ } else {
+ @Suppress("DEPRECATION")
+ context.getSystemService(Context.VIBRATOR_SERVICE) as? Vibrator
+ }
+ }
+
+ private fun isHapticsEnabled(context: Context): Boolean {
+ return try {
+ Settings.System.getInt(context.contentResolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) == 1
+ } catch (_: Throwable) {
+ true
+ }
+ }
+}
+
+@Composable
+fun rememberEnsuHaptics(): EnsuHaptics {
+ val context = LocalContext.current
+ val view = LocalView.current
+ return remember(context, view) {
+ EnsuHaptics(context, view)
+ }
+}
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/drawable/ic_launcher_foreground.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/drawable/ic_launcher_foreground.png
index 65a2f3dd6d..90b6f72908 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/drawable/ic_launcher_foreground.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/drawable/ic_launcher_foreground.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher.png
index 1376c79c67..9f9d82eff7 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher_round.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher_round.png
index 1376c79c67..9f9d82eff7 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher.png
index 8c9cd95b35..70a0e30513 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher_round.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher_round.png
index 5bbd1a3aae..70a0e30513 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher.png
index 400b56145d..fc1e5e0797 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher_round.png
index 400b56145d..fc1e5e0797 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher.png
index e89de9975c..6783d79022 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
index e89de9975c..6783d79022 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 041b9bc5cb..96a81a1542 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
index 041b9bc5cb..96a81a1542 100644
Binary files a/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/mobile/native/android/apps/ensu/app-ui/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/res/values/colors.xml b/mobile/native/android/apps/ensu/app-ui/src/main/res/values/colors.xml
index ff2283b833..45f39022fb 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/res/values/colors.xml
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/res/values/colors.xml
@@ -1,3 +1,3 @@
<resources>
- <color name="ic_launcher_background">#343434</color>
+ <color name="ic_launcher_background">#FFEEDD</color>
</resources>
diff --git a/mobile/native/android/apps/ensu/docs/appicon.md b/mobile/native/android/apps/ensu/docs/appicon.md
new file mode 100644
index 0000000000..664e5982fc
--- /dev/null
+++ b/mobile/native/android/apps/ensu/docs/appicon.md
@@ -0,0 +1,45 @@
+# Updating the Android app icon
+
+This project uses an **adaptive icon** with a foreground PNG plus a solid background color.
+The foreground must be padded so it fits inside circular/squircle masks without clipping.
+
+## Sources
+- **Foreground artwork**: provided by design (transparent PNG, 1024×1024).
+- **Background color**: currently `#FFEEDD` (see `res/values/colors.xml`).
+
+## Steps
+
+1. **Prepare the foreground**
+ - Use the provided foreground PNG (transparent background).
+ - Center the artwork on a square canvas and add **extra padding**.
+ - Current safe-zone scale is **0.50** (content ~50% of canvas width).
+ - This ensures the icon doesn’t clip in adaptive masks.
+
+2. **Generate Android assets**
+ - Adaptive foreground: `res/drawable/ic_launcher_foreground.png` (432×432).
+ - Legacy icons (with background color):
+ - `res/mipmap-mdpi/ic_launcher.png` (48×48)
+ - `res/mipmap-hdpi/ic_launcher.png` (72×72)
+ - `res/mipmap-xhdpi/ic_launcher.png` (96×96)
+ - `res/mipmap-xxhdpi/ic_launcher.png` (144×144)
+ - `res/mipmap-xxxhdpi/ic_launcher.png` (192×192)
+ - Also update `ic_launcher_round.png` in each mipmap folder with the same image.
+
+3. **Set the adaptive background color**
+ - Update `res/values/colors.xml`:
+ ```xml
+ <color name="ic_launcher_background">#FFEEDD</color>
+ ```
+ - Adaptive icon XMLs already reference this color:
+ - `res/mipmap-anydpi-v26/ic_launcher.xml`
+ - `res/mipmap-anydpi-v26/ic_launcher_round.xml`
+
+4. **Verify**
+ - Install on a device and check the icon under:
+ - Circle mask
+ - Squircle mask
+ - Themed launcher
+
+## Notes
+- If the icon still clips in circular masks, reduce the foreground safe-zone scale (e.g., 0.45).
+- Keep the artwork centered when adjusting padding.
diff --git a/mobile/native/darwin/Apps/ensu/docs/appicon.md b/mobile/native/darwin/Apps/ensu/docs/appicon.md
new file mode 100644
index 0000000000..28ba89f4ae
--- /dev/null
+++ b/mobile/native/darwin/Apps/ensu/docs/appicon.md
@@ -0,0 +1,36 @@
+# Updating the iOS app icon
+
+The iOS app icon uses a 1024×1024 foreground image centered on a square canvas.
+**Do not add extra padding or scaling**—use the foreground artwork as-is.
+
+## Sources
+- **Foreground artwork**: provided by design (transparent PNG, 1024×1024).
+- **Backgrounds**:
+ - Any (default): `#FFEEDD`
+ - Dark: **transparent** (so the system dark gradient can show)
+ - Tinted: **white** (so tinting behaves correctly)
+
+## Assets to update
+Update the files inside:
+```
+mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset
+```
+
+Required files:
+- `IconOGAny.png` (foreground on #FFEEDD)
+- `IconOGDark.png` (foreground on transparent background)
+- `IconOGTinted.png` (foreground on white background)
+
+## Steps
+1. Open the provided foreground PNG and keep it at **1024×1024**.
+2. Center the foreground on a 1024×1024 canvas.
+3. Export three variants:
+ - **Any**: background `#FFEEDD`
+ - **Dark**: transparent background
+ - **Tinted**: background `#FFFFFF`
+4. Replace the corresponding files in `AppIcon.appiconset`.
+5. Rebuild the app in Xcode to refresh the asset catalog.
+
+## Notes
+- Do **not** add extra padding for iOS; the foreground sizing is already correct.
+- If the artwork is delivered at a different size, scale it to **1024×1024** first and keep it centered.
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGAny.png b/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGAny.png
index 18e14a4761..f3088a6efe 100644
Binary files a/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGAny.png and b/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGAny.png differ
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGDark.png b/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGDark.png
index 18e14a4761..0d25323b56 100644
Binary files a/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGDark.png and b/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGDark.png differ
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGTinted.png b/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGTinted.png
index 18e14a4761..9291055d93 100644
Binary files a/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGTinted.png and b/mobile/native/darwin/Apps/ensu/ensu/Assets.xcassets/AppIcon.appiconset/IconOGTinted.png differ
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
index 79da281779..d31d42a63e 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
@@ -19,11 +19,13 @@ struct ChatView: View {
@State private var showDeveloperAlert = false
@State private var showDeveloperSettings = false
@State private var showAttachmentDownloads = false
+ @State private var showSignInComingSoon = false
@State private var didAutoFocusInput = false
@FocusState private var isInputFocused: Bool
@State private var inputBarHeight: CGFloat = 0
@State private var wasDrawerOpen = false
@State private var didDismissKeyboard = false
+ @State private var sessionTransitionId = UUID()
private var editingMessage: ChatMessage? {
guard let editingId = viewModel.editingMessageId else { return nil }
@@ -150,10 +152,7 @@ struct ChatView: View {
isDrawerOpen = false
},
onSignIn: {
- showSettings = false
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) {
- isShowingAuth = true
- }
+ handleSignInRequest()
}
)
}
@@ -171,6 +170,11 @@ struct ChatView: View {
onDismiss: { showAttachmentDownloads = false }
)
}
+ .sheet(isPresented: $showSignInComingSoon) {
+ ComingSoonSheet(title: "Sign in", message: "Coming soon") {
+ showSignInComingSoon = false
+ }
+ }
.platformFullScreenCover(isPresented: $showDeveloperSettings) {
DeveloperSettingsView { message in
showToast(message, duration: 2)
@@ -217,7 +221,9 @@ struct ChatView: View {
attachmentDownloadSummary: viewModel.attachmentDownloadSummary,
modelDownloadState: viewModel.downloadToast,
onMenu: { isDrawerOpen.toggle() },
- onSignIn: { isShowingAuth = true },
+ onSignIn: {
+ handleSignInRequest()
+ },
onAttachmentDownloads: {
showAttachmentDownloads = true
}
@@ -226,6 +232,11 @@ struct ChatView: View {
Divider()
.background(EnsuColor.border)
+ let sessionTransition = AnyTransition.asymmetric(
+ insertion: .move(edge: .bottom).combined(with: .opacity),
+ removal: .move(edge: .top).combined(with: .opacity)
+ )
+
ZStack(alignment: .top) {
let shouldShowDownloadOnboarding = !viewModel.isModelDownloaded
@@ -322,6 +333,8 @@ struct ChatView: View {
}
}
}
+ .id(sessionTransitionId)
+ .transition(sessionTransition)
.onAppear {
viewModel.autoStartModelDownloadIfNeeded()
}
@@ -343,8 +356,14 @@ struct ChatView: View {
.background(EnsuColor.backgroundBase)
}
}
+ .animation(.easeOut(duration: 0.25), value: sessionTransitionId)
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
+ .onChange(of: viewModel.currentSessionId) { _ in
+ withAnimation(.easeOut(duration: 0.25)) {
+ sessionTransitionId = UUID()
+ }
+ }
}
@ViewBuilder
@@ -404,6 +423,14 @@ struct ChatView: View {
}
}
+ private func handleSignInRequest() {
+ if EnsuFeatureFlags.enableSignIn {
+ isShowingAuth = true
+ } else {
+ showSignInComingSoon = true
+ }
+ }
+
private func handleDeveloperTap() {
// Don't allow switching endpoints for logged-in users.
guard !appState.isLoggedIn else { return }
@@ -515,6 +542,43 @@ private struct ToastMessage: Identifiable {
let text: String
}
+private struct ComingSoonSheet: View {
+ let title: String
+ let message: String
+ let onDismiss: () -> Void
+
+ var body: some View {
+ VStack(spacing: EnsuSpacing.lg) {
+ RoundedRectangle(cornerRadius: EnsuCornerRadius.card, style: .continuous)
+ .fill(EnsuColor.fillFaint)
+ .frame(height: 180)
+ .overlay(
+ Text("Illustration")
+ .font(EnsuTypography.small)
+ .foregroundStyle(EnsuColor.textMuted)
+ )
+
+ Text(title)
+ .font(EnsuTypography.large)
+ .foregroundStyle(EnsuColor.textPrimary)
+
+ Text(message)
+ .font(EnsuTypography.body)
+ .foregroundStyle(EnsuColor.textMuted)
+ .multilineTextAlignment(.center)
+
+ Button("Got it") {
+ onDismiss()
+ }
+ .buttonStyle(.borderedProminent)
+ .tint(EnsuColor.accent)
+ }
+ .padding(EnsuSpacing.xl)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background(EnsuColor.backgroundBase)
+ }
+}
+
private struct AttachmentDownloadsSheet: View {
let downloads: [AttachmentDownloadItem]
let sessionTitle: (UUID) -> String
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift
index 173d0ef9da..ac380c16e1 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift
@@ -116,7 +116,7 @@ struct MessageInputView: View {
}
}
- if editingMessage == nil {
+ if EnsuFeatureFlags.enableImageUploads && editingMessage == nil {
PhotosPicker(selection: $selectedPhotoItem, matching: .images) {
Image("Upload01Icon")
.resizable()
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift
index 37391633e5..d56ab5abe3 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift
@@ -69,7 +69,7 @@ struct MessageListView: View {
isAtBottom = distanceToBottom <= threshold
}
.onChange(of: messages.count) { _ in
- scrollToBottom(scrollProxy)
+ scrollToBottom(scrollProxy, animated: isGenerating)
}
.onChange(of: sessionId) { _ in
autoScrollEnabled = true
@@ -174,6 +174,7 @@ struct MessageListView: View {
onOpenAttachment: openAttachment
)
.id(message.id)
+ .transition(messageTransition)
} else {
AssistantMessageBubbleView(
message: message,
@@ -183,6 +184,7 @@ struct MessageListView: View {
onOpenAttachment: openAttachment
)
.id(message.id)
+ .transition(messageTransition)
}
if isGenerating, streamingParentId == message.id {
@@ -199,6 +201,8 @@ struct MessageListView: View {
.padding(.horizontal, EnsuSpacing.pageHorizontal)
.padding(.top, EnsuSpacing.lg)
.padding(.bottom, EnsuSpacing.lg)
+ .animation(isGenerating ? .spring(response: 0.35, dampingFraction: 0.86) : nil, value: messages.count)
+ .animation(isGenerating ? .easeOut(duration: 0.18) : nil, value: streamingResponse)
Color.clear
.frame(height: contentBottomPadding)
@@ -212,6 +216,10 @@ struct MessageListView: View {
}
}
+ private var messageTransition: AnyTransition {
+ .move(edge: .bottom).combined(with: .opacity)
+ }
+
private var contentBottomPadding: CGFloat {
let fallbackPadding = EnsuSpacing.xxxl + EnsuSpacing.xxl + 60
let measuredPadding = inputBarHeight > 0 ? inputBarHeight + EnsuSpacing.md : fallbackPadding
@@ -479,9 +487,11 @@ private struct StreamingBubbleView: View {
}
.padding(.vertical, EnsuSpacing.md)
.padding(.horizontal, EnsuSpacing.sm)
+ .animation(.easeOut(duration: 0.18), value: text)
}
.frame(maxWidth: .infinity, alignment: .leading)
}
+ .foregroundStyle(EnsuColor.textPrimary)
}
}
@@ -493,7 +503,7 @@ private struct LoadingDotsView: View {
let phase = Int(context.date.timeIntervalSinceReferenceDate * 2) % 3
Text(phrase + dots(for: phase))
.font(EnsuTypography.message)
- .foregroundStyle(EnsuColor.textMuted)
+ .foregroundStyle(EnsuColor.textPrimary)
}
}
@@ -719,7 +729,7 @@ private struct ThinkSectionView: View {
} else if isStreaming {
Text("…" + content)
.font(EnsuFont.code(size: 12.5, weight: .regular))
- .foregroundStyle(EnsuColor.textMuted)
+ .foregroundStyle(EnsuColor.textPrimary)
.lineLimit(4)
}
}
diff --git a/mobile/native/darwin/Apps/ensu/ensu/FeatureFlags.swift b/mobile/native/darwin/Apps/ensu/ensu/FeatureFlags.swift
new file mode 100644
index 0000000000..d4e96bff78
--- /dev/null
+++ b/mobile/native/darwin/Apps/ensu/ensu/FeatureFlags.swift
@@ -0,0 +1,8 @@
+#if canImport(EnteCore)
+import Foundation
+
+enum EnsuFeatureFlags {
+ static let enableSignIn = false
+ static let enableImageUploads = true
+}
+#endif
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift b/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift
index 5aedd88cc7..5c2d2d8019 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Services/EnsuDeveloperSettings.swift
@@ -19,8 +19,8 @@ enum EnsuDeveloperSettings {
private static let endpointKey = "ensu.customEndpoint"
static var currentEndpoint: URL? {
- if let buildEndpoint = endpointURL(from: BuildEndpointConfig.endpoint) {
- return buildEndpoint
+ if let envEndpoint = endpointURL(from: ProcessInfo.processInfo.environment["ENTE_API_ENDPOINT"]) {
+ return envEndpoint
}
if let storedEndpoint = endpointURL(from: UserDefaults.standard.string(forKey: endpointKey)) {
return storedEndpoint