mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:06:00 +00:00
Make LinkNewDeviceScreen fall back to the App Lock PIN code when there's no passcode. (#5794)
* Fall back to the AppLock PIN code when there's no passcode. * Add extra tests on the LinkNewDeviceFlowCoordinator. * Misc tweaks for clarification. * Regenerate snapshots.
This commit is contained in:
@@ -16,7 +16,12 @@ class AppLockService: AppLockServiceProtocol {
|
||||
private let context: LAContext
|
||||
|
||||
private let timer: AppLockTimer
|
||||
/// Only use Biometrics to unlock the app, we want to fall back to the App Lock PIN, not the device's passcode.
|
||||
private let unlockPolicy: LAPolicy = .deviceOwnerAuthenticationWithBiometrics
|
||||
/// Use biometrics *or* the device's passcode to verify the device owner. Available regardless of whether biometrics are enrolled.
|
||||
///
|
||||
/// **Note:** Verifying the device owner is used to gate sensitive actions, it isn't related to unlocking the app.
|
||||
/// Maybe we should rename this service in the future.
|
||||
private let deviceOwnerPolicy: LAPolicy = .deviceOwnerAuthentication
|
||||
|
||||
var isMandatory: Bool {
|
||||
|
||||
@@ -88,19 +88,23 @@ protocol AppLockServiceProtocol: AnyObject {
|
||||
/// Attempt to unlock the app using FaceID or TouchID.
|
||||
func unlockWithBiometrics() async -> AppLockServiceBiometricResult
|
||||
|
||||
/// The number of attempts the user had made to unlock with a PIN code.
|
||||
///
|
||||
/// Note: We don't track the biometric attempts as LAContext does that automatically.
|
||||
var numberOfPINAttempts: AnyPublisher<Int, Never> { get }
|
||||
|
||||
// MARK: Device Owner Verification
|
||||
|
||||
/// Verifies the device owner via the device passcode/biometrics, e.g. to gate a sensitive action.
|
||||
///
|
||||
/// This is a standalone identity check: it does **not** unlock the app or touch any App Lock
|
||||
/// state (the grace-period timer or PIN attempt count).
|
||||
/// - Parameter reason: The localised reason shown in the system prompt.
|
||||
func verifyDeviceOwner(reason: String) async -> AppLockDeviceOwnerResult
|
||||
|
||||
/// The number of attempts the user had made to unlock with a PIN code.
|
||||
///
|
||||
/// Note: We don't track the biometric attempts as LAContext does that automatically.
|
||||
var numberOfPINAttempts: AnyPublisher<Int, Never> { get }
|
||||
}
|
||||
|
||||
// MARK: - Mocks
|
||||
|
||||
// sourcery: AutoMockable
|
||||
extension AppLockServiceProtocol { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user