mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-04-10 17:47:19 +00:00
Change hard-coded bundleID to automatically retrieved one
This commit is contained in:
parent
607cd1a6a0
commit
aac15f91e4
@ -5,10 +5,9 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
|
||||
|
||||
@ObservedObject var store: StoreType
|
||||
@Binding var showing: Bool
|
||||
@State private var comment = ""
|
||||
|
||||
@State private var name = ""
|
||||
@State private var requiresAuthentication = true
|
||||
let defaults = UserDefaults.standard
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
@ -26,10 +25,6 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
|
||||
Text("Name:")
|
||||
TextField("Shhhhh", text: $name).focusable()
|
||||
}
|
||||
HStack {
|
||||
Text("Comment:")
|
||||
TextField("\(dashedUserName)@\(dashedHostName)", text: $comment).focusable()
|
||||
}
|
||||
HStack {
|
||||
Toggle(isOn: $requiresAuthentication) {
|
||||
Text("Requires Authentication (Biometrics or Password)")
|
||||
@ -50,22 +45,9 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
|
||||
}
|
||||
}.padding()
|
||||
}
|
||||
var dashedUserName: String {
|
||||
NSUserName().replacingOccurrences(of: " ", with: "-")
|
||||
}
|
||||
var dashedHostName: String {
|
||||
[Host.current().localizedName, "local"]
|
||||
.compactMap { $0 }
|
||||
.joined(separator: ".")
|
||||
.replacingOccurrences(of: " ", with: "-")
|
||||
}
|
||||
|
||||
func save() {
|
||||
try! store.create(name: name, requiresAuthentication: requiresAuthentication)
|
||||
if comment != "" {
|
||||
defaults.set(comment, forKey: name)
|
||||
}
|
||||
defaults.set(comment, forKey: name)
|
||||
showing = false
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,6 @@ struct SecretDetailView<SecretType: Secret>: View {
|
||||
|
||||
@State var secret: SecretType
|
||||
|
||||
let defaults = UserDefaults.standard
|
||||
|
||||
private let keyWriter = OpenSSHKeyWriter()
|
||||
|
||||
var body: some View {
|
||||
@ -38,11 +36,7 @@ struct SecretDetailView<SecretType: Secret>: View {
|
||||
}
|
||||
|
||||
var keyString: String {
|
||||
if defaults.string(forKey: secret.name) != "" {
|
||||
return keyWriter.openSSHString(secret: secret, comment: defaults.string(forKey: secret.name))
|
||||
} else {
|
||||
return keyWriter.openSSHString(secret: secret, comment: "\(dashedUserName)@\(dashedHostName)")
|
||||
}
|
||||
keyWriter.openSSHString(secret: secret, comment: "\(dashedUserName)@\(dashedHostName)")
|
||||
}
|
||||
|
||||
func copy() {
|
||||
|
Loading…
Reference in New Issue
Block a user