mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-11-02 07:54:03 +00:00
Move profile manager function to the Class
the function should be in the Class instead of the AppDelegate
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user