Connect to several servers, one coloured window each
This commit is contained in:
@@ -26,6 +26,7 @@ final class ChatModel {
|
||||
@ObservationIgnored private var focusStart = true
|
||||
@ObservationIgnored private var visibleSummaries: Set<Int64> = []
|
||||
@ObservationIgnored private var activeObserver: NotificationCenter.ObservationToken?
|
||||
@ObservationIgnored private var keyObserver: NotificationCenter.ObservationToken?
|
||||
@ObservationIgnored private var started = false
|
||||
|
||||
init(_ kind: ChatKind, _ store: Store) {
|
||||
@@ -150,6 +151,9 @@ final class ChatModel {
|
||||
activeObserver = NotificationCenter.default.addObserver(of: NSApplication.self, for: .didBecomeActive) { [weak self] _ in
|
||||
self?.markShown()
|
||||
}
|
||||
keyObserver = NotificationCenter.default.addObserver(of: NSWindow.self, for: .didBecomeKey) { [weak self] _ in
|
||||
self?.markShown()
|
||||
}
|
||||
}
|
||||
|
||||
func stop() {
|
||||
@@ -161,6 +165,10 @@ final class ChatModel {
|
||||
NotificationCenter.default.removeObserver(activeObserver)
|
||||
}
|
||||
activeObserver = nil
|
||||
if let keyObserver {
|
||||
NotificationCenter.default.removeObserver(keyObserver)
|
||||
}
|
||||
keyObserver = nil
|
||||
unmergedTimer?.cancel()
|
||||
unmergedTimer = nil
|
||||
builder.stop()
|
||||
@@ -214,7 +222,7 @@ final class ChatModel {
|
||||
}
|
||||
|
||||
private func markShown() {
|
||||
guard let taskId, NSApp.isActive else {
|
||||
guard let taskId, store.paneFocus.windowKey else {
|
||||
return
|
||||
}
|
||||
for seq in visibleSummaries {
|
||||
|
||||
Reference in New Issue
Block a user