feat: unlocked widgets updates since the chronod was fixed in macOS 26.1 (#2733)

This commit is contained in:
Serhiy Mytrovtsiy
2025-11-13 17:37:46 +01:00
parent f2c87a7ae2
commit cb744f8e99
8 changed files with 23 additions and 34 deletions

View File

@@ -5,7 +5,7 @@ disabled_rules:
- trailing_whitespace - trailing_whitespace
- opening_brace - opening_brace
- implicit_getter - implicit_getter
- redundant_optional_initialization - implicit_optional_initialization
- large_tuple - large_tuple
- function_body_length - function_body_length

View File

@@ -852,7 +852,6 @@ public class BarChartView: NSView {
let blocks: Int = 16 let blocks: Int = 16
let spacing: CGFloat = 2 let spacing: CGFloat = 2
let count: CGFloat = CGFloat(values.count) let count: CGFloat = CGFloat(values.count)
// swiftlint:disable:next empty_count
guard count > 0, self.frame.width > 0, self.frame.height > 0 else { return } guard count > 0, self.frame.width > 0, self.frame.height > 0 else { return }
let partitionSize: CGSize = CGSize(width: (self.frame.width - (count*spacing)) / count, height: self.frame.height) let partitionSize: CGSize = CGSize(width: (self.frame.width - (count*spacing)) / count, height: self.frame.height)

View File

@@ -234,7 +234,6 @@ public class CPU: Module {
} }
if #available(macOS 11.0, *) { if #available(macOS 11.0, *) {
if #unavailable(macOS 26.0) {
guard let blobData = try? JSONEncoder().encode(value) else { return } guard let blobData = try? JSONEncoder().encode(value) else { return }
self.userDefaults?.set(blobData, forKey: "CPU@LoadReader") self.userDefaults?.set(blobData, forKey: "CPU@LoadReader")
WidgetCenter.shared.reloadTimelines(ofKind: CPU_entry.kind) WidgetCenter.shared.reloadTimelines(ofKind: CPU_entry.kind)
@@ -242,4 +241,3 @@ public class CPU: Module {
} }
} }
} }
}

View File

@@ -330,14 +330,12 @@ public class Disk: Module {
} }
if #available(macOS 11.0, *) { if #available(macOS 11.0, *) {
if #unavailable(macOS 26.0) {
guard let blobData = try? JSONEncoder().encode(d) else { return } guard let blobData = try? JSONEncoder().encode(d) else { return }
self.userDefaults?.set(blobData, forKey: "Disk@CapacityReader") self.userDefaults?.set(blobData, forKey: "Disk@CapacityReader")
WidgetCenter.shared.reloadTimelines(ofKind: Disk_entry.kind) WidgetCenter.shared.reloadTimelines(ofKind: Disk_entry.kind)
WidgetCenter.shared.reloadTimelines(ofKind: "UnitedWidget") WidgetCenter.shared.reloadTimelines(ofKind: "UnitedWidget")
} }
} }
}
private func activityCallback(_ value: Disks) { private func activityCallback(_ value: Disks) {
guard self.enabled else { return } guard self.enabled else { return }

View File

@@ -192,7 +192,6 @@ public class GPU: Module {
} }
if #available(macOS 11.0, *) { if #available(macOS 11.0, *) {
if #unavailable(macOS 26.0) {
guard let blobData = try? JSONEncoder().encode(selectedGPU) else { return } guard let blobData = try? JSONEncoder().encode(selectedGPU) else { return }
self.userDefaults?.set(blobData, forKey: "GPU@InfoReader") self.userDefaults?.set(blobData, forKey: "GPU@InfoReader")
WidgetCenter.shared.reloadTimelines(ofKind: GPU_entry.kind) WidgetCenter.shared.reloadTimelines(ofKind: GPU_entry.kind)
@@ -200,4 +199,3 @@ public class GPU: Module {
} }
} }
} }
}

View File

@@ -326,13 +326,11 @@ public class Network: Module {
} }
if #available(macOS 11.0, *) { if #available(macOS 11.0, *) {
if #unavailable(macOS 26.0) {
guard let blobData = try? JSONEncoder().encode(raw) else { return } guard let blobData = try? JSONEncoder().encode(raw) else { return }
self.userDefaults?.set(blobData, forKey: "Network@UsageReader") self.userDefaults?.set(blobData, forKey: "Network@UsageReader")
WidgetCenter.shared.reloadTimelines(ofKind: Network_entry.kind) WidgetCenter.shared.reloadTimelines(ofKind: Network_entry.kind)
} }
} }
}
private func connectivityCallback(_ raw: Network_Connectivity?) { private func connectivityCallback(_ raw: Network_Connectivity?) {
guard let value = raw, self.enabled else { return } guard let value = raw, self.enabled else { return }

View File

@@ -233,7 +233,6 @@ public class RAM: Module {
} }
if #available(macOS 11.0, *) { if #available(macOS 11.0, *) {
if #unavailable(macOS 26.0) {
guard let blobData = try? JSONEncoder().encode(value) else { return } guard let blobData = try? JSONEncoder().encode(value) else { return }
self.userDefaults?.set(blobData, forKey: "RAM@UsageReader") self.userDefaults?.set(blobData, forKey: "RAM@UsageReader")
WidgetCenter.shared.reloadTimelines(ofKind: RAM_entry.kind) WidgetCenter.shared.reloadTimelines(ofKind: RAM_entry.kind)
@@ -241,4 +240,3 @@ public class RAM: Module {
} }
} }
} }
}