From 290865ad185e0a4b1e24f60294fc517c116be169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=AE=87=E8=88=AA?= Date: Sat, 22 Jul 2017 12:05:28 +0800 Subject: [PATCH] Fix if update subscribe delete using node problem Now update subscribe delete the using node, the app will automatic select the first profile --- ShadowsocksX-NG/AppDelegate.swift | 2 +- ShadowsocksX-NG/ServerProfileManager.swift | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index a3de985..69300c1 100644 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -207,7 +207,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele DispatchQueue.global().async { // Version Check! - if defaults.bool(forKey: "AutoCheckUpdate"){ + if defaults.bool(forKey: "AutoCheckUpdate") { self.checkForUpdate(mustShowAlert: false) } if defaults.bool(forKey: "AutoUpdateSubscribe") { diff --git a/ShadowsocksX-NG/ServerProfileManager.swift b/ShadowsocksX-NG/ServerProfileManager.swift index cd19a7c..7dda904 100644 --- a/ShadowsocksX-NG/ServerProfileManager.swift +++ b/ShadowsocksX-NG/ServerProfileManager.swift @@ -26,6 +26,12 @@ class ServerProfileManager: NSObject { } } activeProfileId = defaults.string(forKey: "ActiveServerProfileId") + for p in profiles { + if p.uuid == activeProfileId { + return + } + } + activeProfileId = profiles[0].uuid } func setActiveProfiledId(_ id: String) {