mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Fixes #3484 - Correctly interpret application state transitions for the screen lock when running on the Mac
This commit is contained in:
@@ -154,13 +154,13 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
|
||||
guard appLockService.computeNeedsUnlock(didBecomeActiveAt: .now) else { return .unlocked }
|
||||
return isBiometricUnlockAvailable ? .attemptingBiometricUnlock : .attemptingPINUnlock
|
||||
case (.attemptingBiometricUnlock, .didFinishBiometricUnlock(let result)):
|
||||
return .dismissingBiometricUnlock(result) // Transitional state until the app becomes active again.
|
||||
case (.dismissingBiometricUnlock(let result), .didBecomeActive):
|
||||
return switch result {
|
||||
case .unlocked: .unlocked
|
||||
case .failed: .attemptingPINUnlock
|
||||
case .interrupted: .attemptingBiometricUnlock
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac { // On the Mac the app is already active at this point
|
||||
return result.toStateMachineState()
|
||||
} else { // On iOS on the other hand it, biometrics keep it non-active
|
||||
return .dismissingBiometricUnlock(result) // Transitional state until the app becomes active again.
|
||||
}
|
||||
case (.dismissingBiometricUnlock(let result), .didBecomeActive):
|
||||
return result.toStateMachineState()
|
||||
case (.attemptingPINUnlock, .didUnlockWithPIN):
|
||||
return .unlocked
|
||||
case (.attemptingPINUnlock, .forceLogout):
|
||||
@@ -246,3 +246,13 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.send(.lockApp)
|
||||
}
|
||||
}
|
||||
|
||||
private extension AppLockServiceBiometricResult {
|
||||
func toStateMachineState() -> AppLockFlowCoordinator.State {
|
||||
switch self {
|
||||
case .unlocked: .unlocked
|
||||
case .failed: .attemptingPINUnlock
|
||||
case .interrupted: .attemptingBiometricUnlock
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user