|
@@ -319,6 +319,23 @@
|
|
|
|
|
|
#pragma mark - Passcode -
|
|
|
|
|
|
+- (void)didPerformBiometricValidationRequestInPasscodeViewController:(TOPasscodeViewController *)passcodeViewController
|
|
|
+{
|
|
|
+ LAContext *laContext = [[LAContext alloc] init];
|
|
|
+
|
|
|
+ [laContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"" reply:^(BOOL success, NSError * _Nullable error) {
|
|
|
+
|
|
|
+ if (error != NULL) {
|
|
|
+ // handle error
|
|
|
+ } else if (success) {
|
|
|
+ [CCUtility setBlockCode:@""];
|
|
|
+ [self reloadForm];
|
|
|
+ } else {
|
|
|
+ // handle false response
|
|
|
+ }
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
- (void)passcodeSettingsViewController:(TOPasscodeSettingsViewController *)passcodeSettingsViewController didChangeToNewPasscode:(NSString *)passcode ofType:(TOPasscodeType)type
|
|
|
{
|
|
|
[CCUtility setBlockCode:passcode];
|
|
@@ -346,6 +363,9 @@
|
|
|
|
|
|
- (void)passcode:(XLFormRowDescriptor *)sender
|
|
|
{
|
|
|
+ LAContext *laContext = [[LAContext alloc] init];
|
|
|
+ NSError *error;
|
|
|
+
|
|
|
[self deselectFormRow:sender];
|
|
|
|
|
|
if ([[CCUtility getBlockCode] length] == 0) {
|
|
@@ -375,6 +395,24 @@
|
|
|
passcodeViewController.allowCancel = true;
|
|
|
passcodeViewController.delegate = self;
|
|
|
passcodeViewController.keypadButtonShowLettering = false;
|
|
|
+
|
|
|
+ if ([laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
|
|
|
+ if (error == NULL) {
|
|
|
+ if (@available(iOS 11.0.1, *)) {
|
|
|
+ if (laContext.biometryType == LABiometryTypeFaceID) {
|
|
|
+ passcodeViewController.biometryType = TOPasscodeBiometryTypeFaceID;
|
|
|
+ passcodeViewController.allowBiometricValidation = true;
|
|
|
+ passcodeViewController.automaticallyPromptForBiometricValidation = true;
|
|
|
+ } else if (laContext.biometryType == LABiometryTypeTouchID) {
|
|
|
+ passcodeViewController.biometryType = TOPasscodeBiometryTypeTouchID;
|
|
|
+ passcodeViewController.allowBiometricValidation = true;
|
|
|
+ passcodeViewController.automaticallyPromptForBiometricValidation = true;
|
|
|
+ } else {
|
|
|
+ NSLog(@"No Biometric support");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
[self presentViewController:passcodeViewController animated:YES completion:nil];
|
|
|
}
|