fix network reader after reconnection to the network

This commit is contained in:
Serhiy Mytrovtsiy
2020-06-21 16:44:31 +02:00
parent b22c74196b
commit de64f943eb
4 changed files with 1 additions and 8 deletions

View File

@@ -147,7 +147,7 @@ internal class Popup: NSView {
public func usageCallback(_ value: Usage) {
DispatchQueue.main.async(execute: {
if !self.window!.isVisible && self.initialized {
if !self.window!.isVisible && self.initialized && value.active {
return
}

View File

@@ -32,12 +32,10 @@ internal class UsageReader: Reader<Usage> {
self.reachability!.whenReachable = { _ in
self.readInformation()
self.start()
}
self.reachability!.whenUnreachable = { _ in
self.usage.reset()
self.callback(self.usage)
self.stop()
}
}

View File

@@ -259,10 +259,6 @@ private class SettingsView: NSView {
NSWorkspace.shared.open(URL(string: "https://github.com/exelban/stats/issues/new")!)
}
@objc public func aboutApp(_ sender: Any) {
print("about app")
}
@objc public func closeApp(_ sender: Any) {
NSApp.terminate(sender)
}

View File

@@ -130,7 +130,6 @@ public class SystemKit {
name = name.replacingOccurrences(of: "CPU", with: "")
name = name.replacingOccurrences(of: " @ ", with: "")
}
print(name)
var size = UInt32(MemoryLayout<host_basic_info_data_t>.size / MemoryLayout<integer_t>.size)
let hostInfo = host_basic_info_t.allocate(capacity: 1)