Skip to content

armgit / ente

Public Imported from GitHub
0

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

move plus to ios app bar

Prateek Sunal72403584b430
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
index 0beea67db0..32e661068e 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift
@@ -259,6 +259,10 @@ struct ChatView: View {
guard EnsuFeatureFlags.enableSignIn else { return }
handleSignInRequest()
},
+ onNewChat: {
+ viewModel.startNewSession()
+ viewState.isDrawerOpen = false
+ },
onAttachmentDownloads: {
viewState.showAttachmentDownloads = true
}
@@ -407,10 +411,6 @@ struct ChatView: View {
currentSessionId: viewModel.currentSessionId,
isLoggedIn: appState.isLoggedIn,
email: CredentialStore.shared.email,
- onNewChat: {
- viewModel.startNewSession()
- viewState.isDrawerOpen = false
- },
onSelectSession: { session in
viewModel.selectSession(session)
viewState.isDrawerOpen = false
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/Components/ChatViewComponents.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/Components/ChatViewComponents.swift
index 15101633a3..daae4fff84 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/Components/ChatViewComponents.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/Components/ChatViewComponents.swift
@@ -229,6 +229,7 @@ struct ChatAppBar: View {
let modelDownloadState: DownloadToastState?
let onMenu: () -> Void
let onSignIn: () -> Void
+ let onNewChat: () -> Void
let onAttachmentDownloads: () -> Void
private let centerInset: CGFloat = 72
@@ -306,6 +307,19 @@ struct ChatAppBar: View {
ModelProgressIndicator(state: progress)
}
}
+
+ Button(action: {
+ hapticTap()
+ onNewChat()
+ }) {
+ Image("PlusSignIcon")
+ .resizable()
+ .scaledToFit()
+ .frame(width: 18, height: 18)
+ .foregroundStyle(EnsuColor.textPrimary)
+ .frame(width: 40, height: 40)
+ }
+ .buttonStyle(.plain)
}
}
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift
index 544b0cd60b..528f3b1733 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift
@@ -6,7 +6,6 @@ struct SessionDrawerView: View {
let currentSessionId: UUID?
let isLoggedIn: Bool
let email: String?
- let onNewChat: () -> Void
let onSelectSession: (ChatSession) -> Void
let onDeleteSession: (ChatSession) -> Void
let onSync: () -> Void
@@ -74,10 +73,11 @@ struct SessionDrawerView: View {
searchField
.frame(maxWidth: .infinity, alignment: .leading)
- newChatButton
+ if hasSearchQuery {
+ clearSearchButton
+ }
}
}
-
private var searchField: some View {
HStack(spacing: EnsuSpacing.sm) {
Image("Search01Icon")
@@ -104,16 +104,12 @@ struct SessionDrawerView: View {
!searchQuery.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
- private var newChatButton: some View {
+ private var clearSearchButton: some View {
Button(action: {
hapticTap()
- if hasSearchQuery {
- searchQuery = ""
- } else {
- onNewChat()
- }
+ searchQuery = ""
}) {
- Image(hasSearchQuery ? "Cancel01Icon" : "PlusSignIcon")
+ Image("Cancel01Icon")
.resizable()
.scaledToFit()
.frame(width: 18, height: 18)