<commit_before>/**********************************************************************************
 * (c) 2016, Master Technology
 * Licensed under the MIT license or contact me for a Support or Commercial License
 *
 * I do contract work in most languages, so let me solve your problems!
 *
 * Any questions please feel free to email me or put a issue up on the github repo
 * Version 1.1.2                                      <EMAIL>
 *********************************************************************************/
"use strict";

/* jshint camelcase: false */
/* global UIDevice, UIDeviceOrientation, getElementsByTagName, android */

    var application = require('application');

    if (typeof application.AndroidApplication.activityRequestPermissionsEvent === 'undefined') {
        throw new Error("You must be using at least version 2.0 of the TNS runtime and core-modules!");
    }

// Variables to track any pending promises
    var pendingPromises = {}, promiseId = 3000;


    /**
     * This handles the results of getting the permissions!
     */
    application.android.on(application.AndroidApplication.activityRequestPermissionsEvent, function (args) {

        // get current promise set
        var promises = pendingPromises[args.requestCode];

        // We have either gotten a promise from somewhere else or a bug has occurred and android has called us twice
        // In either case we will ignore it...
        if (typeof promises.granted !== 'function') {
            return;
        }

        // Delete it, since we no longer need to track it
        delete pendingPromises[args.requestCode];

        var trackingResults = promises.results;

        var length = args.permissions.length;
        for (var i = 0; i < length; i++) {
            // Convert back to JS String
            var name = args.permissions[i].toString();<commit_msg>Fix: Crash when permission is requested by other plugin<commit_after>/**********************************************************************************
 * (c) 2016, Master Technology
 * Licensed under the MIT license or contact me for a Support or Commercial License
 *
 * I do contract work in most languages, so let me solve your problems!
 *
 * Any questions please feel free to email me or put a issue up on the github repo
 * Version 1.1.2                                      <EMAIL>
 *********************************************************************************/
"use strict";

/* jshint camelcase: false */
/* global UIDevice, UIDeviceOrientation, getElementsByTagName, android */

    var application = require('application');

    if (typeof application.AndroidApplication.activityRequestPermissionsEvent === 'undefined') {
        throw new Error("You must be using at least version 2.0 of the TNS runtime and core-modules!");
    }

// Variables to track any pending promises
    var pendingPromises = {}, promiseId = 3000;


    /**
     * This handles the results of getting the permissions!
     */
    application.android.on(application.AndroidApplication.activityRequestPermissionsEvent, function (args) {

        // get current promise set
        var promises = pendingPromises[args.requestCode];

        // We have either gotten a promise from somewhere else or a bug has occurred and android has called us twice
        // In either case we will ignore it...
        if (!promises || typeof promises.granted !== 'function') {
            return;
        }

        // Delete it, since we no longer need to track it
        delete pendingPromises[args.requestCode];

        var trackingResults = promises.results;

        var length = args.permissions.length;
        for (var i = 0; i < length; i++) {
            // Convert back to JS String
            var name = args.permissions[i].toString();
{'fraction_non_alphanumeric': 0.1621479336667544, 'fraction_numerical': 0.007370360621216109, 'mean_word_length': 2.9215686274509802, 'pattern_counts': {'":': 0, '<': 7, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6575431', 'n_tokens_mistral': 906, 'n_tokens_neox': 847, 'n_words': 364}