Skip to content

Commit f658d20

Browse files
authored
Merge pull request #69 from macadmins/dev
v2.2.1
2 parents 57fccdd + 2061c72 commit f658d20

File tree

12 files changed

+65
-19
lines changed

12 files changed

+65
-19
lines changed

.github/workflows/build_supportcompanion_prerelease.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
files: ${{github.workspace}}/release/*.pkg
8080

8181
- name: Upload packages
82-
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
82+
uses: actions/upload-artifact@v4.6.0
8383
with:
8484
name: packages
8585
path: release/

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.2.1] - 2025-02-26
8+
### Fixed
9+
- Even if `SoftwareUpdates` or `PendingAppUpdates` were hidden, the badge would still be displayed in the tray menu and dock. This has been fixed by checking if the widget is hidden before displaying the badge.
10+
11+
### Added
12+
- A new option to set a custom branding tray menu icon by specifying a base64 string of the icon using `TrayMenuBrandingIcon`. Note that the icon should be a monochrome icon to fit the design of the tray menu.
13+
14+
15+
### Changed
16+
- Additional options to the rendering of brand logos has been added that allows for a higher quality rendering of the logo as it in some cases could look blurry or jagged.
17+
718
## [2.2.0] - 2025-01-07
819
### Changed
920
- A slight background has been added increasing visaibility of the text.

SupportCompanion/AppDelegate.swift

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
167167
}
168168

169169
func setupTrayMenuIconBinding() {
170-
appStateManager.$pendingUpdatesCount
171-
.combineLatest(appStateManager.$systemUpdateCache)
172-
.map { pendingUpdatesCount, systemUpdateCache in
173-
pendingUpdatesCount > 0 || systemUpdateCache.count > 0
174-
}
170+
Publishers.CombineLatest4(
171+
appStateManager.$pendingUpdatesCount,
172+
appStateManager.$systemUpdateCache,
173+
appStateManager.preferences.$hiddenActions,
174+
appStateManager.preferences.$hiddenCards
175+
)
176+
.map { pendingUpdatesCount, systemUpdateCache, hiddenActions, hiddenCards in
177+
let hasPendingUpdates = !hiddenCards.contains("PendingAppUpdates") && pendingUpdatesCount > 0
178+
let hasSoftwareUpdates = !hiddenActions.contains("SoftwareUpdates") && systemUpdateCache.count > 0
179+
return hasPendingUpdates || hasSoftwareUpdates
180+
}
175181
.sink { hasUpdates in
176182
TrayMenuManager.shared.updateTrayIcon(hasUpdates: hasUpdates)
177183
}
@@ -180,7 +186,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
180186

181187
class TrayMenuManager {
182188
static let shared = TrayMenuManager()
183-
189+
let appStateManager = AppStateManager.shared
190+
let fileManager = FileManager.default
184191
private var statusItem: NSStatusItem
185192

186193
private init() {
@@ -190,8 +197,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
190197

191198
func updateTrayIcon(hasUpdates: Bool) {
192199
let iconName = "MenuIcon"
193-
guard let baseIcon = NSImage(named: iconName) else {
194-
Logger.shared.logDebug("Failed to load tray icon: \(iconName)")
200+
let base64Logo = appStateManager.preferences.trayMenuBrandingIcon
201+
var showLogo = false
202+
var baseIcon: NSImage?
203+
204+
showLogo = loadLogo(base64Logo: base64Logo)
205+
if showLogo {
206+
baseIcon = NSImage(data: Data(base64Encoded: base64Logo)!)
207+
} else {
208+
baseIcon = NSImage(named: iconName)
209+
}
210+
211+
guard let baseIcon = baseIcon else {
212+
Logger.shared.logError("Error: Failed to load tray menu icon")
195213
return
196214
}
197215

SupportCompanion/ContentView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ struct ContentView: View {
3131
if showLogo, let logo = brandLogo {
3232
logo
3333
.resizable()
34+
.interpolation(.high)
35+
.antialiased(true)
3436
.scaledToFit()
3537
.frame(maxWidth: 230)
38+
.drawingGroup()
3639
.fixedSize(horizontal: false, vertical: true)
3740
.padding(.top, 20) // Minimal padding
3841
.padding(.horizontal, 20)

SupportCompanion/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<key>LSMinimumSystemVersion</key>
2020
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2121
<key>CFBundleShortVersionString</key>
22-
<string>2.2.0</string>
22+
<string>2.2.1</string>
2323
<key>CFBundleVersion</key>
24-
<string>2.2.0</string>
24+
<string>2.2.1</string>
2525
<key>CFBundleURLTypes</key>
2626
<array>
2727
<dict>

SupportCompanion/Preferences.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class Preferences: ObservableObject {
8080
@AppStorage("CustomCardsMenuLabel") var customCardsMenuLabel: String = ""
8181

8282
@AppStorage("CustomCardsMenuIcon") var customCardsMenuIcon: String = ""
83+
84+
@AppStorage("TrayMenuBrandingIcon") var trayMenuBrandingIcon: String = ""
8385

8486
// MARK: - Actions
8587

SupportCompanion/Services/NotificationService.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,18 @@ class BadgeManager {
155155
private func updateBadge() {
156156
DispatchQueue.main.async {
157157
if self.badgeCount > 0 {
158-
NSApplication.shared.dockTile.showsApplicationBadge = true
159-
NSApplication.shared.dockTile.badgeLabel = nil
160-
NSApplication.shared.dockTile.badgeLabel = String(self.badgeCount)
158+
let prefs = AppStateManager.shared.preferences
159+
let hasPendingUpdates = !prefs.hiddenCards.contains("PendingAppUpdates") && AppStateManager.shared.pendingUpdatesCount > 0
160+
let hasSoftwareUpdates = !prefs.hiddenActions.contains("SoftwareUpdates") && AppStateManager.shared.systemUpdateCache.count > 0
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+
161170
} else {
162171
NSApplication.shared.dockTile.badgeLabel = nil
163172
NSApplication.shared.dockTile.showsApplicationBadge = false

SupportCompanion/ViewModels/PendingIntuneUpdatesManager.swift

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)