This commit is contained in:
Max Goedjen
2020-09-12 23:52:08 -06:00
parent 61feb5b7af
commit 4c7e8be740
2 changed files with 8 additions and 6 deletions

View File

@@ -53,8 +53,8 @@ struct ContentView<UpdaterType: UpdaterProtocol, AgentStatusCheckerType: AgentSt
}
.frame(minWidth: 100, idealWidth: 240)
.sheet(item: $deletingSecret) { secret in
if storeList.modifiableStore != nil {
DeleteSecretView(secret: secret, store: storeList.modifiableStore!) { deleted in
if let store = storeList.modifiableStore {
DeleteSecretView(secret: secret, store: store) { deleted in
deletingSecret = nil
if deleted {
active = nextDefaultSecret
@@ -63,7 +63,9 @@ struct ContentView<UpdaterType: UpdaterProtocol, AgentStatusCheckerType: AgentSt
}
}
.sheet(isPresented: $showingCreation) {
CreateSecretView(showing: $showingCreation)
if let store = storeList.modifiableStore {
CreateSecretView(store: store, showing: $showingCreation)
}
}
}
} else {

View File

@@ -1,13 +1,13 @@
import SwiftUI
import SecretKit
struct CreateSecretView: View {
struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
@EnvironmentObject var store: AnySecretStoreModifiable
@ObservedObject var store: StoreType
@Binding var showing: Bool
@State var name = ""
@State var requiresAuthentication = true
@Binding var showing: Bool
var body: some View {
VStack {