chore: update deps, adjust launch order

This commit is contained in:
yicheng 2021-01-09 18:02:48 +08:00
parent 5705c121a3
commit 3435ffd023
No known key found for this signature in database
GPG Key ID: 7CF411A6623B1C0A
6 changed files with 36 additions and 45 deletions

View File

@ -10,7 +10,6 @@
0AE14FEF25A35685007EF89B /* BSBacktraceLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14FEC25A35685007EF89B /* BSBacktraceLogger.m */; }; 0AE14FEF25A35685007EF89B /* BSBacktraceLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14FEC25A35685007EF89B /* BSBacktraceLogger.m */; };
0AE14FF025A35685007EF89B /* AnrDetectUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14FED25A35685007EF89B /* AnrDetectUtil.swift */; }; 0AE14FF025A35685007EF89B /* AnrDetectUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14FED25A35685007EF89B /* AnrDetectUtil.swift */; };
0AE14FF125A35685007EF89B /* AnrDetectThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14FEE25A35685007EF89B /* AnrDetectThread.swift */; }; 0AE14FF125A35685007EF89B /* AnrDetectThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14FEE25A35685007EF89B /* AnrDetectThread.swift */; };
0D318CDAC9464E01DAD1F92B /* Pods_ClashX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0358BF8F0CBD7FF9A7EA4E30 /* Pods_ClashX.framework */; };
4913C82321157D0200F6B87C /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4913C82221157D0200F6B87C /* Notification.swift */; }; 4913C82321157D0200F6B87C /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4913C82221157D0200F6B87C /* Notification.swift */; };
491E6203258A424D00313AEF /* CommonUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 491E61FD258A424500313AEF /* CommonUtils.m */; }; 491E6203258A424D00313AEF /* CommonUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 491E61FD258A424500313AEF /* CommonUtils.m */; };
491E6300258AEE3300313AEF /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 491E62FF258AEE3300313AEF /* AppIcon.icns */; }; 491E6300258AEE3300313AEF /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 491E62FF258AEE3300313AEF /* AppIcon.icns */; };
@ -941,7 +940,7 @@
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.31.2; CURRENT_PROJECT_VERSION = 1.31.3;
DEVELOPMENT_TEAM = MEWHFZ92DY; DEVELOPMENT_TEAM = MEWHFZ92DY;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -963,7 +962,7 @@
"$(PROJECT_DIR)/ClashX/goClash", "$(PROJECT_DIR)/ClashX/goClash",
); );
MACOSX_DEPLOYMENT_TARGET = 10.12; MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.31.2; MARKETING_VERSION = 1.31.3;
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX; PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -985,7 +984,7 @@
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 1.31.2; CURRENT_PROJECT_VERSION = 1.31.3;
DEPLOYMENT_POSTPROCESSING = YES; DEPLOYMENT_POSTPROCESSING = YES;
DEVELOPMENT_TEAM = MEWHFZ92DY; DEVELOPMENT_TEAM = MEWHFZ92DY;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@ -1008,7 +1007,7 @@
"$(PROJECT_DIR)/ClashX/goClash", "$(PROJECT_DIR)/ClashX/goClash",
); );
MACOSX_DEPLOYMENT_TARGET = 10.12; MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.31.2; MARKETING_VERSION = 1.31.3;
OTHER_CODE_SIGN_FLAGS = "--timestamp"; OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX; PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -17,7 +17,7 @@ import AppCenterAnalytics
import Firebase import Firebase
private let statusItemLengthWithSpeed: CGFloat = 70 private let statusItemLengthWithSpeed: CGFloat = 72
@NSApplicationMain @NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate { class AppDelegate: NSObject, NSApplicationDelegate {
@ -64,7 +64,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// crash recorder // crash recorder
failLaunchProtect() failLaunchProtect()
registCrashLogger() registCrashLogger()
startAnrDetect()
} }
func applicationDidFinishLaunching(_ notification: Notification) { func applicationDidFinishLaunching(_ notification: Notification) {
@ -74,8 +73,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
statusItemView = StatusItemView.create(statusItem: statusItem) statusItemView = StatusItemView.create(statusItem: statusItem)
statusItemView.frame = CGRect(x: 0, y: 0, width: statusItemLengthWithSpeed, height: 22) statusItemView.frame = CGRect(x: 0, y: 0, width: statusItemLengthWithSpeed, height: 22)
statusMenu.delegate = self statusMenu.delegate = self
setupStatusMenuItemData() startAnrDetect()
AppVersionUtil.showUpgradeAlert()
DispatchQueue.main.async { DispatchQueue.main.async {
self.postFinishLaunching() self.postFinishLaunching()
} }
@ -85,6 +83,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
defer { defer {
statusItem.menu = statusMenu statusItem.menu = statusMenu
} }
setupStatusMenuItemData()
AppVersionUtil.showUpgradeAlert()
iCloudManager.shared.setup() iCloudManager.shared.setup()
setupExperimentalMenuItem() setupExperimentalMenuItem()
@ -99,7 +99,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
removeUnExistProxyGroups() removeUnExistProxyGroups()
// start proxy // start proxy
Logger.log("initClashCore")
initClashCore() initClashCore()
Logger.log("initClashCore finish")
setupData() setupData()
runAfterConfigReload = { [weak self] in runAfterConfigReload = { [weak self] in
if !ConfigManager.builtInApiMode { if !ConfigManager.builtInApiMode {
@ -273,11 +275,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
PrivilegedHelperManager.shared.isHelperCheckFinished PrivilegedHelperManager.shared.isHelperCheckFinished
.filter({$0}) .filter({$0})
.take(1) .take(1)
.takeWhile{_ in ConfigManager.shared.proxyPortAutoSet} .take(while:{_ in ConfigManager.shared.proxyPortAutoSet})
.observeOn(MainScheduler.instance) .observe(on: MainScheduler.instance)
.subscribe { _ in .bind(onNext: { _ in
SystemProxyManager.shared.enableProxy()
}).disposed(by: disposeBag)
} else if ConfigManager.shared.proxyPortAutoSet {
SystemProxyManager.shared.enableProxy() SystemProxyManager.shared.enableProxy()
}.disposed(by: disposeBag)
} }
if !PrivilegedHelperManager.shared.isHelperCheckFinished.value { if !PrivilegedHelperManager.shared.isHelperCheckFinished.value {
@ -285,7 +289,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
PrivilegedHelperManager.shared.isHelperCheckFinished PrivilegedHelperManager.shared.isHelperCheckFinished
.filter({$0}) .filter({$0})
.take(1) .take(1)
.observeOn(MainScheduler.instance) .observe(on: MainScheduler.instance)
.subscribe { [weak self] _ in .subscribe { [weak self] _ in
guard let self = self else { return } guard let self = self else { return }
self.proxySettingMenuItem.target = self self.proxySettingMenuItem.target = self
@ -300,7 +304,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
.default .default
.rx .rx
.notification(.systemNetworkStatusDidChange) .notification(.systemNetworkStatusDidChange)
.observeOn(MainScheduler.instance) .observe(on: MainScheduler.instance)
.delay(.milliseconds(200), scheduler: MainScheduler.instance) .delay(.milliseconds(200), scheduler: MainScheduler.instance)
.bind { _ in .bind { _ in
guard NetworkChangeNotifier.getPrimaryInterface() != nil else { return } guard NetworkChangeNotifier.getPrimaryInterface() != nil else { return }
@ -327,7 +331,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
.distinctUntilChanged() .distinctUntilChanged()
.skip(1) .skip(1)
.filter { $0 != nil } .filter { $0 != nil }
.observeOn(MainScheduler.instance) .observe(on: MainScheduler.instance)
.debounce(.seconds(5), scheduler: MainScheduler.instance).bind { [weak self] _ in .debounce(.seconds(5), scheduler: MainScheduler.instance).bind { [weak self] _ in
self?.healthHeckOnNetworkChange() self?.healthHeckOnNetworkChange()
}.disposed(by: disposeBag) }.disposed(by: disposeBag)
@ -418,6 +422,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
proxyModeMenuItem.isEnabled = false proxyModeMenuItem.isEnabled = false
NSUserNotificationCenter.default.postConfigErrorNotice(msg: string) NSUserNotificationCenter.default.postConfigErrorNotice(msg: string)
} }
Logger.log("Start proxy done")
} }
func syncConfig(completeHandler: (() -> Void)? = nil) { func syncConfig(completeHandler: (() -> Void)? = nil) {

View File

@ -15,11 +15,12 @@ class AnrDetectUtil {
private init() {} private init() {}
lazy var thread = AnrDetectThread() lazy var thread = AnrDetectThread()
let macModal: String = Mac.getMacModel()
func start(threshold: Double = 10) { func start(threshold: Double = 10) {
thread.start(threshold: threshold) { allThreadBackTrace in thread.start(threshold: threshold) {
[weak thread] allThreadBackTrace in
Logger.log("[ANR] \(allThreadBackTrace)", level: .error) Logger.log("[ANR] \(allThreadBackTrace)", level: .error)
thread?.cancel()
} }
} }
@ -27,17 +28,3 @@ class AnrDetectUtil {
thread.cancel() thread.cancel()
} }
} }
struct Mac {
static func getMacModel() -> String {
let service = IOServiceGetMatchingService(kIOMasterPortDefault,
IOServiceMatching("IOPlatformExpertDevice"))
var modelIdentifier: String?
if let modelData = IORegistryEntryCreateCFProperty(service, "model" as CFString, kCFAllocatorDefault, 0).takeRetainedValue() as? Data {
modelIdentifier = String(data: modelData, encoding: .utf8)
}
IOObjectRelease(service)
return modelIdentifier ?? ""
}
}

View File

@ -1,7 +1,7 @@
module github.com/yichengchen/clashX/ClashX module github.com/yichengchen/clashX/ClashX
require ( require (
github.com/Dreamacro/clash v1.3.5 github.com/Dreamacro/clash v1.3.6-0.20210107055939-b6ee47a541c3
github.com/oschwald/geoip2-golang v1.4.0 github.com/oschwald/geoip2-golang v1.4.0
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
) )

View File

@ -1,5 +1,5 @@
github.com/Dreamacro/clash v1.3.5 h1:+cZt14Q+vDux5+c0a6iCfA+B805i6o40CH5HNVtmh+w= github.com/Dreamacro/clash v1.3.6-0.20210107055939-b6ee47a541c3 h1:PwWkH664oLp+Nhq/ywuokfiZ4I5M1g9XicaMoPBmII0=
github.com/Dreamacro/clash v1.3.5/go.mod h1:alA8QdA6/zm9ZzK1RFK9Jq1wORcRSLHlwkDY1SQp2+Y= github.com/Dreamacro/clash v1.3.6-0.20210107055939-b6ee47a541c3/go.mod h1:alA8QdA6/zm9ZzK1RFK9Jq1wORcRSLHlwkDY1SQp2+Y=
github.com/Dreamacro/go-shadowsocks2 v0.1.6 h1:PysSf9sLT3Qn8jhlin5v7Rk68gOQG4K5BZFY1nxLGxI= github.com/Dreamacro/go-shadowsocks2 v0.1.6 h1:PysSf9sLT3Qn8jhlin5v7Rk68gOQG4K5BZFY1nxLGxI=
github.com/Dreamacro/go-shadowsocks2 v0.1.6/go.mod h1:LSXCjyHesPY3pLjhwff1mQX72ItcBT/N2xNC685cYeU= github.com/Dreamacro/go-shadowsocks2 v0.1.6/go.mod h1:LSXCjyHesPY3pLjhwff1mQX72ItcBT/N2xNC685cYeU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

View File

@ -48,12 +48,12 @@ PODS:
- nanopb/decode (2.30906.0) - nanopb/decode (2.30906.0)
- nanopb/encode (2.30906.0) - nanopb/encode (2.30906.0)
- PromisesObjC (1.2.12) - PromisesObjC (1.2.12)
- RxCocoa (5.1.1): - RxCocoa (6.0.0):
- RxRelay (~> 5) - RxRelay (= 6.0.0)
- RxSwift (~> 5) - RxSwift (= 6.0.0)
- RxRelay (5.1.1): - RxRelay (6.0.0):
- RxSwift (~> 5) - RxSwift (= 6.0.0)
- RxSwift (5.1.1) - RxSwift (6.0.0)
- Sparkle (1.24.0) - Sparkle (1.24.0)
- Starscream (3.1.1) - Starscream (3.1.1)
- SwiftyJSON (5.0.0) - SwiftyJSON (5.0.0)
@ -75,7 +75,7 @@ DEPENDENCIES:
- WebViewJavascriptBridge - WebViewJavascriptBridge
SPEC REPOS: SPEC REPOS:
https://cdn.cocoapods.org/: trunk:
- Alamofire - Alamofire
- AppCenter - AppCenter
- CocoaLumberjack - CocoaLumberjack
@ -115,9 +115,9 @@ SPEC CHECKSUMS:
LetsMove: 7b9fe44737707d984fbd3f47af46609a9a07b461 LetsMove: 7b9fe44737707d984fbd3f47af46609a9a07b461
nanopb: 1bf24dd71191072e120b83dd02d08f3da0d65e53 nanopb: 1bf24dd71191072e120b83dd02d08f3da0d65e53
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97 PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
RxCocoa: 32065309a38d29b5b0db858819b5bf9ef038b601 RxCocoa: 3f79328fafa3645b34600f37c31e64c73ae3a80e
RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9 RxRelay: 8d593be109c06ea850df027351beba614b012ffb
RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178 RxSwift: c14e798c59b9f6e9a2df8fd235602e85cc044295
Sparkle: 270cd27377bf04e9c128af06e3a22d0f572d6ee3 Sparkle: 270cd27377bf04e9c128af06e3a22d0f572d6ee3
Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0 Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0
SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7 SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7