diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/UpdateNotification.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/UpdateNotification.swift index 067d12375..89ce64d28 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/UpdateNotification.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Views/UpdateNotification.swift @@ -27,7 +27,7 @@ class UpdateChecker { private let versionCheckUrl: URL private let marketingVersion: SemanticVersion - @Published public var updateAvailable: Bool = false + @MainActor @Published private(set) var updateAvailable: Bool = false init() { guard let versionCheckUrl = URL(string: "https://www.firezone.dev/api/releases"), @@ -92,13 +92,17 @@ class UpdateChecker { } if latestVersion > marketingVersion { - self.updateAvailable = true + Task { + await MainActor.run { + self.updateAvailable = true - if let lastDismissedVersion = getLastDismissedVersion(), lastDismissedVersion >= latestVersion { - return + if let lastDismissedVersion = getLastDismissedVersion(), lastDismissedVersion >= latestVersion { + return + } + + self.notificationAdapter.showUpdateNotification(version: latestVersion) + } } - - self.notificationAdapter.showUpdateNotification(version: latestVersion) } } @@ -151,7 +155,7 @@ private class NotificationAdapter: NSObject, UNUserNotificationCenterDelegate { } - func showUpdateNotification(version: SemanticVersion) { + @MainActor func showUpdateNotification(version: SemanticVersion) { let content = UNMutableNotificationContent() setLastNotifiedVersion(version: version) content.title = "Update Firezone" diff --git a/website/src/components/Changelog/Apple.tsx b/website/src/components/Changelog/Apple.tsx index de6948b1e..b2cc398bc 100644 --- a/website/src/components/Changelog/Apple.tsx +++ b/website/src/components/Changelog/Apple.tsx @@ -20,6 +20,9 @@ export default function Apple() { {/* When you cut a release, remove any solved issues from the "known issues" lists over in `client-apps`. This must not be done when the issue's PR merges. */} + + Fixes a crash on macOS that could occur when an application update + become available. Fixes a regression that caused a crash if "Open menu" was clicked in the Welcome screen.