Implemented translating biometric authentication type

This commit is contained in:
dankito 2020-10-08 17:02:45 +02:00
parent bf9c0bc32b
commit 7047773e7b
3 changed files with 21 additions and 5 deletions

View File

@ -215,11 +215,11 @@ Unfortunately, Bankmeister cannot know whether a bank charges for real-time tran
/* ProtectAppSettingsDialog */
"Protect App Settings Dialog title" = "Select app protection";
"Protect App Settings Dialog title" = "App protection";
"FaceID" = "FaceID";
"TouchID" = "TouchID";
"Password" = "Password";
"None" = "Unprotected";
"Unprotected" = "Unprotected";
"Authenticate with TouchID" = "Authenticate with TouchID";
"Enter new password" = "Enter new password";
"Confirm password" = "Confirm password";

View File

@ -216,11 +216,11 @@ Ob eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leid
/* ProtectAppSettingsDialog */
"Protect App Settings Dialog title" = "Appzugangsschutz festlegen";
"Protect App Settings Dialog title" = "Appzugangsschutz";
"FaceID" = "FaceID";
"TouchID" = "TouchID";
"Password" = "Passwort";
"None" = "Ungeschützt";
"Unprotected" = "Ungeschützt";
"Authenticate with TouchID" = "Mit TouchID authentifizieren";
"Enter new password" = "Neues Passwort eingeben";
"Confirm password" = "Bestätigen";

View File

@ -82,7 +82,7 @@ struct ProtectAppSettingsDialog: View {
Section {
Picker("", selection: selectedAuthenticationTypeIndexBinding) {
ForEach(0..<supportedAuthenticationTypes.count) { index in
Text(self.supportedAuthenticationTypes[index].rawValue.firstLetterUppercased.localize())
Text(self.getAuthenticationTypeLabel(self.supportedAuthenticationTypes[index]))
.tag(index)
}
}
@ -141,6 +141,22 @@ struct ProtectAppSettingsDialog: View {
}
private func getAuthenticationTypeLabel(_ type: AuthenticationType) -> LocalizedStringKey {
switch type {
case .biometric:
if authenticationService.deviceSupportsTouchID {
return "TouchID"
}
else {
return "FaceID"
}
case .password:
return "Password"
default:
return "Unprotected"
}
}
private func selectedAuthenticationTypeChanged(_ type: AuthenticationType) {
isFaceIDSelected = false
isTouchIDSelected = false