Implemented setting biometric authentication prompt
This commit is contained in:
parent
e36bb0cf33
commit
0f16149dac
|
@ -218,6 +218,7 @@ Unfortunately, Bankmeister cannot know whether a bank charges for real-time tran
|
|||
"Protect App Settings Dialog title" = "App protection";
|
||||
"FaceID" = "FaceID";
|
||||
"TouchID" = "TouchID";
|
||||
"Authenticate to encrypt data with %@" = "Authenticate to encrypt data with %@";
|
||||
"Password" = "Password";
|
||||
"Unprotected" = "Unprotected";
|
||||
"Authenticate with TouchID" = "Authenticate with TouchID";
|
||||
|
|
|
@ -215,8 +215,8 @@ class AuthenticationService {
|
|||
}
|
||||
|
||||
|
||||
func authenticateUserWithBiometric(_ authenticationResult: @escaping (Bool, String?) -> Void) {
|
||||
biometricAuthenticationService.authenticate("Authenticate with biometrics to unlock app reason", authenticationResult)
|
||||
func authenticateUserWithBiometric(_ prompt: String, _ authenticationResult: @escaping (Bool, String?) -> Void) {
|
||||
biometricAuthenticationService.authenticate(prompt, authenticationResult)
|
||||
}
|
||||
|
||||
func authenticateUserWithPassword(_ enteredPassword: String, _ authenticationResult: @escaping (Bool, String?) -> Void) {
|
||||
|
|
|
@ -219,6 +219,7 @@ Ob eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leid
|
|||
"Protect App Settings Dialog title" = "Appzugangsschutz";
|
||||
"FaceID" = "FaceID";
|
||||
"TouchID" = "TouchID";
|
||||
"Authenticate to encrypt data with %@" = "Authentifizieren Sie sich um Ihre Daten mit %@ zu schützen";
|
||||
"Password" = "Passwort";
|
||||
"Unprotected" = "Ungeschützt";
|
||||
"Authenticate with TouchID" = "Mit TouchID authentifizieren";
|
||||
|
|
|
@ -94,7 +94,7 @@ struct LoginDialog: View {
|
|||
|
||||
|
||||
private func loginWithBiometricAuthentication() {
|
||||
authenticationService.authenticateUserWithBiometric(self.handleAuthenticationResult)
|
||||
authenticationService.authenticateUserWithBiometric("Authenticate with biometrics to unlock app reason", self.handleAuthenticationResult)
|
||||
}
|
||||
|
||||
private func loginWithPasswordOnReturnKeyPress() -> Bool {
|
||||
|
|
|
@ -144,17 +144,21 @@ struct ProtectAppSettingsDialog: View {
|
|||
private func getAuthenticationTypeLabel(_ type: AuthenticationType) -> LocalizedStringKey {
|
||||
switch type {
|
||||
case .biometric:
|
||||
return LocalizedStringKey(supportedBiometricAuthenticationTitle)
|
||||
case .password:
|
||||
return "Password"
|
||||
default:
|
||||
return "Unprotected"
|
||||
}
|
||||
}
|
||||
|
||||
private var supportedBiometricAuthenticationTitle: String {
|
||||
if authenticationService.deviceSupportsTouchID {
|
||||
return "TouchID"
|
||||
}
|
||||
else {
|
||||
return "FaceID"
|
||||
}
|
||||
case .password:
|
||||
return "Password"
|
||||
default:
|
||||
return "Unprotected"
|
||||
}
|
||||
}
|
||||
|
||||
private func selectedAuthenticationTypeChanged(_ type: AuthenticationType) {
|
||||
|
@ -184,7 +188,7 @@ struct ProtectAppSettingsDialog: View {
|
|||
}
|
||||
|
||||
private func doBiometricAuthentication() {
|
||||
authenticationService.authenticateUserWithBiometric { success, errorMessage in
|
||||
authenticationService.authenticateUserWithBiometric("Authenticate to encrypt data with %@".localize(supportedBiometricAuthenticationTitle.localize())) { success, errorMessage in
|
||||
self.successfullyAuthenticatedWithBiometricAuthentication = success
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue