diff --git a/ClashX/AppDelegate.swift b/ClashX/AppDelegate.swift index 4a264ff..c170fb8 100644 --- a/ClashX/AppDelegate.swift +++ b/ClashX/AppDelegate.swift @@ -259,7 +259,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { for item in logLevelMenuItem.submenu?.items ?? [] { item.state = item.title.lowercased() == ConfigManager.selectLoggingApiLevel.rawValue ? .on : .off } - NotificationCenter.default.post(name: kLogLevelDidChange, object: nil) + NotificationCenter.default.post(name: kReloadDashboard, object: nil) } func startProxy() { @@ -338,6 +338,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { ConfigManager.selectConfigName = newConfigName } self.selectProxyGroupWithMemory() + NotificationCenter.default.post(name: kReloadDashboard, object: nil) } } } diff --git a/ClashX/Macro/Notification.swift b/ClashX/Macro/Notification.swift index 2e7fbd2..a305870 100644 --- a/ClashX/Macro/Notification.swift +++ b/ClashX/Macro/Notification.swift @@ -10,4 +10,4 @@ import Foundation let kConfigFileChange = Notification.Name("kConfigFileChange") let kSystemNetworkStatusDidChange = Notification.Name("kSystemNetworkStatusDidChange") let kSpeedTestFinishForProxy = Notification.Name("kSpeedTestFinishForProxy") -let kLogLevelDidChange = Notification.Name("kLogLevelDidChange") +let kReloadDashboard = Notification.Name("kReloadDashboard") diff --git a/ClashX/ViewControllers/ClashWebViewContoller.swift b/ClashX/ViewControllers/ClashWebViewContoller.swift index beb2000..2637730 100644 --- a/ClashX/ViewControllers/ClashWebViewContoller.swift +++ b/ClashX/ViewControllers/ClashWebViewContoller.swift @@ -47,7 +47,7 @@ class ClashWebViewContoller: NSViewController { self?.bridge?.callHandler("onConfigChange") }.disposed(by: disposeBag) - NotificationCenter.default.rx.notification(kLogLevelDidChange).bind { + NotificationCenter.default.rx.notification(kReloadDashboard).bind { [weak self] _ in self?.webview.reload() }.disposed(by: disposeBag)