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";
|
"Protect App Settings Dialog title" = "App protection";
|
||||||
"FaceID" = "FaceID";
|
"FaceID" = "FaceID";
|
||||||
"TouchID" = "TouchID";
|
"TouchID" = "TouchID";
|
||||||
|
"Authenticate to encrypt data with %@" = "Authenticate to encrypt data with %@";
|
||||||
"Password" = "Password";
|
"Password" = "Password";
|
||||||
"Unprotected" = "Unprotected";
|
"Unprotected" = "Unprotected";
|
||||||
"Authenticate with TouchID" = "Authenticate with TouchID";
|
"Authenticate with TouchID" = "Authenticate with TouchID";
|
||||||
|
|
|
@ -215,8 +215,8 @@ class AuthenticationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func authenticateUserWithBiometric(_ authenticationResult: @escaping (Bool, String?) -> Void) {
|
func authenticateUserWithBiometric(_ prompt: String, _ authenticationResult: @escaping (Bool, String?) -> Void) {
|
||||||
biometricAuthenticationService.authenticate("Authenticate with biometrics to unlock app reason", authenticationResult)
|
biometricAuthenticationService.authenticate(prompt, authenticationResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
func authenticateUserWithPassword(_ enteredPassword: String, _ authenticationResult: @escaping (Bool, String?) -> Void) {
|
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";
|
"Protect App Settings Dialog title" = "Appzugangsschutz";
|
||||||
"FaceID" = "FaceID";
|
"FaceID" = "FaceID";
|
||||||
"TouchID" = "TouchID";
|
"TouchID" = "TouchID";
|
||||||
|
"Authenticate to encrypt data with %@" = "Authentifizieren Sie sich um Ihre Daten mit %@ zu schützen";
|
||||||
"Password" = "Passwort";
|
"Password" = "Passwort";
|
||||||
"Unprotected" = "Ungeschützt";
|
"Unprotected" = "Ungeschützt";
|
||||||
"Authenticate with TouchID" = "Mit TouchID authentifizieren";
|
"Authenticate with TouchID" = "Mit TouchID authentifizieren";
|
||||||
|
|
|
@ -94,7 +94,7 @@ struct LoginDialog: View {
|
||||||
|
|
||||||
|
|
||||||
private func loginWithBiometricAuthentication() {
|
private func loginWithBiometricAuthentication() {
|
||||||
authenticationService.authenticateUserWithBiometric(self.handleAuthenticationResult)
|
authenticationService.authenticateUserWithBiometric("Authenticate with biometrics to unlock app reason", self.handleAuthenticationResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func loginWithPasswordOnReturnKeyPress() -> Bool {
|
private func loginWithPasswordOnReturnKeyPress() -> Bool {
|
||||||
|
|
|
@ -144,12 +144,7 @@ struct ProtectAppSettingsDialog: View {
|
||||||
private func getAuthenticationTypeLabel(_ type: AuthenticationType) -> LocalizedStringKey {
|
private func getAuthenticationTypeLabel(_ type: AuthenticationType) -> LocalizedStringKey {
|
||||||
switch type {
|
switch type {
|
||||||
case .biometric:
|
case .biometric:
|
||||||
if authenticationService.deviceSupportsTouchID {
|
return LocalizedStringKey(supportedBiometricAuthenticationTitle)
|
||||||
return "TouchID"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "FaceID"
|
|
||||||
}
|
|
||||||
case .password:
|
case .password:
|
||||||
return "Password"
|
return "Password"
|
||||||
default:
|
default:
|
||||||
|
@ -157,6 +152,15 @@ struct ProtectAppSettingsDialog: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var supportedBiometricAuthenticationTitle: String {
|
||||||
|
if authenticationService.deviceSupportsTouchID {
|
||||||
|
return "TouchID"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return "FaceID"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func selectedAuthenticationTypeChanged(_ type: AuthenticationType) {
|
private func selectedAuthenticationTypeChanged(_ type: AuthenticationType) {
|
||||||
isFaceIDSelected = false
|
isFaceIDSelected = false
|
||||||
isTouchIDSelected = false
|
isTouchIDSelected = false
|
||||||
|
@ -184,7 +188,7 @@ struct ProtectAppSettingsDialog: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func doBiometricAuthentication() {
|
private func doBiometricAuthentication() {
|
||||||
authenticationService.authenticateUserWithBiometric { success, errorMessage in
|
authenticationService.authenticateUserWithBiometric("Authenticate to encrypt data with %@".localize(supportedBiometricAuthenticationTitle.localize())) { success, errorMessage in
|
||||||
self.successfullyAuthenticatedWithBiometricAuthentication = success
|
self.successfullyAuthenticatedWithBiometricAuthentication = success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue