Move profile manager function to the Class

the function should be in the Class instead of the AppDelegate
This commit is contained in:
秦宇航
2017-07-22 12:11:12 +08:00
parent 290865ad18
commit 5366345b79
2 changed files with 8 additions and 8 deletions
-7
View File
@@ -230,13 +230,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
}
func applyConfig() {
let profileMgr = ServerProfileManager.instance
if profileMgr.profiles.count == 0{
let notice = NSUserNotification()
notice.title = "还没有服务器设定!"
notice.subtitle = "去设置里面填一下吧,填完记得选择呦~"
NSUserNotificationCenter.default.deliver(notice)
}
let defaults = UserDefaults.standard
let isOn = defaults.bool(forKey: "ShadowsocksOn")
let mode = defaults.string(forKey: "ShadowsocksRunningMode")
+8 -1
View File
@@ -2,7 +2,7 @@
// ServerProfileManager.swift
// ShadowsocksX-NG
//
// Created by 邱宇舟 on 16/6/6. Modified by 秦宇航 16/9/12
// Created by 邱宇舟 on 16/6/6. Modified by 秦宇航 17/7/22
// Copyright © 2016年 qiuyuzhou. All rights reserved.
//
@@ -31,6 +31,13 @@ class ServerProfileManager: NSObject {
return
}
}
if profiles.count == 0{
let notice = NSUserNotification()
notice.title = "还没有服务器设定!"
notice.subtitle = "去设置里面填一下吧,填完记得选择呦~"
NSUserNotificationCenter.default.deliver(notice)
return
}
activeProfileId = profiles[0].uuid
}