From e58d5a54b1dfc8abbbed4759926a3290dc388953 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 9 Dec 2025 23:36:51 +0100 Subject: [PATCH] mac: toggle panel purely from visibility --- apps/macos/Sources/Clawdis/WebChatWindow.swift | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/apps/macos/Sources/Clawdis/WebChatWindow.swift b/apps/macos/Sources/Clawdis/WebChatWindow.swift index 4cc580787..94cda8df3 100644 --- a/apps/macos/Sources/Clawdis/WebChatWindow.swift +++ b/apps/macos/Sources/Clawdis/WebChatWindow.swift @@ -443,7 +443,6 @@ final class WebChatManager { private var windowController: WebChatWindowController? private var panelController: WebChatWindowController? var onPanelVisibilityChanged: ((Bool) -> Void)? - private var isPanelVisible = false func show(sessionKey: String) { self.closePanel() @@ -462,20 +461,11 @@ final class WebChatManager { } func togglePanel(sessionKey: String, anchorProvider: @escaping () -> NSRect?) { - if self.isPanelVisible { - self.closePanel() - return - } - if let controller = self.panelController { if controller.window?.isVisible == true { controller.closePanel() - self.isPanelVisible = false - self.onPanelVisibilityChanged?(false) } else { controller.presentAnchoredPanel(anchorProvider: anchorProvider) - self.isPanelVisible = true - self.onPanelVisibilityChanged?(true) } return } @@ -489,20 +479,15 @@ final class WebChatManager { } controller.onVisibilityChanged = { [weak self] visible in guard let self else { return } - self.isPanelVisible = visible self.onPanelVisibilityChanged?(visible) } controller.presentAnchoredPanel(anchorProvider: anchorProvider) // visibility will be reported by the controller callback - self.isPanelVisible = true - self.onPanelVisibilityChanged?(true) } func closePanel() { guard let controller = self.panelController else { return } controller.closePanel() - self.isPanelVisible = false - self.onPanelVisibilityChanged?(false) } func preferredSessionKey() -> String { @@ -534,7 +519,6 @@ final class WebChatManager { } private func panelHidden() { - self.isPanelVisible = false self.onPanelVisibilityChanged?(false) self.panelController = nil }