Change hard-coded bundleID to automatically retrieved one

This commit is contained in:
Alex Lavallee 2021-01-17 21:37:07 -08:00
parent 607cd1a6a0
commit aac15f91e4
No known key found for this signature in database
GPG Key ID: FF636FB2C9E94B03
2 changed files with 2 additions and 26 deletions

View File

@ -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
}
}

View File

@ -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() {