macos task switch focus
This commit is contained in:
@@ -170,8 +170,12 @@ final class ChatModel {
|
||||
}
|
||||
}
|
||||
|
||||
func takeFocusStart() -> Bool {
|
||||
let take = focusStart && session == nil
|
||||
func takeFocus() -> Bool {
|
||||
let asked = taskId != nil && store.composerFocus == taskId
|
||||
if asked {
|
||||
store.composerFocus = nil
|
||||
}
|
||||
let take = asked || (focusStart && session == nil)
|
||||
focusStart = false
|
||||
return take
|
||||
}
|
||||
|
||||
@@ -332,7 +332,12 @@ struct ComposerView: View {
|
||||
}
|
||||
.onAppear {
|
||||
text = store.drafts?.composerText(draftKey) ?? ""
|
||||
if chat.takeFocusStart() {
|
||||
if chat.takeFocus() {
|
||||
focused = true
|
||||
}
|
||||
}
|
||||
.onChange(of: store.composerFocus) {
|
||||
if chat.takeFocus() {
|
||||
focused = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ final class Store {
|
||||
var leadSessions: [AgentSession] = []
|
||||
let leadFeed: Feed
|
||||
var jump: (taskId: String, seq: Int64)?
|
||||
var composerFocus: String?
|
||||
var summaryReads: [String: Int64] = [:]
|
||||
private(set) var leadMore = false
|
||||
var todoStarting: Set<String> = []
|
||||
|
||||
@@ -260,8 +260,10 @@ final class SwitcherModel {
|
||||
if store.inbox.contains(where: { $0.taskId == taskId }) {
|
||||
store.focusTask(taskId, .inbox)
|
||||
} else if let task = store.findTask(taskId), store.unreadSummary(task) {
|
||||
store.composerFocus = taskId
|
||||
store.openSummary(task)
|
||||
} else {
|
||||
store.composerFocus = taskId
|
||||
store.focusTask(taskId, .transcript)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user