diff --git a/Sources/SecretAgent/AppDelegate.swift b/Sources/SecretAgent/AppDelegate.swift index 00794f6..cbf20b7 100644 --- a/Sources/SecretAgent/AppDelegate.swift +++ b/Sources/SecretAgent/AppDelegate.swift @@ -33,6 +33,9 @@ class AppDelegate: NSObject, NSApplicationDelegate { DispatchQueue.main.async { self.socketController.handler = self.agent.handle(reader:writer:) } + DistributedNotificationCenter.default().addObserver(forName: .secretStoreUpdated, object: nil, queue: .main) { [self] _ in + try? publicKeyFileStoreController.generatePublicKeys(for: storeList.stores.flatMap({ $0.secrets }), clear: true) + } try? publicKeyFileStoreController.generatePublicKeys(for: storeList.stores.flatMap({ $0.secrets }), clear: true) notifier.prompt() updateSink = updater.$update.sink { update in @@ -41,11 +44,5 @@ class AppDelegate: NSObject, NSApplicationDelegate { } } - func reloadKeys() { - // TODO: This -// storeList.reloadAll() - try? publicKeyFileStoreController.generatePublicKeys(for: storeList.stores.flatMap({ $0.secrets }), clear: true) - } - }