feat(menubar): 调整两排卡片布局并加入复合曲线与数值动效
This commit is contained in:
@@ -10,6 +10,7 @@ nonisolated final class NetworkPathObserver: @unchecked Sendable {
|
||||
private let monitor = NWPathMonitor()
|
||||
private let lock = NSLock()
|
||||
private var status: NetworkPathStatus?
|
||||
private var primaryInterface: String?
|
||||
|
||||
init() {
|
||||
monitor.pathUpdateHandler = { [weak self] path in
|
||||
@@ -22,6 +23,7 @@ nonisolated final class NetworkPathObserver: @unchecked Sendable {
|
||||
}
|
||||
self.lock.lock()
|
||||
self.status = next
|
||||
self.primaryInterface = path.status == .satisfied ? path.availableInterfaces.first?.name : nil
|
||||
self.lock.unlock()
|
||||
}
|
||||
monitor.start(queue: DispatchQueue(label: "cn.airnan.kymo.network-path"))
|
||||
@@ -33,5 +35,11 @@ nonisolated final class NetworkPathObserver: @unchecked Sendable {
|
||||
return status
|
||||
}
|
||||
|
||||
func defaultInterface() -> String? {
|
||||
lock.lock()
|
||||
defer { lock.unlock() }
|
||||
return primaryInterface
|
||||
}
|
||||
|
||||
deinit { monitor.cancel() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user