Skip to content

v2.2.1 #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_supportcompanion_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
files: ${{github.workspace}}/release/*.pkg

- name: Upload packages
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@v4.6.0
with:
name: packages
path: release/
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.2.1] - 2025-02-26
### Fixed
- 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.

### Added
- 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.


### Changed
- 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.

## [2.2.0] - 2025-01-07
### Changed
- A slight background has been added increasing visaibility of the text.
Expand Down
34 changes: 26 additions & 8 deletions SupportCompanion/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {
}

func setupTrayMenuIconBinding() {
appStateManager.$pendingUpdatesCount
.combineLatest(appStateManager.$systemUpdateCache)
.map { pendingUpdatesCount, systemUpdateCache in
pendingUpdatesCount > 0 || systemUpdateCache.count > 0
}
Publishers.CombineLatest4(
appStateManager.$pendingUpdatesCount,
appStateManager.$systemUpdateCache,
appStateManager.preferences.$hiddenActions,
appStateManager.preferences.$hiddenCards
)
.map { pendingUpdatesCount, systemUpdateCache, hiddenActions, hiddenCards in
let hasPendingUpdates = !hiddenCards.contains("PendingAppUpdates") && pendingUpdatesCount > 0
let hasSoftwareUpdates = !hiddenActions.contains("SoftwareUpdates") && systemUpdateCache.count > 0
return hasPendingUpdates || hasSoftwareUpdates
}
.sink { hasUpdates in
TrayMenuManager.shared.updateTrayIcon(hasUpdates: hasUpdates)
}
Expand All @@ -180,7 +186,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate {

class TrayMenuManager {
static let shared = TrayMenuManager()

let appStateManager = AppStateManager.shared
let fileManager = FileManager.default
private var statusItem: NSStatusItem

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

func updateTrayIcon(hasUpdates: Bool) {
let iconName = "MenuIcon"
guard let baseIcon = NSImage(named: iconName) else {
Logger.shared.logDebug("Failed to load tray icon: \(iconName)")
let base64Logo = appStateManager.preferences.trayMenuBrandingIcon
var showLogo = false
var baseIcon: NSImage?

showLogo = loadLogo(base64Logo: base64Logo)
if showLogo {
baseIcon = NSImage(data: Data(base64Encoded: base64Logo)!)
} else {
baseIcon = NSImage(named: iconName)
}

guard let baseIcon = baseIcon else {
Logger.shared.logError("Error: Failed to load tray menu icon")
return
}

Expand Down
3 changes: 3 additions & 0 deletions SupportCompanion/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ struct ContentView: View {
if showLogo, let logo = brandLogo {
logo
.resizable()
.interpolation(.high)
.antialiased(true)
.scaledToFit()
.frame(maxWidth: 230)
.drawingGroup()
.fixedSize(horizontal: false, vertical: true)
.padding(.top, 20) // Minimal padding
.padding(.horizontal, 20)
Expand Down
4 changes: 2 additions & 2 deletions SupportCompanion/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<string>2.2.1</string>
<key>CFBundleVersion</key>
<string>2.2.0</string>
<string>2.2.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
2 changes: 2 additions & 0 deletions SupportCompanion/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class Preferences: ObservableObject {
@AppStorage("CustomCardsMenuLabel") var customCardsMenuLabel: String = ""

@AppStorage("CustomCardsMenuIcon") var customCardsMenuIcon: String = ""

@AppStorage("TrayMenuBrandingIcon") var trayMenuBrandingIcon: String = ""

// MARK: - Actions

Expand Down
15 changes: 12 additions & 3 deletions SupportCompanion/Services/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,18 @@ class BadgeManager {
private func updateBadge() {
DispatchQueue.main.async {
if self.badgeCount > 0 {
NSApplication.shared.dockTile.showsApplicationBadge = true
NSApplication.shared.dockTile.badgeLabel = nil
NSApplication.shared.dockTile.badgeLabel = String(self.badgeCount)
let prefs = AppStateManager.shared.preferences
let hasPendingUpdates = !prefs.hiddenCards.contains("PendingAppUpdates") && AppStateManager.shared.pendingUpdatesCount > 0
let hasSoftwareUpdates = !prefs.hiddenActions.contains("SoftwareUpdates") && AppStateManager.shared.systemUpdateCache.count > 0
if hasPendingUpdates || hasSoftwareUpdates {
NSApplication.shared.dockTile.showsApplicationBadge = true
NSApplication.shared.dockTile.badgeLabel = nil
NSApplication.shared.dockTile.badgeLabel = String(self.badgeCount)
} else {
NSApplication.shared.dockTile.showsApplicationBadge = false
NSApplication.shared.dockTile.badgeLabel = nil
}

} else {
NSApplication.shared.dockTile.badgeLabel = nil
NSApplication.shared.dockTile.showsApplicationBadge = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class PendingIntuneUpdatesManager {
self.appState.pendingUpdatesCount = updates
}
}
if updates > 0 {
if updates > 0 && !appState.preferences.hiddenCards.contains("PendingAppUpdates") {
NotificationService(appState: appState).sendNotification(
message: appState.preferences.appUpdateNotificationMessage,
buttonText: appState.preferences.appUpdateNotificationButtonText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class PendingMunkiUpdatesManager {
self.appState.pendingUpdatesCount = updates
}
}
if updates > 0 {
if updates > 0 && !appState.preferences.hiddenCards.contains("PendingAppUpdates") {
NotificationService(appState: appState).sendNotification(
message: appState.preferences.appUpdateNotificationMessage,
buttonText: appState.preferences.appUpdateNotificationButtonText,
Expand Down
2 changes: 1 addition & 1 deletion SupportCompanion/ViewModels/SystemUpdatesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SystemUpdatesManager: ObservableObject {
monitorTask = Task {
while !Task.isCancelled {
do {
let result = await ActionHelpers.getSystemUpdateStatus(sendNotification: true)
let result = await ActionHelpers.getSystemUpdateStatus(sendNotification: !appState.preferences.hiddenActions.contains("SoftwareUpdates"))
switch result {
case .success(let (count, updates)):
if count != self.previousUpdateCount {
Expand Down
5 changes: 4 additions & 1 deletion SupportCompanion/Views/TrayMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ struct TrayMenuView: View {
if showLogo, let logo = brandLogo {
logo
.resizable()
.interpolation(.high)
.antialiased(true)
.drawingGroup()
.scaledToFit()
.frame(maxWidth: 150)
.fixedSize(horizontal: false, vertical: true)
Expand Down Expand Up @@ -208,4 +211,4 @@ struct ButtonSection: View {
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 5)
}
}
}
2 changes: 1 addition & 1 deletion build.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ elif [ "$CONFIGURATION" = "Release" ]; then
SIGNING_IDENTITY_APP="Developer ID Application: Mac Admins Open Source (T4SK8ZXCXG)"
SIGNING_IDENTITY="Developer ID Installer: Mac Admins Open Source (T4SK8ZXCXG)"
KEYCHAIN_PROFILE="supportcompanion"
XCODE_PATH="/Applications/Xcode_16.app"
XCODE_PATH="/Applications/Xcode_16.2.app"
TEAM_ID="T4SK8ZXCXG"
else
echo "No configuration set, exiting..."
Expand Down