Refactor.
This commit is contained in:
@ -120,7 +120,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||||||
self.updateCopyHttpProxyExportMenu()
|
self.updateCopyHttpProxyExportMenu()
|
||||||
})
|
})
|
||||||
|
|
||||||
notifyCenter.addObserver(forName: NSNotification.Name(rawValue: NOTIFY_SERVER_PROFILES_CHANGED), object: nil, queue: nil
|
notifyCenter.addObserver(forName: NOTIFY_SERVER_PROFILES_CHANGED, object: nil, queue: nil
|
||||||
, using: {
|
, using: {
|
||||||
(note) in
|
(note) in
|
||||||
let profileMgr = ServerProfileManager.instance
|
let profileMgr = ServerProfileManager.instance
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
let NOTIFY_SERVER_PROFILES_CHANGED = "NOTIFY_SERVER_PROFILES_CHANGED"
|
let NOTIFY_SERVER_PROFILES_CHANGED = Notification.Name(rawValue: "NOTIFY_SERVER_PROFILES_CHANGED")
|
||||||
let NOTIFY_INVALIDE_QR = "NOTIFY_INVALIDE_QR"
|
|
||||||
|
|
||||||
let NOTIFY_CONF_CHANGED = Notification.Name(rawValue: "NOTIFY_CONF_CHANGED")
|
let NOTIFY_CONF_CHANGED = Notification.Name(rawValue: "NOTIFY_CONF_CHANGED")
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class PreferencesWindowController: NSWindowController
|
|||||||
|
|
||||||
|
|
||||||
NotificationCenter.default
|
NotificationCenter.default
|
||||||
.post(name: Notification.Name(rawValue: NOTIFY_SERVER_PROFILES_CHANGED), object: nil)
|
.post(name: NOTIFY_SERVER_PROFILES_CHANGED, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func cancel(_ sender: NSButton) {
|
@IBAction func cancel(_ sender: NSButton) {
|
||||||
|
@ -107,7 +107,7 @@ class ServerProfileManager: NSObject {
|
|||||||
self.profiles.append(profile)
|
self.profiles.append(profile)
|
||||||
self.save()
|
self.save()
|
||||||
}
|
}
|
||||||
NotificationCenter.default.post(name: NSNotification.Name(rawValue: NOTIFY_SERVER_PROFILES_CHANGED), object: nil)
|
NotificationCenter.default.post(name: NOTIFY_SERVER_PROFILES_CHANGED, object: nil)
|
||||||
let configsCount = (jsonArr1.object(forKey: "configs") as! [[String: AnyObject]]).count
|
let configsCount = (jsonArr1.object(forKey: "configs") as! [[String: AnyObject]]).count
|
||||||
let notification = NSUserNotification()
|
let notification = NSUserNotification()
|
||||||
notification.title = "Import Server Profile succeed!".localized
|
notification.title = "Import Server Profile succeed!".localized
|
||||||
|
Reference in New Issue
Block a user