@@ -328,20 +328,20 @@ - (void)resetPasscode {
328328- (void )_handleBiometricsFailureAndDisableIt : (BOOL )disableBiometrics {
329329 dispatch_async (dispatch_get_main_queue (), ^{
330330 if (disableBiometrics) {
331- _isUsingBiometrics = NO ;
332- _allowUnlockWithBiometrics = NO ;
331+ self. isUsingBiometrics = NO ;
332+ self. allowUnlockWithBiometrics = NO ;
333333 }
334334
335- _useFallbackPasscode = YES ;
336- _animatingView .hidden = NO ;
335+ self. useFallbackPasscode = YES ;
336+ self. animatingView .hidden = NO ;
337337
338- BOOL usingNavBar = _isUsingNavBar ;
339- NSString *logoutTitle = usingNavBar ? _navBar .items .firstObject .leftBarButtonItem .title : @" " ;
338+ BOOL usingNavBar = self. isUsingNavBar ;
339+ NSString *logoutTitle = usingNavBar ? self. navBar .items .firstObject .leftBarButtonItem .title : @" " ;
340340
341341 [self _resetUI ];
342342
343343 if (usingNavBar) {
344- _isUsingNavBar = usingNavBar;
344+ self. isUsingNavBar = usingNavBar;
345345 [self _setupNavBarWithLogoutTitle: logoutTitle];
346346 }
347347 });
@@ -353,8 +353,13 @@ - (void)_setupFingerPrint {
353353 if (!self.biometricsContext && _allowUnlockWithBiometrics && !_useFallbackPasscode) {
354354 self.biometricsContext = [[LAContext alloc ] init ];
355355
356+ LAPolicy policy = LAPolicyDeviceOwnerAuthenticationWithBiometrics;
357+ if (@available (iOS 9.0 , *)) {
358+ policy = LAPolicyDeviceOwnerAuthentication;
359+ }
360+
356361 NSError *error = nil ;
357- if ([self .biometricsContext canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error: &error]) {
362+ if ([self .biometricsContext canEvaluatePolicy: policy error: &error]) {
358363 if (error) {
359364 return ;
360365 }
@@ -370,12 +375,17 @@ - (void)_setupFingerPrint {
370375 _animatingView.hidden = YES ;
371376
372377 // Authenticate User
373- [self .biometricsContext evaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics
378+ [self .biometricsContext evaluatePolicy: policy
374379 localizedReason: LTHPasscodeViewControllerStrings (self .biometricsDetailsString)
375380 reply: ^(BOOL success, NSError *error) {
376381
377382 if (error || !success) {
378383 [self _handleBiometricsFailureAndDisableIt: false ];
384+
385+ if ([self .delegate respondsToSelector: @selector (biometricsAuthenticationFailed )]) {
386+ [self .delegate performSelector: @selector (biometricsAuthenticationFailed )];
387+ }
388+
379389 return ;
380390 }
381391
@@ -559,7 +569,7 @@ - (void)_dismissMe {
559569 [self _resetUI ];
560570 [_passcodeTextField resignFirstResponder ];
561571 [UIView animateWithDuration: _lockAnimationDuration animations: ^{
562- if (_displayedAsLockScreen ) {
572+ if (self. displayedAsLockScreen ) {
563573 if (LTHiOS8) {
564574 self.view .center = CGPointMake (self.view .center .x , self.view .center .y * 2 .f );
565575 }
@@ -580,18 +590,18 @@ - (void)_dismissMe {
580590 }
581591 else {
582592 // Delete from Keychain
583- if (_isUserTurningPasscodeOff ) {
593+ if (self. isUserTurningPasscodeOff ) {
584594 [self _deletePasscode ];
585595 }
586596 // Update the Keychain if adding or changing passcode
587597 else {
588- [self _savePasscode: _tempPasscode ];
598+ [self _savePasscode: self .tempPasscode ];
589599 // finalize type switching
590- if (_isUserSwitchingBetweenPasscodeModes ) {
591- _isUserConfirmingPasscode = NO ;
600+ if (self. isUserSwitchingBetweenPasscodeModes ) {
601+ self. isUserConfirmingPasscode = NO ;
592602 [self setIsSimple: !self .isSimple
593603 inViewController: nil
594- asModal: _displayedAsModal ];
604+ asModal: self .displayedAsModal ];
595605 }
596606 }
597607 }
@@ -600,15 +610,15 @@ - (void)_dismissMe {
600610 [self .delegate performSelector: @selector (passcodeViewControllerWillClose )];
601611 }
602612
603- if (_displayedAsLockScreen ) {
613+ if (self. displayedAsLockScreen ) {
604614 [self .view removeFromSuperview ];
605615 [self removeFromParentViewController ];
606616 }
607- else if (_displayedAsModal ) {
617+ else if (self. displayedAsModal ) {
608618 [self dismissViewControllerAnimated: YES
609619 completion: nil ];
610620 }
611- else if (!_displayedAsLockScreen ) {
621+ else if (!self. displayedAsLockScreen ) {
612622 [self .navigationController popViewControllerAnimated: NO ];
613623 }
614624 }];
@@ -839,8 +849,8 @@ - (void)updateViewConstraints {
839849
840850 if (self.isSimple ) {
841851 [_digitTextFieldsArray enumerateObjectsUsingBlock: ^(UITextField * _Nonnull textField, NSUInteger idx, BOOL * _Nonnull stop) {
842- CGFloat constant = idx == 0 ? 0 : _horizontalGap ;
843- UIView *toItem = idx == 0 ? _simplePasscodeView : _digitTextFieldsArray [idx - 1 ];
852+ CGFloat constant = idx == 0 ? 0 : self. horizontalGap ;
853+ UIView *toItem = idx == 0 ? self. simplePasscodeView : self. digitTextFieldsArray [idx - 1 ];
844854
845855 NSLayoutConstraint *digitX =
846856 [NSLayoutConstraint constraintWithItem: textField
@@ -855,7 +865,7 @@ - (void)updateViewConstraints {
855865 [NSLayoutConstraint constraintWithItem: textField
856866 attribute: NSLayoutAttributeTop
857867 relatedBy: NSLayoutRelationEqual
858- toItem: _simplePasscodeView
868+ toItem: self .simplePasscodeView
859869 attribute: NSLayoutAttributeTop
860870 multiplier: 1 .0f
861871 constant: 0 ];
@@ -864,7 +874,7 @@ - (void)updateViewConstraints {
864874 [NSLayoutConstraint constraintWithItem: textField
865875 attribute: NSLayoutAttributeBottom
866876 relatedBy: NSLayoutRelationEqual
867- toItem: _simplePasscodeView
877+ toItem: self .simplePasscodeView
868878 attribute: NSLayoutAttributeBottom
869879 multiplier: 1 .0f
870880 constant: 0 ];
@@ -873,12 +883,12 @@ - (void)updateViewConstraints {
873883 [self .view addConstraint: top];
874884 [self .view addConstraint: bottom];
875885
876- if (idx == _digitTextFieldsArray .count - 1 ) {
886+ if (idx == self. digitTextFieldsArray .count - 1 ) {
877887 NSLayoutConstraint *trailing =
878888 [NSLayoutConstraint constraintWithItem: textField
879889 attribute: NSLayoutAttributeTrailing
880890 relatedBy: NSLayoutRelationEqual
881- toItem: _simplePasscodeView
891+ toItem: self .simplePasscodeView
882892 attribute: NSLayoutAttributeTrailing
883893 multiplier: 1 .0f
884894 constant: 0 ];
@@ -1448,7 +1458,7 @@ - (void)_resetTextFields {
14481458 // cancel in the Touch ID prompt. In some cases, the keyboard is present, but invisible
14491459 // after dismissing the alert unless we call becomeFirstResponder with a short delay
14501460 dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
1451- [_passcodeTextField becomeFirstResponder ];
1461+ [self .passcodeTextField becomeFirstResponder ];
14521462 });
14531463 }
14541464
0 commit comments