<commit_before>import Foundation
import UIKit

@objc(HappieCamera) class HappieCamera : CDVPlugin, cameraDelegate  {

    //let cameraRoll: HappieCameraRoll = HappieCameraRoll();
    //let cameraView = HappieCameraViewController(nibName:"HappieCameraView", bundle:nil);

    var callBackId: String = "";

    func openCamera(_ command: CDVInvokedUrlCommand) {
        //cameraRoll.delegate = self;
        let params: AnyObject = command.arguments[0] as AnyObject!
        let qual: Int = params["quality"] as! Int
        HappieCameraJSON.setQuality(newQual: qual);
        let cameraVC: HappieCameraViewController = HappieCameraViewController(nibName:"HappieCameraView", bundle:nil);
        cameraVC.delegate = self;
        cameraVC.modalTransitionStyle = UIModalTransitionStyle.coverVertical;
        cameraVC.modalPresentationStyle = UIModalPresentationStyle.fullScreen;
        callBackId = command.callbackId;
        self.viewController?.present(cameraVC, animated: true, completion:nil)
    }

    func getProcessingCount(_ command: CDVInvokedUrlCommand) {
        var pluginResult: CDVPluginResult;
        let message = "{\"count\":" + String(HappieCameraJSON.getProcessingCount()) + ", \"total\":" + String(HappieCameraJSON.getTotalImages()) + "}"
        pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: message)
        commandDelegate!.send(pluginResult, callbackId:callBackId)
    }

    func cameraFinished(_ controller: HappieCameraViewController){
        controller.dismiss(animated: true, completion: nil);
        var pluginResult: CDVPluginResult;
        pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "true")
        commandDelegate!.send(pluginResult, callbackId:callBackId)
    }

    func generateThumbnail(_ command: CDVInvokedUrlCommand) {
        let name: String = (command.argument(at: 0) as AnyObject) as! String
        self.commandDelegate.run {
            let thumbGen = HappieCameraThumb();

            if(thumbGen.createThumbAtPathWithName(name: name)){
                let pluginResult: CDVPluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "true")
                self.commandDelegate!.send(pluginResult, callbackId:self.callBackId)
            }
            else {
                let pluginResult: CDVPluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "false")
                self.commandDelegate!.send(pluginResult, callbackId:self.callBackId)
            }
        }
    }
}
<commit_msg>clean up callback id code<commit_after>import Foundation
import UIKit

@objc(HappieCamera) class HappieCamera : CDVPlugin, cameraDelegate  {

    //let cameraRoll: HappieCameraRoll = HappieCameraRoll();
    //let cameraView = HappieCameraViewController(nibName:"HappieCameraView", bundle:nil);

    func openCamera(_ command: CDVInvokedUrlCommand) {
        //cameraRoll.delegate = self;
        let params: AnyObject = command.arguments[0] as AnyObject!
        let qual: Int = params["quality"] as! Int
        HappieCameraJSON.setQuality(newQual: qual);
        let cameraVC: HappieCameraViewController = HappieCameraViewController(nibName:"HappieCameraView", bundle:nil);
        cameraVC.delegate = self;
        cameraVC.modalTransitionStyle = UIModalTransitionStyle.coverVertical;
        cameraVC.modalPresentationStyle = UIModalPresentationStyle.fullScreen;
        self.viewController?.present(cameraVC, animated: true, completion:nil)
    }

    func getProcessingCount(_ command: CDVInvokedUrlCommand) {
        var pluginResult: CDVPluginResult;
        let message = "{\"count\":" + String(HappieCameraJSON.getProcessingCount()) + ", \"total\":" + String(HappieCameraJSON.getTotalImages()) + "}"
        pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: message)
        commandDelegate!.send(pluginResult, callbackId:command.callbackId)
    }

    func cameraFinished(_ controller: HappieCameraViewController){
        controller.dismiss(animated: true, completion: nil);
    }

    func generateThumbnail(_ command: CDVInvokedUrlCommand) {
        let name: String = (command.argument(at: 0) as AnyObject) as! String
        self.commandDelegate.run {
            let thumbGen = HappieCameraThumb();

            if(thumbGen.createThumbAtPathWithName(name: name)){
                let pluginResult: CDVPluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "true")
                self.commandDelegate!.send(pluginResult, callbackId:command.callbackId)
            }
            else {
                let pluginResult: CDVPluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "false")
                self.commandDelegate!.send(pluginResult, callbackId:command.callbackId)
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.0956648603584827, 'fraction_numerical': 0.0008336807002917883, 'mean_word_length': 3.5445075757575757, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, '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': '3071481', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1295, 'n_words': 255}