mirror of
https://github.com/maxgoedjen/secretive.git
synced 2024-11-26 23:47:08 +00:00
c80a6f1b0b
* Set up and start main content view * Continue * Setup flow * No secure storage view * Delete * Detail * Rename * More create * Empty. * List * Main app * Agent and bump * .
57 lines
1.6 KiB
Swift
57 lines
1.6 KiB
Swift
import SwiftUI
|
|
import SecretKit
|
|
|
|
struct DeleteSecretView<StoreType: SecretStoreModifiable>: View {
|
|
|
|
@ObservedObject var store: StoreType
|
|
let secret: StoreType.SecretType
|
|
var dismissalBlock: (Bool) -> ()
|
|
|
|
@State private var confirm = ""
|
|
|
|
var body: some View {
|
|
VStack {
|
|
HStack {
|
|
Image(nsImage: NSApplication.shared.applicationIconImage)
|
|
.resizable()
|
|
.frame(width: 64, height: 64)
|
|
.padding()
|
|
VStack {
|
|
HStack {
|
|
Text("delete_confirmation_title_\(secret.name)").bold()
|
|
Spacer()
|
|
}
|
|
HStack {
|
|
Text("delete_confirmation_description_\(secret.name)_\(secret.name)")
|
|
Spacer()
|
|
}
|
|
HStack {
|
|
Text("delete_confirmation_confirm_name_label")
|
|
TextField(secret.name, text: $confirm)
|
|
}
|
|
}
|
|
}
|
|
HStack {
|
|
Spacer()
|
|
Button("delete_confirmation_delete_button", action: delete)
|
|
.disabled(confirm != secret.name)
|
|
Button("delete_confirmation_cancel_button") {
|
|
dismissalBlock(false)
|
|
}
|
|
.keyboardShortcut(.cancelAction)
|
|
}
|
|
}
|
|
.padding()
|
|
.frame(minWidth: 400)
|
|
.onExitCommand {
|
|
dismissalBlock(false)
|
|
}
|
|
}
|
|
|
|
func delete() {
|
|
try! store.delete(secret: secret)
|
|
dismissalBlock(true)
|
|
}
|
|
|
|
}
|