From a66aefe8015bdcab8957fda659e9433361e6b5f0 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sun, 2 Jan 2022 22:59:11 -0800 Subject: [PATCH] DO until XPC --- Sources/SecretAgent/AppDelegate.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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) - } - }