修正问题

1. 修正Ping test最后通知最快的并不是实际最快的服务器
2. 临时移除 macOS 10.12 Sierra 网速显示的功能,将会有一个提示
This commit is contained in:
qinyuhang
2016-09-12 08:16:30 +08:00
parent 930ee272b4
commit 6c5af29cc2
3 changed files with 21 additions and 3 deletions
+2 -1
View File
@@ -66,7 +66,8 @@ ref: [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/)
- [ ] Embed the http proxy server [privoxy](http://www.privoxy.org/).
## Know Issue
[Issue 1.]() Auto PAC & White list is not working on macOS 10.12 Serria because system proxy not allow [file:///](file:///) protocol.
Solved [Issue 1.]() Auto PAC & White list is not working on macOS 10.12 Serria because system proxy not allow [file:///](file:///) protocol.
[Issue 2.]() The net speed is how ever have some problem with macOS 10.12, welcome logs from all users.
## License
+18 -1
View File
@@ -26,7 +26,24 @@ public class NetWorkMonitor: NSObject {
func startUpdateTimer() {
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: #selector(updateNetWorkData), userInfo: nil, repeats: true)
NSRunLoop.currentRunLoop().run()
if #available(OSX 10.12, *){
let alertView = NSAlert()
alertView.messageText = "网速显示不支持 macOS 10.12 Sierra!"
alertView.informativeText = "因为 macOS 10.12 Sierra ABI 不稳定,因此暂时移除网速功能"
alertView.addButtonWithTitle("取消网速显示")
alertView.runModal()
let defaults = NSUserDefaults.standardUserDefaults()
defaults.setBool(false, forKey: "enable_showSpeed")
// NSRunLoop.currentRunLoop().run()
// CFRunLoopRun()
} else {
NSRunLoop.currentRunLoop().addTimer(timer!, forMode: NSRunLoopCommonModes)
NSRunLoop.currentRunLoop().run()
print(NSRunLoop.currentRunLoop().getCFRunLoop())
}
}
func stop(){
+1 -1
View File
@@ -101,7 +101,7 @@ class PingServers:NSObject{
self.fastest = latency
self.fastest_id = i
}else{
if latency < self.fastest{
if Int(latency!) < Int(self.fastest!) {
self.fastest = latency
self.fastest_id = i
}