Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix/biometrical-unlock-setup] Fix: Setup Passcode with Biometrical Unlock #1112

Merged
merged 2 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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