<commit_before>/*
 * ADOBE CONFIDENTIAL
 *
 * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
 *  
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 *
 */

/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
/*global define: false, $: false, _: false, saveAs: false, Backbone: false */
/*global reflowShell: false */
define(function (require, exports, module) {
    "use strict";

    var EdgeInspect = require('lib/inspect/skylab'),
        SkyLabController = EdgeInspect.SkyLabController,
        SkyLabView = EdgeInspect.SkyLabView;
    
    SkyLabView.setBadgeIcon = function () {

    };

    SkyLabView.triggerFollowModeOn = function () {
        if (SkyLabController.isDeviceManagerAlive()) {
            $(SkyLabController).trigger({type: "followmode.popup", mode: "on"});
        }
    };

    SkyLabView.triggerFollowModeOff = function () {
        if (SkyLabController.isDeviceManagerAlive()) {
            $(SkyLabController).trigger({type: "followmode.popup", mode: "off"});
        }
    };

    SkyLabView.triggerFollowUrl = function () {
        // This must be overloaded by the browser specific code
    };

    SkyLabView.triggerPasscodeInvalid = function (devices) {
        $(SkyLabController).trigger({type: "passcode_invalid.popup", devices: devices});
    };

    SkyLabView.triggerShowHostInfo = function () {
        $(SkyLabController).trigger({type: "host_info.popup"});
    };

    SkyLabView.transferComplete = function (reqID) {
        SkyLabController.setNewScreenshotsFlag();
        $(SkyLabController).trigger({type: "transfer_complete.popup"});
    };

    SkyLabView.triggerFirstRunCheck = function () {
        if (SkyLabController.firstRun()) {
            SkyLabController.setShowedFirstRun();
        }
    };

    SkyLabView.triggerPreferencesUpdated = function () {
        $(SkyLabController).trigger({type: "screenshotfolder.options", folder: SkyLabController.getScreenshotFolder()});
    };

    SkyLabView.triggerScreenshotFolderError = function (msg) {
        $(SkyLabController).trigger({type: "screenshotfoldererror.options", message: msg});
    };

    SkyLabView.getSurveyLink = function () {
        return this._surveyLink;
    };

    SkyLabView.shouldFollowThisUrl = function () {
        SkyLabView.shouldFollowThisUrl = function (url) {
            return (url !== SkyLabController.getSurveyLink());
        };
    };

    SkyLabView.openSurvey = function () {

    };

    SkyLabView.triggerDeviceDisconnected = function () {

    };

    SkyLabView.triggerDeviceWantsToPair = function () {
        
    };

    SkyLabView.triggerNowPairingDismiss = function () {

    };

    SkyLabView.triggerDeviceListUpdated = function () {
        $(SkyLabController).trigger({type: "refresh.popup"});
    };

    SkyLabView.triggerDeviceManagerError = function () {
        $(SkyLabController).trigger({type: "appstate.popup", state: "dmerror"});
    };

    SkyLabView.triggerDeviceManagerConnecting = function () {
    };

    SkyLabView.triggerRemoteInspect = function (devices, server) {

    };

    SkyLabView.triggerShowNameChange = function () {

    };

    SkyLabView.triggerSubscriptionHasExpiredMessage = function () {
        $(SkyLabController).trigger({type: "subscriptionexpired.popup"});
    };

    SkyLabView.triggerDevicesArePremium = function () {
        $(SkyLabController).trigger({type: "premiumdevices.popup"});
    };

    SkyLabView.triggerScreenshotsArePremium = function () {
        $(SkyLabController).trigger({type: "premiumscreenshots.popup"});
    };

    SkyLabView.triggerStopShowingBuyMessage = function () {
        $(SkyLabController).trigger({type: "hidebuy.popup"});
    };

    SkyLabView.triggerShowBuyMessage = function () {
        $(SkyLabController).trigger({type: "showbuy.popup"});
    };
    
    SkyLabView.closeToastWithHandle = function () {
        
    };
    
    SkyLabView.trackEvent = function (eventDescription) {
        var s_account   = "<KEY>",
            channel     = "Shadow",
            pageName    = "Shadow: Background",
            server      = "Adobe Shadow",
            prop32      = "en-us",
            imgstr      = "http://stats.adobe.com/b/" +
                               "ss/" + encodeURIComponent(s_account) +
                               "/1/H.24--NS/" + Math.floor(Math.random() * 10000000) +
                               "?pe=lnk_o" +
                               "&ch=" + encodeURIComponent(channel) +
                               "&pageName=" + encodeURIComponent(pageName) +
                               "&pev2=" + encodeURIComponent(eventDescription) +
                               "&server=" + encodeURIComponent(server) +
                               "&c32=" + encodeURIComponent(prop32);
        $.ajax({
            url: imgstr,
            timeout: 5000
        });
        console.log("Event: " + eventDescription);
    };
    
    function initialize() {
        SkyLabController.connectToDeviceManager();
        setInterval(function () {
            SkyLabController.pingDeviceManager();
        }, 20000);
        SkyLabController.triggerFirstRunCheck();
    }

    exports.initialize = initialize;
});
<commit_msg>Make sure to do the firstRun check before connecting to the device manager.<commit_after>/*
 * ADOBE CONFIDENTIAL
 *
 * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
 *  
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 *
 */

/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
/*global define: false, $: false, _: false, saveAs: false, Backbone: false */
/*global reflowShell: false */
define(function (require, exports, module) {
    "use strict";

    var EdgeInspect = require('lib/inspect/skylab'),
        SkyLabController = EdgeInspect.SkyLabController,
        SkyLabView = EdgeInspect.SkyLabView;
    
    SkyLabView.setBadgeIcon = function () {

    };

    SkyLabView.triggerFollowModeOn = function () {
        if (SkyLabController.isDeviceManagerAlive()) {
            $(SkyLabController).trigger({type: "followmode.popup", mode: "on"});
        }
    };

    SkyLabView.triggerFollowModeOff = function () {
        if (SkyLabController.isDeviceManagerAlive()) {
            $(SkyLabController).trigger({type: "followmode.popup", mode: "off"});
        }
    };

    SkyLabView.triggerFollowUrl = function () {
        // This must be overloaded by the browser specific code
    };

    SkyLabView.triggerPasscodeInvalid = function (devices) {
        $(SkyLabController).trigger({type: "passcode_invalid.popup", devices: devices});
    };

    SkyLabView.triggerShowHostInfo = function () {
        $(SkyLabController).trigger({type: "host_info.popup"});
    };

    SkyLabView.transferComplete = function (reqID) {
        SkyLabController.setNewScreenshotsFlag();
        $(SkyLabController).trigger({type: "transfer_complete.popup"});
    };

    SkyLabView.triggerFirstRunCheck = function () {
        if (SkyLabController.firstRun()) {
            SkyLabController.setShowedFirstRun();
        }
    };

    SkyLabView.triggerPreferencesUpdated = function () {
        $(SkyLabController).trigger({type: "screenshotfolder.options", folder: SkyLabController.getScreenshotFolder()});
    };

    SkyLabView.triggerScreenshotFolderError = function (msg) {
        $(SkyLabController).trigger({type: "screenshotfoldererror.options", message: msg});
    };

    SkyLabView.getSurveyLink = function () {
        return this._surveyLink;
    };

    SkyLabView.shouldFollowThisUrl = function () {
        SkyLabView.shouldFollowThisUrl = function (url) {
            return (url !== SkyLabController.getSurveyLink());
        };
    };

    SkyLabView.openSurvey = function () {

    };

    SkyLabView.triggerDeviceDisconnected = function () {

    };

    SkyLabView.triggerDeviceWantsToPair = function () {
        
    };

    SkyLabView.triggerNowPairingDismiss = function () {

    };

    SkyLabView.triggerDeviceListUpdated = function () {
        $(SkyLabController).trigger({type: "refresh.popup"});
    };

    SkyLabView.triggerDeviceManagerError = function () {
        $(SkyLabController).trigger({type: "appstate.popup", state: "dmerror"});
    };

    SkyLabView.triggerDeviceManagerConnecting = function () {
    };

    SkyLabView.triggerRemoteInspect = function (devices, server) {

    };

    SkyLabView.triggerShowNameChange = function () {

    };

    SkyLabView.triggerSubscriptionHasExpiredMessage = function () {
        $(SkyLabController).trigger({type: "subscriptionexpired.popup"});
    };

    SkyLabView.triggerDevicesArePremium = function () {
        $(SkyLabController).trigger({type: "premiumdevices.popup"});
    };

    SkyLabView.triggerScreenshotsArePremium = function () {
        $(SkyLabController).trigger({type: "premiumscreenshots.popup"});
    };

    SkyLabView.triggerStopShowingBuyMessage = function () {
        $(SkyLabController).trigger({type: "hidebuy.popup"});
    };

    SkyLabView.triggerShowBuyMessage = function () {
        $(SkyLabController).trigger({type: "showbuy.popup"});
    };
    
    SkyLabView.closeToastWithHandle = function () {
        
    };
    
    SkyLabView.trackEvent = function (eventDescription) {
        var s_account   = "<KEY>",
            channel     = "Shadow",
            pageName    = "Shadow: Background",
            server      = "Adobe Shadow",
            prop32      = "en-us",
            imgstr      = "http://stats.adobe.com/b/" +
                               "ss/" + encodeURIComponent(s_account) +
                               "/1/H.24--NS/" + Math.floor(Math.random() * 10000000) +
                               "?pe=lnk_o" +
                               "&ch=" + encodeURIComponent(channel) +
                               "&pageName=" + encodeURIComponent(pageName) +
                               "&pev2=" + encodeURIComponent(eventDescription) +
                               "&server=" + encodeURIComponent(server) +
                               "&c32=" + encodeURIComponent(prop32);
        $.ajax({
            url: imgstr,
            timeout: 5000
        });
        console.log("Event: " + eventDescription);
    };
    
    function initialize() {
        SkyLabController.triggerFirstRunCheck();
        SkyLabController.connectToDeviceManager();
        setInterval(function () {
            SkyLabController.pingDeviceManager();
        }, 20000);
    }

    exports.initialize = initialize;
});

{'fraction_non_alphanumeric': 0.12050610820244329, 'fraction_numerical': 0.00593368237347295, 'mean_word_length': 2.5995603015075375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '4593640', 'n_tokens_mistral': 3394, 'n_tokens_neox': 3065, 'n_words': 596}