Skip to content

armgit / ente

Public Imported from GitHub
0

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

Don't let it edit also

laurenspriemedc9e7dad410
diff --git a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt
index d3203cd75e..c610986d2b 100644
--- a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt
+++ b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/AppStore.kt
@@ -81,7 +81,10 @@ class AppStore(
isDownloading = if (unsupported) false else _state.value.chat.isDownloading,
downloadPercent = if (unsupported) null else _state.value.chat.downloadPercent,
downloadStatus = if (unsupported) null else _state.value.chat.downloadStatus,
- hasRequestedModelDownload = if (unsupported) false else _state.value.chat.hasRequestedModelDownload
+ hasRequestedModelDownload = if (unsupported) false else _state.value.chat.hasRequestedModelDownload,
+ editingMessageId = if (unsupported) null else _state.value.chat.editingMessageId,
+ messageText = if (unsupported) "" else _state.value.chat.messageText,
+ attachments = if (unsupported) emptyList() else _state.value.chat.attachments
)
)
if (unsupported) {
diff --git a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.kt b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.kt
index 3c8f932982..78e9b1ad9c 100644
--- a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.kt
+++ b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.kt
@@ -250,7 +250,9 @@ internal class ChatStoreActions(
}
fun beginEditing(messageId: String) {
- val sessionId = state.value.chat.currentSessionId ?: return
+ val currentState = state.value
+ if (!currentState.chat.deviceCapability.isChatSupported()) return
+ val sessionId = currentState.chat.currentSessionId ?: return
val message = messageStore[sessionId]?.firstOrNull { it.id == messageId } ?: return
if (message.author != MessageAuthor.User) return
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift
index 337c1878dd..50ca581962 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/ChatViewModel.swift
@@ -631,6 +631,9 @@ final class ChatViewModel: ObservableObject {
downloadProgressMonitorTask?.cancel()
sharedModelReadyTask?.cancel()
clearSharedModelReadyTask()
+ editingMessageId = nil
+ draftText = ""
+ draftAttachments = []
provider.cancelDownload()
}
@@ -1053,6 +1056,10 @@ final class ChatViewModel: ObservableObject {
}
func beginEditing(message: RenderedChatMessage) {
+ guard !isChatUnsupported else {
+ showUnsupportedDeviceDialog = true
+ return
+ }
guard message.role == .user else { return }
editingMessageId = message.id
draftText = message.text