Implemented setting device specific biometric authentication type

This commit is contained in:
dankito 2020-10-08 17:45:18 +02:00
parent c73628539a
commit b564fe15c2
5 changed files with 17 additions and 13 deletions

View File

@ -82,7 +82,7 @@
"Error message from your bank %@" = "Error message from your bank:\n\n%@";
"Secure data?" = "Secure data?";
"Secure data with?" = "Adding account was successful.\n\nDo you want to secure your data and login passwords by password, TouchID or FaceID (if available)?\n\nYou can also do this later in the settings.";
"Secure data with password or %@?" = "Successfully added account.\n\nYour data gets stored encrypted. Do you additionally want to secure your data by password or %@?\n\nYou can also do this later in the settings.";
/* AccountTransactionsDialog */

View File

@ -58,6 +58,15 @@ class AuthenticationService {
return biometricAuthenticationService.isTouchIDSupported
}
var supportedBiometricAuthenticationLocalizedName: String {
if deviceSupportsTouchID {
return "TouchID".localize()
}
else {
return "FaceID".localize()
}
}
func setAuthenticationMethodToPassword(_ newPassword: String) {
setAuthenticationType(.password)

View File

@ -81,8 +81,8 @@
"Could not add account" = "Konto konnte nicht hinzugefügt werden.";
"Error message from your bank %@" = "Fehlermeldung Ihrer Bank:\n\n%@";
"Secure data?" = "Daten schützen?";
"Secure data with?" = "Hinuzufügen war erfolgreich.\n\nMöchten Sie Ihre Daten und Anmeldekennwörter durch Passwort, TouchID oder FaceID (falls vorhanden) schützen?\n\nSie können dies auch später in den Einstellungen vornehmen.";
"Secure data?" = "Appzugang schützen?";
"Secure data with password or %@?" = "Konto erfolgreich hinzugefügt.\n\nIhre Daten werden verschlüsselt gespeichert. Möchten Sie zusätzlich den Appzugang durch Passwort oder %@ schützen?\n\nSie können dies auch später in den Einstellungen vornehmen.";
/* AccountTransactionsDialog */

View File

@ -110,7 +110,7 @@ struct AddAccountDialog: View {
let authenticationService = AuthenticationService()
if self.presenter.allBanks.count == 1 && authenticationService.authenticationType == .none {
UIAlert("Secure data?", "Secure data with?",
UIAlert("Secure data?", "Secure data with password or %@?".localize(authenticationService.supportedBiometricAuthenticationLocalizedName),
UIAlertAction.default("Yes") { SceneDelegate.navigateToView(ProtectAppSettingsDialog()) },
UIAlertAction.cancel("Later", self.closeDialog))
.show()

View File

@ -144,7 +144,7 @@ struct ProtectAppSettingsDialog: View {
private func getAuthenticationTypeLabel(_ type: AuthenticationType) -> LocalizedStringKey {
switch type {
case .biometric:
return LocalizedStringKey(supportedBiometricAuthenticationTitle)
return LocalizedStringKey(supportedBiometricAuthenticationLocalizedName)
case .password:
return "Password"
default:
@ -152,13 +152,8 @@ struct ProtectAppSettingsDialog: View {
}
}
private var supportedBiometricAuthenticationTitle: String {
if authenticationService.deviceSupportsTouchID {
return "TouchID"
}
else {
return "FaceID"
}
private var supportedBiometricAuthenticationLocalizedName: String {
return authenticationService.supportedBiometricAuthenticationLocalizedName
}
private func selectedAuthenticationTypeChanged(_ type: AuthenticationType) {
@ -188,7 +183,7 @@ struct ProtectAppSettingsDialog: View {
}
private func doBiometricAuthentication() {
authenticationService.authenticateUserWithBiometric("Authenticate to encrypt data with %@".localize(supportedBiometricAuthenticationTitle.localize())) { success, errorMessage in
authenticationService.authenticateUserWithBiometric("Authenticate to encrypt data with %@".localize(supportedBiometricAuthenticationLocalizedName)) { success, errorMessage in
self.successfullyAuthenticatedWithBiometricAuthentication = success
}
}