Fix presentation when not enrolled in Touch/Face ID. (#1981)

This commit is contained in:
Doug 2023-10-30 15:02:48 +00:00 committed by GitHub
parent de0656daa3
commit 8f010538ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 13 deletions

View File

@ -47,7 +47,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
/// The unlock screen. /// The unlock screen.
case unlock case unlock
/// The create PIN screen. /// The create PIN screen.
case createPIN case createPIN(replacingExitingPIN: Bool)
/// The allow biometrics screen. /// The allow biometrics screen.
case biometricsPrompt case biometricsPrompt
/// The settings screen. /// The settings screen.
@ -113,26 +113,28 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
switch (event, fromState) { switch (event, fromState) {
case (.start, .initial): case (.start, .initial):
if presentingFlow == .authentication { return .createPIN } if presentingFlow == .authentication { return .createPIN(replacingExitingPIN: false) }
return appLockService.isEnabled ? .unlock : .createPIN return appLockService.isEnabled ? .unlock : .createPIN(replacingExitingPIN: false)
case (.pinEntered, .unlock): case (.pinEntered, .unlock):
return .settings return .settings
case (.cancel, .unlock): case (.cancel, .unlock):
return .complete return .complete
case (.forceLogout, .unlock): case (.forceLogout, .unlock):
return .loggingOut return .loggingOut
case (.pinEntered, .createPIN): case (.pinEntered, .createPIN(let replacingExitingPIN)):
if presentingFlow == .authentication { if presentingFlow == .authentication {
return appLockService.biometryType != .none ? .biometricsPrompt : .complete return appLockService.biometryType != .none ? .biometricsPrompt : .complete
} else { } else if !replacingExitingPIN {
return appLockService.biometricUnlockEnabled || appLockService.biometryType == .none ? .settings : .biometricsPrompt return appLockService.biometricUnlockEnabled || appLockService.biometryType == .none ? .settings : .biometricsPrompt
} else {
return .settings
} }
case (.cancel, .createPIN): case (.cancel, .createPIN(let replacingExitingPIN)):
return .complete return replacingExitingPIN ? .settings : .complete
case (.biometricsSet, .biometricsPrompt): case (.biometricsSet, .biometricsPrompt):
return presentingFlow == .settings ? .settings : .complete return presentingFlow == .settings ? .settings : .complete
case (.changePIN, .settings): case (.changePIN, .settings):
return .createPIN return .createPIN(replacingExitingPIN: true)
case (.appLockDisabled, .settings): case (.appLockDisabled, .settings):
return .complete return .complete
default: default:
@ -153,11 +155,12 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
showSettings() showSettings()
case (.createPIN, .biometricsPrompt): case (.createPIN, .biometricsPrompt):
showBiometricsPrompt() showBiometricsPrompt()
case (.createPIN, .settings): case (.createPIN(let replacingExitingPIN), .settings):
navigationStackCoordinator.setSheetCoordinator(nil) if replacingExitingPIN {
// The above is fine for change pin, but not create PIN when biometrics are unavailable. navigationStackCoordinator.setSheetCoordinator(nil) // Reveal the settings screen again.
// Need to track the two flows differently to call the alternative below. } else {
// showSettings() showSettings() // Biometrics was unavailable, push the settings screen now.
}
case (.biometricsPrompt, .settings): case (.biometricsPrompt, .settings):
showSettings() showSettings()
case (.settings, .createPIN): case (.settings, .createPIN):

1
changelog.d/pr-1981.wip Normal file
View File

@ -0,0 +1 @@
Fix a bug when setting up App Lock if biometrics aren't available.