@@ -43,7 +43,7 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg
4343 internal let passcodeLock : PasscodeLockType
4444 internal var isPlaceholdersAnimationCompleted = true
4545
46- private var shouldTryToAuthenticateWithBiometrics = false
46+ private var shouldTryToAuthenticateWithBiometrics = true
4747
4848 // MARK: - Initializers
4949
@@ -89,8 +89,10 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg
8989 public override func viewDidAppear( animated: Bool ) {
9090 super. viewDidAppear ( animated)
9191
92- shouldTryToAuthenticateWithBiometrics = false
93- authenticateWithBiometrics ( )
92+ if shouldTryToAuthenticateWithBiometrics {
93+
94+ authenticateWithBiometrics ( )
95+ }
9496 }
9597
9698 internal func updatePasscodeView( ) {
@@ -105,26 +107,24 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg
105107
106108 private func setupEvents( ) {
107109
108- notificationCenter? . addObserver ( self , selector: " appDidBecomeActiveHandler :" , name: UIApplicationDidBecomeActiveNotification , object: nil )
110+ notificationCenter? . addObserver ( self , selector: " appWillEnterForegroundHandler :" , name: UIApplicationWillEnterForegroundNotification , object: nil )
109111 notificationCenter? . addObserver ( self , selector: " appDidEnterBackgroundHandler: " , name: UIApplicationDidEnterBackgroundNotification, object: nil )
110112 }
111113
112114 private func clearEvents( ) {
113115
114- notificationCenter? . removeObserver ( self , name: UIApplicationDidBecomeActiveNotification , object: nil )
116+ notificationCenter? . removeObserver ( self , name: UIApplicationWillEnterForegroundNotification , object: nil )
115117 notificationCenter? . removeObserver ( self , name: UIApplicationDidEnterBackgroundNotification, object: nil )
116118 }
117119
118- public func appDidBecomeActiveHandler( notification: NSNotification ) {
119-
120- guard shouldTryToAuthenticateWithBiometrics else { return }
120+ public func appWillEnterForegroundHandler( notification: NSNotification ) {
121121
122122 authenticateWithBiometrics ( )
123123 }
124124
125125 public func appDidEnterBackgroundHandler( notification: NSNotification ) {
126126
127- shouldTryToAuthenticateWithBiometrics = true
127+ shouldTryToAuthenticateWithBiometrics = false
128128 }
129129
130130 // MARK: - Actions
0 commit comments