mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +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 }
|
guard appLockService.computeNeedsUnlock(didBecomeActiveAt: .now) else { return .unlocked }
|
||||||
return isBiometricUnlockAvailable ? .attemptingBiometricUnlock : .attemptingPINUnlock
|
return isBiometricUnlockAvailable ? .attemptingBiometricUnlock : .attemptingPINUnlock
|
||||||
case (.attemptingBiometricUnlock, .didFinishBiometricUnlock(let result)):
|
case (.attemptingBiometricUnlock, .didFinishBiometricUnlock(let result)):
|
||||||
return .dismissingBiometricUnlock(result) // Transitional state until the app becomes active again.
|
if ProcessInfo.processInfo.isiOSAppOnMac { // On the Mac the app is already active at this point
|
||||||
case (.dismissingBiometricUnlock(let result), .didBecomeActive):
|
return result.toStateMachineState()
|
||||||
return switch result {
|
} else { // On iOS on the other hand it, biometrics keep it non-active
|
||||||
case .unlocked: .unlocked
|
return .dismissingBiometricUnlock(result) // Transitional state until the app becomes active again.
|
||||||
case .failed: .attemptingPINUnlock
|
|
||||||
case .interrupted: .attemptingBiometricUnlock
|
|
||||||
}
|
}
|
||||||
|
case (.dismissingBiometricUnlock(let result), .didBecomeActive):
|
||||||
|
return result.toStateMachineState()
|
||||||
case (.attemptingPINUnlock, .didUnlockWithPIN):
|
case (.attemptingPINUnlock, .didUnlockWithPIN):
|
||||||
return .unlocked
|
return .unlocked
|
||||||
case (.attemptingPINUnlock, .forceLogout):
|
case (.attemptingPINUnlock, .forceLogout):
|
||||||
@@ -246,3 +246,13 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
|
|||||||
actionsSubject.send(.lockApp)
|
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