XPC scaffolding

This commit is contained in:
Max Goedjen
2022-01-02 22:15:18 -08:00
parent 98bf285ad2
commit d80d2ca656
18 changed files with 191 additions and 58 deletions

View File

@@ -87,7 +87,7 @@ extension ContentView {
})
.popover(isPresented: $showingCreation, attachmentAnchor: .point(.bottom), arrowEdge: .bottom) {
if let modifiable = storeList.modifiableStore {
CreateSecretView(store: modifiable, showing: $showingCreation)
CreateSecretView<AnySecretStoreModifiable, AgentCommunicationController>(store: modifiable, showing: $showingCreation)
}
}

View File

@@ -1,9 +1,10 @@
import SwiftUI
import SecretKit
struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
struct CreateSecretView<StoreType: SecretStoreModifiable, AgentCommunicationControllerType: AgentCommunicationControllerProtocol>: View {
@ObservedObject var store: StoreType
@EnvironmentObject private var agentCommunicationController: AgentCommunicationControllerType
@Binding var showing: Bool
@State private var name = ""
@@ -52,6 +53,9 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
func save() {
try! store.create(name: name, requiresAuthentication: requiresAuthentication)
Task {
try! await agentCommunicationController.agent.updatedStore(withID: store.id)
}
showing = false
}
}

View File

@@ -156,7 +156,7 @@ struct SecretAgentSetupView: View {
}
func install() {
LaunchAgentController().install()
AgentLaunchController().install()
buttonAction()
}