2024-02-29 18:56:23 +00:00
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
enum CommentStyle: String, CaseIterable, Identifiable {
|
2024-04-05 08:29:47 +00:00
|
|
|
case keyAndHost = "keyAndHost"
|
|
|
|
case none = "none"
|
|
|
|
|
2024-02-29 18:56:23 +00:00
|
|
|
var id: Self { self }
|
|
|
|
}
|
|
|
|
|
|
|
|
struct GeneralSettingsView: View {
|
|
|
|
@AppStorage("com.maxgoedjen.Secretive.commentStyle") var selectedCommentStyle: CommentStyle = .keyAndHost
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
Section(footer: Text("SSH public keys can be extended with an arbitrary comment string without changing the meaning of the key.")
|
|
|
|
.font(.caption)
|
|
|
|
.fontWeight(.light)) {
|
|
|
|
Picker("SSH Public Key Comment", selection: $selectedCommentStyle) {
|
|
|
|
Text("Default").tag(CommentStyle.keyAndHost)
|
|
|
|
Text("None").tag(CommentStyle.none)
|
|
|
|
}
|
|
|
|
.pickerStyle(DefaultPickerStyle())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.padding(20)
|
|
|
|
.frame(width: 350, height: 100)
|
|
|
|
.navigationTitle("Settings")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct SettingsView: View {
|
|
|
|
private enum Tabs: Hashable {
|
|
|
|
case general
|
|
|
|
}
|
|
|
|
var body: some View {
|
|
|
|
TabView {
|
|
|
|
GeneralSettingsView()
|
|
|
|
.tabItem {
|
|
|
|
Label("General", systemImage: "gear")
|
|
|
|
}
|
|
|
|
.tag(Tabs.general)
|
|
|
|
}
|
|
|
|
.padding(20)
|
|
|
|
.frame(width: 500, height: 200)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#Preview {
|
|
|
|
SettingsView()
|
|
|
|
}
|