diff --git a/Sources/SecretAgent/AppDelegate.swift b/Sources/SecretAgent/AppDelegate.swift index dbc2d15..6bf0ec2 100644 --- a/Sources/SecretAgent/AppDelegate.swift +++ b/Sources/SecretAgent/AppDelegate.swift @@ -44,15 +44,15 @@ class AppDelegate: NSObject, NSApplicationDelegate { } try? publicKeyFileStoreController.generatePublicKeys(for: storeList.allSecrets, clear: true) notifier.prompt() -// _ = withObservationTracking { -// updater.update -// } onChange: { [updater, notifier] in -// notifier.notify(update: updater.update!) { release in -// Task { -// await updater.ignore(release: release) -// } -// } -// } + _ = withObservationTracking { + updater.update + } onChange: { [updater, notifier] in + Task { + await notifier.notify(update: updater.update!) { release in + await updater.ignore(release: release) + } + } + } } } diff --git a/Sources/SecretAgent/Notifier.swift b/Sources/SecretAgent/Notifier.swift index 4b11f3e..2e53260 100644 --- a/Sources/SecretAgent/Notifier.swift +++ b/Sources/SecretAgent/Notifier.swift @@ -79,7 +79,7 @@ final class Notifier: Sendable { try? await notificationCenter.add(request) } - func notify(update: Release, ignore: (@Sendable (Release) -> Void)?) async { + func notify(update: Release, ignore: (@Sendable (Release) async -> Void)?) async { await notificationDelegate.state.prepareForNotification(release: update, ignoreAction: ignore) let notificationCenter = UNUserNotificationCenter.current() let notificationContent = UNMutableNotificationContent() @@ -134,7 +134,7 @@ final class NotificationDelegate: NSObject, UNUserNotificationCenterDelegate, Se fileprivate actor State { typealias PersistAction = (@Sendable (AnySecret, AnySecretStore, TimeInterval?) async -> Void) - typealias IgnoreAction = (@Sendable (Release) -> Void) + typealias IgnoreAction = (@Sendable (Release) async -> Void) fileprivate var release: Release? fileprivate var ignoreAction: IgnoreAction? fileprivate var persistAction: PersistAction?