From 8937044f559e997890002e904d6cb5ef5dbd3018 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Thu, 2 Jul 2026 10:50:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(client/macos):=20=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=8C=96=E6=89=98=E7=9B=98=E5=90=8E=E7=82=B9=20Dock=20?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=94=A4=E5=9B=9E=E7=AA=97=E5=8F=A3(1.0.48+4?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit windowManager.hide() 走 orderOut: 后主窗口不可见,点 Dock 图标系统只发 applicationShouldHandleReopen(hasVisibleWindows=false),AppDelegate 未接管 → 点了没反应。AppDelegate 实现该回调,无可见窗口时 makeKeyAndOrderFront + activate 唤回 mainFlutterWindow。 Co-Authored-By: Claude Opus 4.8 --- client/macos/Runner/AppDelegate.swift | 10 ++++++++++ client/pubspec.yaml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/macos/Runner/AppDelegate.swift b/client/macos/Runner/AppDelegate.swift index da810b5..481b21d 100644 --- a/client/macos/Runner/AppDelegate.swift +++ b/client/macos/Runner/AppDelegate.swift @@ -12,4 +12,14 @@ class AppDelegate: FlutterAppDelegate { override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true } + + // 隐藏到托盘后点 Dock 图标 → 唤回主窗口。窗口被 window_manager.hide()(orderOut:) + // 隐藏时 hasVisibleWindows=false,系统只发 reopen 事件、不会自动显示;不接管就"点了没反应"。 + override func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { + if !flag { + mainFlutterWindow?.makeKeyAndOrderFront(nil) + NSApp.activate(ignoringOtherApps: true) + } + return true + } } diff --git a/client/pubspec.yaml b/client/pubspec.yaml index 40e5c3f..2536857 100644 --- a/client/pubspec.yaml +++ b/client/pubspec.yaml @@ -1,7 +1,7 @@ name: pangolin_vpn description: 穿山甲 · Pangolin — 极简、稳定、跨平台网络加速客户端。 publish_to: "none" -version: 1.0.47+48 +version: 1.0.48+49 environment: sdk: ^3.5.0