From 13537130a0809dead6ccb5b3a5f32561a9309077 Mon Sep 17 00:00:00 2001 From: Yishi Lin Date: Mon, 29 Jan 2018 04:00:36 +0800 Subject: [PATCH] Dismiss passcode alert after unlock --- passKit/Controllers/PasscodeLockViewController.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/passKit/Controllers/PasscodeLockViewController.swift b/passKit/Controllers/PasscodeLockViewController.swift index 534c4e3..9663d64 100644 --- a/passKit/Controllers/PasscodeLockViewController.swift +++ b/passKit/Controllers/PasscodeLockViewController.swift @@ -57,15 +57,20 @@ open class PasscodeLockViewController: UIViewController { internal func dismissPasscodeLock(completionHandler: (() -> Void)? = nil) { // clean up the textfield - enterPasscodeAlert.textFields?[0].text = "" + DispatchQueue.main.async { + self.enterPasscodeAlert.textFields?[0].text = "" + self.enterPasscodeAlert.dismiss(animated: false, completion: nil) + } + + // pop if presentingViewController?.presentedViewController == self { // if presented as modal dismiss(animated: true, completion: { [weak self] in self?.dismissCompletionCallback?() completionHandler?() }) - // if pushed in a navigation controller } else { + // if pushed in a navigation controller _ = navigationController?.popViewController(animated: true) dismissCompletionCallback?() completionHandler?() @@ -83,8 +88,6 @@ open class PasscodeLockViewController: UIViewController { } public func authenticate() { - print(enterPasscodeAlert.isBeingPresented) - let myContext = LAContext() let myLocalizedReasonString = "Authentication is needed to access Pass." var authError: NSError?