diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index dcff1ca..0895449 100755 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -385,17 +385,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele showRunningModeMenuItem.state = defaults.bool(forKey: "ShowRunningModeOnStatusBar") ? 1 : 0 var serverMenuText = "Servers".localized - if let serverProfiles = defaults.array(forKey: "ServerProfiles") { - for v in serverProfiles { - let profile = v as! [String:Any] - if profile["Id"] as! String == defaults.string(forKey: "ActiveServerProfileId")! { - var profileName :String - if profile["Remark"] as! String != "" { - profileName = profile["Remark"] as! String - } else { - profileName = profile["ServerHost"] as! String - } - serverMenuText = "\(serverMenuText) - \(profileName)" + + let mgr = ServerProfileManager.instance + for p in mgr.profiles { + if mgr.activeProfileId == p.uuid { + var profileName :String + if !p.remark.isEmpty { + profileName = p.remark + } else { + profileName = p.serverHost } } }