Skip to content

Commit bd95f90

Browse files
committed
Only send notification if action or card is not hidden
1 parent 0618e02 commit bd95f90

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

SupportCompanion/Services/NotificationService.swift

+9-3
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,15 @@ class BadgeManager {
158158
let prefs = AppStateManager.shared.preferences
159159
let hasPendingUpdates = !prefs.hiddenCards.contains("PendingAppUpdates") && AppStateManager.shared.pendingUpdatesCount > 0
160160
let hasSoftwareUpdates = !prefs.hiddenActions.contains("SoftwareUpdates") && AppStateManager.shared.systemUpdateCache.count > 0
161-
NSApplication.shared.dockTile.showsApplicationBadge = hasPendingUpdates || hasSoftwareUpdates
162-
NSApplication.shared.dockTile.badgeLabel = nil
163-
NSApplication.shared.dockTile.badgeLabel = String(self.badgeCount)
161+
if hasPendingUpdates || hasSoftwareUpdates {
162+
NSApplication.shared.dockTile.showsApplicationBadge = true
163+
NSApplication.shared.dockTile.badgeLabel = nil
164+
NSApplication.shared.dockTile.badgeLabel = String(self.badgeCount)
165+
} else {
166+
NSApplication.shared.dockTile.showsApplicationBadge = false
167+
NSApplication.shared.dockTile.badgeLabel = nil
168+
}
169+
164170
} else {
165171
NSApplication.shared.dockTile.badgeLabel = nil
166172
NSApplication.shared.dockTile.showsApplicationBadge = false

SupportCompanion/ViewModels/PendingIntuneUpdatesManager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class PendingIntuneUpdatesManager {
9090
self.appState.pendingUpdatesCount = updates
9191
}
9292
}
93-
if updates > 0 {
93+
if updates > 0 && !appState.preferences.hiddenCards.contains("PendingAppUpdates") {
9494
NotificationService(appState: appState).sendNotification(
9595
message: appState.preferences.appUpdateNotificationMessage,
9696
buttonText: appState.preferences.appUpdateNotificationButtonText,

SupportCompanion/ViewModels/PendingMunkiUpdatesManager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class PendingMunkiUpdatesManager {
120120
self.appState.pendingUpdatesCount = updates
121121
}
122122
}
123-
if updates > 0 {
123+
if updates > 0 && !appState.preferences.hiddenCards.contains("PendingAppUpdates") {
124124
NotificationService(appState: appState).sendNotification(
125125
message: appState.preferences.appUpdateNotificationMessage,
126126
buttonText: appState.preferences.appUpdateNotificationButtonText,

SupportCompanion/ViewModels/SystemUpdatesManager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SystemUpdatesManager: ObservableObject {
3838
monitorTask = Task {
3939
while !Task.isCancelled {
4040
do {
41-
let result = await ActionHelpers.getSystemUpdateStatus(sendNotification: true)
41+
let result = await ActionHelpers.getSystemUpdateStatus(sendNotification: !appState.preferences.hiddenActions.contains("SoftwareUpdates"))
4242
switch result {
4343
case .success(let (count, updates)):
4444
if count != self.previousUpdateCount {

0 commit comments

Comments
 (0)