mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added macOS widget for Network module
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
import Cocoa
|
||||
import Kit
|
||||
import SystemConfiguration
|
||||
import WidgetKit
|
||||
|
||||
public enum Network_t: String, Codable {
|
||||
case wifi
|
||||
@@ -235,6 +236,12 @@ public class Network: Module {
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
if #available(macOS 11.0, *) {
|
||||
guard let blobData = try? JSONEncoder().encode(raw) else { return }
|
||||
self.userDefaults?.set(blobData, forKey: "Network@UsageReader")
|
||||
WidgetCenter.shared.reloadTimelines(ofKind: Network_entry.kind)
|
||||
}
|
||||
}
|
||||
|
||||
private func connectivityCallback(_ raw: Network_Connectivity?) {
|
||||
|
||||
Reference in New Issue
Block a user