Chore: reduce warning

This commit is contained in:
yichengchen 2019-05-10 20:40:35 +08:00
parent 1b2af9e9aa
commit d4ed7b2e61
15 changed files with 709 additions and 787 deletions

View File

@ -12,7 +12,6 @@
492C4869210EE6B9004554A0 /* ApiRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 492C4868210EE6B9004554A0 /* ApiRequest.swift */; };
492C4871210EF62E004554A0 /* ClashConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 492C4870210EF62E004554A0 /* ClashConfig.swift */; };
492D7321216CEC4000146BC1 /* ClashX.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 492D731F216CEC4000146BC1 /* ClashX.a */; };
493196A2216331F400A8E6E7 /* NetworkChangeNotifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493196A1216331F400A8E6E7 /* NetworkChangeNotifier.swift */; };
493AEAE3221AE3420016FE98 /* AppVersionUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493AEAE2221AE3420016FE98 /* AppVersionUtil.swift */; };
493AEAE5221AE7230016FE98 /* ProxyMenuItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 493AEAE4221AE7230016FE98 /* ProxyMenuItem.swift */; };
4949D154213242F600EF85E6 /* Paths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4949D153213242F600EF85E6 /* Paths.swift */; };
@ -103,7 +102,6 @@
492C4870210EF62E004554A0 /* ClashConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClashConfig.swift; sourceTree = "<group>"; };
492D731F216CEC4000146BC1 /* ClashX.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = ClashX.a; path = ClashX/ClashX.a; sourceTree = SOURCE_ROOT; };
492D7320216CEC4000146BC1 /* ClashX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClashX.h; path = ClashX/ClashX.h; sourceTree = SOURCE_ROOT; };
493196A1216331F400A8E6E7 /* NetworkChangeNotifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkChangeNotifier.swift; sourceTree = "<group>"; };
493AEAE2221AE3420016FE98 /* AppVersionUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppVersionUtil.swift; sourceTree = "<group>"; };
493AEAE4221AE7230016FE98 /* ProxyMenuItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyMenuItem.swift; sourceTree = "<group>"; };
4949D153213242F600EF85E6 /* Paths.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Paths.swift; sourceTree = "<group>"; };
@ -262,7 +260,6 @@
isa = PBXGroup;
children = (
49722FE9211F338B00650A41 /* Witness */,
493196A1216331F400A8E6E7 /* NetworkChangeNotifier.swift */,
);
path = Vendor;
sourceTree = "<group>";
@ -629,7 +626,6 @@
files = (
49CF3B5C20CE8068001EBF94 /* ProxyConfigHelperManager.swift in Sources */,
4952C3D02117027C004A4FA8 /* ConfigFileManager.swift in Sources */,
493196A2216331F400A8E6E7 /* NetworkChangeNotifier.swift in Sources */,
4997732520D251A60009B136 /* SWBApplication.m in Sources */,
49BC061C212931F4005A0FE7 /* AboutViewController.swift in Sources */,
4949D154213242F600EF85E6 /* Paths.swift in Sources */,
@ -872,10 +868,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = MEWHFZ92DY;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = ClashX/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@ -884,7 +877,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ClashX",
"$(PROJECT_DIR)/ClashX/clash",
);
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;
@ -906,10 +898,7 @@
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = MEWHFZ92DY;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = ClashX/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@ -918,7 +907,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ClashX",
"$(PROJECT_DIR)/ClashX/clash",
);
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;

View File

@ -17,10 +17,6 @@ class ConfigManager {
private let disposeBag = DisposeBag()
var apiPort = "8080"
var apiSecret:String? = nil
private init(){
setupNetworkNotifier()
}
var currentConfig:ClashConfig?{
get {
@ -137,23 +133,6 @@ class ConfigManager {
}
}
func setupNetworkNotifier() {
NetworkChangeNotifier.start()
NotificationCenter
.default
.rx
.notification(kSystemNetworkStatusDidChange)
.debounce(2, scheduler: MainScheduler.instance)
.subscribeOn(MainScheduler.instance)
.bind{ _ in
let (http,https,socks) = NetworkChangeNotifier.currentSystemProxySetting()
let proxySetted =
http == (self.currentConfig?.port ?? 0) &&
https == (self.currentConfig?.port ?? 0) &&
socks == (self.currentConfig?.socketPort ?? 0)
self.proxyPortAutoSet = proxySetted
}.disposed(by: disposeBag)
}
}
extension ConfigManager {

View File

@ -1,48 +0,0 @@
/**
* Network Change Notifier
*
* Made by François 'ftiff' Levaux-Tiffreau - fti@me.com
*
*
* Simply modify "changed"
*
*/
import Cocoa
import SystemConfiguration
import Foundation
class NetworkChangeNotifier {
static func start(){
// disable this function temporary.
return
let changed: SCDynamicStoreCallBack = {_,_,_ in
print("Network configuration changed")
NotificationCenter.default.post(name: kSystemNetworkStatusDidChange, object: nil)
}
var dynamicContext = SCDynamicStoreContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil)
let dcAddress = withUnsafeMutablePointer(to:&dynamicContext, {UnsafeMutablePointer<SCDynamicStoreContext>($0)})
if let dynamicStore = SCDynamicStoreCreate(kCFAllocatorDefault, "io.fti.networkconfigurationchanged" as CFString, changed, dcAddress){
let keys: [CFString] = ["State:/Network/Global/IPv4" as CFString]
SCDynamicStoreSetNotificationKeys(dynamicStore, keys as CFArray, nil)
let loop = SCDynamicStoreCreateRunLoopSource(kCFAllocatorDefault, dynamicStore, 0)
CFRunLoopAddSource(CFRunLoopGetCurrent(), loop, CFRunLoopMode.defaultMode)
CFRunLoopRun()
}
}
static func currentSystemProxySetting() -> (UInt,UInt,UInt) {
let proxiesSetting = CFNetworkCopySystemProxySettings()?.takeRetainedValue() as! [String:AnyObject]
let httpProxy = proxiesSetting[kCFNetworkProxiesHTTPPort as String] as? UInt ?? 0
let socksProxy = proxiesSetting[kCFNetworkProxiesSOCKSPort as String]as? UInt ?? 0
let httpsProxy = proxiesSetting[kCFNetworkProxiesHTTPSPort as String]as? UInt ?? 0
return (httpProxy,httpsProxy,socksProxy)
}
}

View File

@ -1,4 +1,5 @@
target 'ClashX' do
inhibit_all_warnings!
use_frameworks!
pod "LetsMove"
pod 'Sparkle'

View File

@ -55,6 +55,6 @@ SPEC CHECKSUMS:
WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
Yams: cb96472112d99e4b368f8dae9ab62e8a3eb8a3f9
PODFILE CHECKSUM: 8f4cf54b06edff20db9edc64fb89d5886c1cdf83
PODFILE CHECKSUM: 61f834acc06be4067bdf757e2e590ba5ea99d251
COCOAPODS: 1.6.1

2
Pods/Manifest.lock generated
View File

@ -55,6 +55,6 @@ SPEC CHECKSUMS:
WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
Yams: cb96472112d99e4b368f8dae9ab62e8a3eb8a3f9
PODFILE CHECKSUM: 8f4cf54b06edff20db9edc64fb89d5886c1cdf83
PODFILE CHECKSUM: 61f834acc06be4067bdf757e2e590ba5ea99d251
COCOAPODS: 1.6.1

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -4,6 +4,7 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' @loader_path/../Frameworks
OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" -iframework "${PODS_ROOT}/Crashlytics/OSX" -iframework "${PODS_ROOT}/Fabric/OSX" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" -iframework "${PODS_ROOT}/Sparkle" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Yams"
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"z" -framework "Alamofire" -framework "CocoaLumberjack" -framework "Crashlytics" -framework "Fabric" -framework "LetsMove" -framework "RxCocoa" -framework "RxSwift" -framework "Security" -framework "Sparkle" -framework "SwiftyJSON" -framework "SystemConfiguration" -framework "WebKit" -framework "WebViewJavascriptBridge" -framework "Yams"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}

View File

@ -4,6 +4,7 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' @loader_path/../Frameworks
OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" -iframework "${PODS_ROOT}/Crashlytics/OSX" -iframework "${PODS_ROOT}/Fabric/OSX" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" -iframework "${PODS_ROOT}/Sparkle" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Yams"
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"z" -framework "Alamofire" -framework "CocoaLumberjack" -framework "Crashlytics" -framework "Fabric" -framework "LetsMove" -framework "RxCocoa" -framework "RxSwift" -framework "Security" -framework "Sparkle" -framework "SwiftyJSON" -framework "SystemConfiguration" -framework "WebKit" -framework "WebViewJavascriptBridge" -framework "Yams"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}

View File

@ -2,7 +2,7 @@ CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -2,7 +2,7 @@ APPLICATION_EXTENSION_API_ONLY = YES
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Yams
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}