fix: moved DispatchSource.MemoryPressureEvent to custom RAMPressure enum. Fixed the crashes on some macs (#2212)

This commit is contained in:
Serhiy Mytrovtsiy
2024-11-14 17:00:19 +01:00
parent 354698a389
commit 3d0bfa456d
14 changed files with 65 additions and 43 deletions

View File

@@ -27,8 +27,8 @@ public struct RAM_entry: TimelineEntry {
compressed: 414629888.0,
app: 16369778688.0,
cache: 12575948800.0,
rawPressureLevel: 1,
swap: Swap(total: 0, used: 0, free: 0)
swap: Swap(total: 0, used: 0, free: 0),
pressure: Pressure(level: 1, value: .normal)
)
)
@@ -110,7 +110,7 @@ public struct RAMWidget: Widget {
HStack {
Text(localizedString("Pressure level")).font(.system(size: 12, weight: .regular)).foregroundColor(.secondary)
Spacer()
Text("\(value.rawPressureLevel)")
Text("\(value.pressure.level)")
}
}
} else {