<commit_before>import Foundation
import LocalAuthentication

@objc(Fingerprint) class Fingerprint : CDVPlugin {

  func isAvailable(_ command: CDVInvokedUrlCommand){
    let authenticationContext = LAContext();
    var error:NSError?;

    let available = authenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error);

    var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Not available");
    if available == true {
      pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "Available");
    }

    commandDelegate.send(pluginResult, callbackId:command.callbackId);
  }

  func authenticate(_ command: CDVInvokedUrlCommand){
    let authenticationContext = LAContext();
    var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Something went wrong");
    var reason = "Authentication";
    let data  = command.arguments[0] as AnyObject?;

    var policy:LAPolicy = .deviceOwnerAuthenticationWithBiometrics;
    if let disableBackup = data?["disableBackup"] as! Bool? {
        if disableBackup {
            authenticationContext.localizedFallbackTitle = "";
            policy = .deviceOwnerAuthenticationWithBiometrics;
        }else{
          if let localizedFallbackTitle = data?["localizedFallbackTitle"] as! String? {
            authenticationContext.localizedFallbackTitle = localizedFallbackTitle;
          }

          if #available(iOS 9.0, *) {
              policy = .deviceOwnerAuthentication;
          }
      }
    }

    authenticationContext.evaluatePolicy(
      policy,
      localizedReason: reason,
      reply: { [unowned self] (success, error) -> Void in
        if( success ) {
          pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "Success");
        }else {
          // Check if there is an error
          if error != nil {
            pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Error: \(error)");
          }
        }
        self.commandDelegate.send(pluginResult, callbackId:command.callbackId);
      });
    }
  }<commit_msg>Fixed issue with enter passcode feature<commit_after>import Foundation
import LocalAuthentication

@objc(Fingerprint) class Fingerprint : CDVPlugin {

  func isAvailable(_ command: CDVInvokedUrlCommand){
    let authenticationContext = LAContext();
    var error:NSError?;

    let available = authenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error);

    var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Not available");
    if available == true {
      pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "Available");
    }

    commandDelegate.send(pluginResult, callbackId:command.callbackId);
  }

  func authenticate(_ command: CDVInvokedUrlCommand){
    let authenticationContext = LAContext();
    var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Something went wrong");
    var reason = "Authentication";
    let data  = command.arguments[0] as AnyObject?;

    var policy:LAPolicy = .deviceOwnerAuthenticationWithBiometrics;
    if #available(iOS 9.0, *) {
        policy = .deviceOwnerAuthentication;
    }
    if let disableBackup = data?["disableBackup"] as! Bool? {
        if disableBackup {
            authenticationContext.localizedFallbackTitle = "";
            policy = .deviceOwnerAuthenticationWithBiometrics;
        } else {
          if let localizedFallbackTitle = data?["localizedFallbackTitle"] as! String? {
            authenticationContext.localizedFallbackTitle = localizedFallbackTitle;
          }
      }
    }

    authenticationContext.evaluatePolicy(
      policy,
      localizedReason: reason,
      reply: { [unowned self] (success, error) -> Void in
        if( success ) {
          pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "Success");
        }else {
          // Check if there is an error
          if error != nil {
            pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "Error: \(error)");
          }
        }
        self.commandDelegate.send(pluginResult, callbackId:command.callbackId);
      });
    }
  }
{'fraction_non_alphanumeric': 0.09169590643274854, 'fraction_numerical': 0.0014035087719298245, 'mean_word_length': 3.3411167512690354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2068718', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1123, 'n_words': 257}