Cleanup new sheet
This commit is contained in:
parent
5c8bcd9e78
commit
7e5fc3cb24
|
@ -2,40 +2,51 @@ import SwiftUI
|
||||||
import SecretKit
|
import SecretKit
|
||||||
|
|
||||||
struct CreateSecureEnclaveSecretView: View {
|
struct CreateSecureEnclaveSecretView: View {
|
||||||
|
|
||||||
@ObservedObject var store: SecureEnclave.Store
|
@ObservedObject var store: SecureEnclave.Store
|
||||||
|
|
||||||
@State var name = ""
|
@State var name = ""
|
||||||
@State var requiresAuthentication = true
|
@State var requiresAuthentication = true
|
||||||
|
|
||||||
var dismissalBlock: () -> ()
|
var dismissalBlock: () -> ()
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
VStack {
|
||||||
Section(header: Text("Secret Name")) {
|
HStack {
|
||||||
TextField("Name", text: $name)
|
Image(nsImage: NSApp.applicationIconImage)
|
||||||
}
|
.resizable()
|
||||||
Section {
|
.frame(width: 64, height: 64)
|
||||||
Toggle(isOn: $requiresAuthentication) {
|
.padding()
|
||||||
Text("Requires Authentication (Biometrics or Password)")
|
VStack {
|
||||||
}
|
HStack {
|
||||||
}
|
Text("Create a New Secret").bold()
|
||||||
Section {
|
Spacer()
|
||||||
HStack {
|
}
|
||||||
Spacer()
|
HStack {
|
||||||
Button(action: dismissalBlock) {
|
Text("Name:")
|
||||||
Text("Cancel")
|
TextField("Name", text: $name)
|
||||||
|
}
|
||||||
|
HStack {
|
||||||
|
Toggle(isOn: $requiresAuthentication) {
|
||||||
|
Text("Requires Authentication (Biometrics or Password)")
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
}
|
}
|
||||||
Button(action: save) {
|
|
||||||
Text("Create")
|
|
||||||
}.disabled(name.isEmpty)
|
|
||||||
}
|
}
|
||||||
|
.onExitCommand(perform: dismissalBlock)
|
||||||
}
|
}
|
||||||
}
|
HStack {
|
||||||
.padding()
|
Spacer()
|
||||||
.onExitCommand(perform: dismissalBlock)
|
Button(action: dismissalBlock) {
|
||||||
|
Text("Cancel")
|
||||||
|
}
|
||||||
|
Button(action: save) {
|
||||||
|
Text("Create")
|
||||||
|
}.disabled(name.isEmpty)
|
||||||
|
}
|
||||||
|
}.padding()
|
||||||
}
|
}
|
||||||
|
|
||||||
func save() {
|
func save() {
|
||||||
try! store.create(name: name, requiresAuthentication: requiresAuthentication)
|
try! store.create(name: name, requiresAuthentication: requiresAuthentication)
|
||||||
dismissalBlock()
|
dismissalBlock()
|
||||||
|
|
Loading…
Reference in New Issue