mirror of
https://github.com/maxgoedjen/secretive.git
synced 2024-11-26 07:27:07 +00:00
Use SettingsStore for querying the comment style in SecretDetailView
Fixes: https://github.com/maxgoedjen/secretive/pull/536#discussion_r1509655340
This commit is contained in:
parent
5cbc4e5f88
commit
e29dd20722
@ -4,7 +4,7 @@ import SecretKit
|
||||
struct SecretDetailView<SecretType: Secret>: View {
|
||||
|
||||
@State var secret: SecretType
|
||||
@AppStorage("com.maxgoedjen.Secretive.commentStyle") var style: CommentStyle = .keyAndHost
|
||||
@EnvironmentObject private var settingsStore: SettingsStore
|
||||
|
||||
private let keyWriter = OpenSSHKeyWriter()
|
||||
private let publicKeyFileStoreController = PublicKeyFileStoreController(homeDirectory: NSHomeDirectory().replacingOccurrences(of: Bundle.main.hostBundleID, with: Bundle.main.agentBundleID))
|
||||
@ -43,11 +43,12 @@ struct SecretDetailView<SecretType: Secret>: View {
|
||||
}
|
||||
|
||||
var keyString: String {
|
||||
var style: CommentStyle = CommentStyle(rawValue: settingsStore["com.maxgoedjen.Secretive.commentStyle"] ?? CommentStyle.keyAndHost.rawValue)!
|
||||
switch style {
|
||||
case CommentStyle.none:
|
||||
keyWriter.openSSHString(secret: secret, comment: "")
|
||||
default:
|
||||
keyWriter.openSSHString(secret: secret, comment: "\(dashedKeyName)@\(dashedHostName)")
|
||||
case .none:
|
||||
return keyWriter.openSSHString(secret: secret, comment: "")
|
||||
case .keyAndHost:
|
||||
return keyWriter.openSSHString(secret: secret, comment: "\(dashedKeyName)@\(dashedHostName)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user