mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-06 01:37:22 +01:00
Add descriptions for unavailable keys (#708)
* Describe unavailable key types * Cleanup
This commit is contained in:
@@ -75,10 +75,23 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
|
||||
Section {
|
||||
VStack {
|
||||
Picker(.createSecretKeyTypeLabel, selection: $keyType) {
|
||||
ForEach(store.supportedKeyTypes, id: \.self) { option in
|
||||
ForEach(store.supportedKeyTypes.available, id: \.self) { option in
|
||||
Text(String(describing: option))
|
||||
.tag(option)
|
||||
.font(.caption)
|
||||
}
|
||||
Divider()
|
||||
ForEach(store.supportedKeyTypes.unavailable, id: \.keyType) { option in
|
||||
VStack {
|
||||
Button {
|
||||
} label: {
|
||||
Text(String(describing: option.keyType))
|
||||
switch option.reason {
|
||||
case .macOSUpdateRequired:
|
||||
Text(.createSecretKeyTypeMacOSUpdateRequiredLabel)
|
||||
}
|
||||
}
|
||||
}
|
||||
.selectionDisabled()
|
||||
}
|
||||
}
|
||||
if keyType?.algorithm == .mldsa {
|
||||
@@ -119,7 +132,7 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
|
||||
.padding()
|
||||
}
|
||||
.onAppear {
|
||||
keyType = store.supportedKeyTypes.first
|
||||
keyType = store.supportedKeyTypes.available.first
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
}
|
||||
@@ -146,6 +159,6 @@ struct CreateSecretView<StoreType: SecretStoreModifiable>: View {
|
||||
|
||||
}
|
||||
|
||||
//#Preview {
|
||||
// CreateSecretView(store: Preview.StoreModifiable()) { _ in }
|
||||
//}
|
||||
#Preview {
|
||||
CreateSecretView(store: Preview.StoreModifiable()) { _ in }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user