Skip to content

Commit

Permalink
Hide FIDO settings on iPad since FIDO is not supported over USB-C. Hi…
Browse files Browse the repository at this point in the history
…de NFC settings on iPad. Accessability improvements in updated configuration views.
  • Loading branch information
jensutbult committed Oct 11, 2024
1 parent 18082f9 commit 219d1b2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 30 deletions.
1 change: 1 addition & 0 deletions Authenticator/UI/Helpers/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct SettingsView<Content: View, Buttons: View>: View {
.cornerRadius(13)
.padding(.top, 0)
.padding(.bottom, 0)
.accessibilityHidden(true)
}
content()
}
Expand Down
80 changes: 50 additions & 30 deletions Authenticator/UI/YubiKeyConfiguration/ConfigurationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ struct ConfigurationView: View {
@Binding var showConfiguration: Bool
@State var showInsertYubiKey: Bool = false

var insertYubiKeyMessage = {
if YubiKitDeviceCapabilities.supportsISO7816NFCTags {
String(localized: "Insert YubiKey") + " " + "\(!UIAccessibility.isVoiceOverRunning ? String(localized: "or pull down to activate NFC") : String(localized: "or scan a NFC YubiKey"))"
} else {
String(localized: "Insert YubiKey")
}
}()

var body: some View {
NavigationView {
List {
Expand All @@ -32,7 +40,8 @@ struct ConfigurationView: View {
.frame(width: 100, height: 100)
.foregroundStyle(.secondary)
.padding(15)
Text("Insert YubiKey or pull down to activate NFC")
.accessibilityHidden(true)
Text(insertYubiKeyMessage)
.multilineTextAlignment(.center)
}
.frame(maxWidth: .infinity)
Expand Down Expand Up @@ -88,17 +97,19 @@ struct ConfigurationView: View {
ListIconView(image: Image(systemName: "ellipsis.rectangle"), color: Color(.systemBlue))
Text("Toggle One-Time Password")
}
NavigationLink {
NFCSettingsView()
.navigationBarTitleDisplayMode(.inline)
.navigationTitle("NFC settings")
.background(Color("SheetBackgroundColor"))
.onDisappear {
model.start()
}
} label: {
ListIconView(image: Image(systemName: "dot.radiowaves.left.and.right"), color: Color(.systemBlue))
Text("NFC settings")
if YubiKitDeviceCapabilities.supportsNFCScanning {
NavigationLink {
NFCSettingsView()
.navigationBarTitleDisplayMode(.inline)
.navigationTitle("NFC settings")
.background(Color("SheetBackgroundColor"))
.onDisappear {
model.start()
}
} label: {
ListIconView(image: Image(systemName: "dot.radiowaves.left.and.right"), color: Color(.systemBlue))
Text("NFC settings")
}
}
}
Section("OATH") {
Expand Down Expand Up @@ -127,24 +138,26 @@ struct ConfigurationView: View {
Text("Reset OATH application")
}
}
Section("FIDO") {
NavigationLink {
FIDOPINView()
.onDisappear {
model.start()
}
} label: {
ListIconView(image: Image(systemName: "lock.shield"), color: Color(.systemPurple))
Text("Manage PIN")
}
NavigationLink {
FIDOResetView()
.onDisappear {
model.start()
}
} label: {
ListIconView(image: Image(systemName: "trash"), color: Color(.systemRed), padding: 5)
Text("Reset FIDO application")
if YubiKitDeviceCapabilities.supportsMFIAccessoryKey || YubiKitDeviceCapabilities.supportsISO7816NFCTags {
Section("FIDO") {
NavigationLink {
FIDOPINView()
.onDisappear {
model.start()
}
} label: {
ListIconView(image: Image(systemName: "lock.shield"), color: Color(.systemPurple))
Text("Manage PIN")
}
NavigationLink {
FIDOResetView()
.onDisappear {
model.start()
}
} label: {
ListIconView(image: Image(systemName: "trash"), color: Color(.systemRed), padding: 5)
Text("Reset FIDO application")
}
}
}
Section("PIV") {
Expand All @@ -161,6 +174,13 @@ struct ConfigurationView: View {
}
.navigationTitle(String(localized: "Configuration", comment: "Configuration navigation title"))
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
if UIAccessibility.isVoiceOverRunning {
Button("Scan NFC YubiKey") {
model.scanNFC()
}
}
}
ToolbarItem(placement: .primaryAction) {
Button("Close") {
showConfiguration.toggle()
Expand Down

0 comments on commit 219d1b2

Please sign in to comment.