improve: reload dashboard at config change
This commit is contained in:
parent
3d129bfa8a
commit
642ea36b80
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user