improve: reload dashboard at config change

This commit is contained in:
yicheng 2019-12-29 14:48:39 +08:00
parent 3d129bfa8a
commit 642ea36b80
3 changed files with 4 additions and 3 deletions

View File

@ -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)
}
}
}

View File

@ -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")

View File

@ -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)