feat: removed check for macOS 10.14

This commit is contained in:
Serhiy Mytrovtsiy
2023-01-31 18:27:43 +01:00
parent 36d4aa5a88
commit 6c991de101
9 changed files with 39 additions and 184 deletions

View File

@@ -218,24 +218,14 @@ public class CPU: Module {
guard self.notificationLevel != "Disabled", let level = Double(self.notificationLevel) else { return }
if let id = self.notificationID, value < level && self.notificationLevelState {
if #available(macOS 10.14, *) {
removeNotification(id)
} else {
removeNSNotification(id)
}
removeNotification(id)
self.notificationID = nil
self.notificationLevelState = false
} else if value >= level && !self.notificationLevelState {
let title = localizedString("CPU usage threshold")
let subtitle = localizedString("CPU usage is", "\(Int((value)*100))%")
if #available(macOS 10.14, *) {
self.notificationID = showNotification(title: title, subtitle: subtitle)
} else {
self.notificationID = showNSNotification(title: title, subtitle: subtitle)
}
self.notificationID = showNotification(
title: localizedString("CPU usage threshold"),
subtitle: localizedString("CPU usage is", "\(Int((value)*100))%")
)
self.notificationLevelState = true
}
}