diff --git a/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift b/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift index 2b50a3ce..db36067f 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift +++ b/ui/BankingiOSApp/BankingiOSApp/Security/AuthenticationService.swift @@ -51,7 +51,21 @@ class AuthenticationService { } - func setAuthenticationType(_ type: AuthenticationType) { + func setAuthenticationMethodToPassword(_ newPassword: String) { + setAuthenticationType(.password) + + setLoginPassword(newPassword) + } + + func setAuthenticationMethodToBiometric() { + setAuthenticationType(.biometric) + } + + func removeAppProtection() { + setAuthenticationType(.none) + } + + private func setAuthenticationType(_ type: AuthenticationType) { if needsPasswordToUnlockApp { deleteLoginPassword() } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/ProtectAppSettingsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/ProtectAppSettingsDialog.swift index fc2bb21d..0b1d50d8 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/ProtectAppSettingsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/ProtectAppSettingsDialog.swift @@ -193,13 +193,13 @@ struct ProtectAppSettingsDialog: View { private func setAuthenticationType() { if isFaceIDSelected || isTouchIDSelected { - authenticationService.setAuthenticationType(.biometric) + authenticationService.setAuthenticationMethodToBiometric() } else if isPasswordSelected { - authenticationService.setAuthenticationTypeToPassword(newPassword) + authenticationService.setAuthenticationMethodToPassword(newPassword) } else if isNoAppProtectionSelected { - authenticationService.setAuthenticationType(.none) + authenticationService.removeAppProtection() } presentation.wrappedValue.dismiss()