-
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability disable the SSH comment via settings
- Loading branch information
Showing
5 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,9 @@ struct Secretive: App { | |
} | ||
SidebarCommands() | ||
} | ||
Settings { | ||
SettingsView() | ||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// SettingsView.swift | ||
// Secretive | ||
// | ||
// Created by Paul Heidekrüger on 05.02.24. | ||
// Copyright © 2024 Max Goedjen. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
enum CommentStyle: String, CaseIterable, Identifiable { | ||
case keyAndHost, none | ||
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() | ||
} |