Skip to content

Commit

Permalink
[fix/biometrical-unlock-setup] Fix: Setup Passcode with Biometrical U…
Browse files Browse the repository at this point in the history
…nlock (#1112)

* #5086 fix for passcode setup with biometrical unlock enabled:
- biometrical unlock button no longer appear in setup view
- after passcode was successfully setup, show biometrical unlock for permissions dialog

* removed unneeded comment
  • Loading branch information
hosy authored Mar 24, 2022
1 parent 4e1b13b commit fde7e56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions ownCloudAppShared/AppLock/AppLockManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,16 @@ public class AppLockManager: NSObject {
}

// MARK: - Show / Dismiss Passcode View
public func showLockscreenIfNeeded(forceShow: Bool = false, context: LAContext = LAContext()) {
if self.shouldDisplayLockscreen || forceShow {
public func showLockscreenIfNeeded(forceShow: Bool = false, setupMode: Bool = false, context: LAContext = LAContext()) {
if self.shouldDisplayLockscreen || forceShow || setupMode {
lockscreenOpenForced = forceShow
lockscreenOpen = true

// Show biometrical
if !forceShow, !self.shouldDisplayCountdown, self.biometricalAuthenticationSucceeded {
showBiometricalAuthenticationInterface(context: context)
} else if setupMode {
showBiometricalAuthenticationInterface(context: context)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ownCloudAppShared/AppLock/PasscodeSetupCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public class PasscodeSetupCoordinator {
self.completionHandler?(false)
})
if AppLockManager.supportedOnDevice {
AppLockManager.shared.showLockscreenIfNeeded()
AppLockManager.shared.showLockscreenIfNeeded(setupMode: true)
}
} else {
let alertController = UIAlertController(title: biometricalSecurityName, message: String(format:"Unlock using %@?".localized, biometricalSecurityName), preferredStyle: .alert)
Expand All @@ -170,7 +170,7 @@ public class PasscodeSetupCoordinator {
self.completionHandler?(false)
})
if AppLockManager.supportedOnDevice {
AppLockManager.shared.showLockscreenIfNeeded()
AppLockManager.shared.showLockscreenIfNeeded(setupMode: true)
}
}))

Expand Down
2 changes: 1 addition & 1 deletion ownCloudAppShared/AppLock/PasscodeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public class PasscodeViewController: UIViewController, Themeable {
self.screenBlurringEnabled = { self.screenBlurringEnabled }()
self.errorMessageLabel?.minimumScaleFactor = 0.5
self.errorMessageLabel?.adjustsFontSizeToFitWidth = true
self.biometricalButtonHidden = !(!AppLockSettings.shared.biometricalSecurityEnabled || self.cancelButtonHidden)
self.biometricalButtonHidden = !((!AppLockSettings.shared.biometricalSecurityEnabled || !AppLockSettings.shared.lockEnabled) || self.cancelButtonHidden)
updateKeypadButtons()
if let biometricalSecurityName = LAContext().supportedBiometricsAuthenticationName() {
self.biometricalButton?.accessibilityLabel = biometricalSecurityName
Expand Down

0 comments on commit fde7e56

Please sign in to comment.