function handleValidationStatus(statusObj) {
        enableCheckForUpdateEntry(true);
        UpdateStatus.cleanUpdateStatus();

        if (statusObj.valid) {

            // Installer is validated successfully
            var statusValidFn = function () {

                // Restart button click handler
                var restartBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
                        "autoUpdate",
                        "installNotification",
                        "installNow ",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath);
                };

                // Later button click handler
                var laterBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER,
                        "autoUpdate",
                        "installNotification",
                        "cancel",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    setUpdateStateInJSON('updateInitiatedInPrevSession', false);
                };

                //attaching UpdateBar handlers
                UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked);
                UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked);

                UpdateInfoBar.showUpdateBar({
                    title: Strings.DOWNLOAD_COMPLETE,
                    description: Strings.CLICK_RESTART_TO_UPDATE,
                    needButtons: true
                });

                setUpdateStateInJSON("autoUpdateInProgress", false);
                HealthLogger.sendAnalyticsData(
                    autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED,
                    "autoUpdate",
                    "installNotification",
                    "render",
                    ""
                );
            };

            if(!isAutoUpdateInitiated) {
                isAutoUpdateInitiated = true;
                updateJsonHandler.refresh()
                    .done(function() {
                        setUpdateStateInJSON('downloadCompleted', true)
                        .done(statusValidFn);
                });
            } else {
                 setUpdateStateInJSON('downloadCompleted', true)
                    .done(statusValidFn);
            }
        } else {

            // Installer validation failed

            if (updateJsonHandler.get("downloadCompleted")) {

                // If this was a cached download, retry downloading
                updateJsonHandler.reset();

                var statusInvalidFn = function () {
                    downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS;
                    getLatestInstaller();
                };

                setUpdateStateInJSON('downloadCompleted', false)
                    .done(statusInvalidFn);
            } else {

                // If this is a new download, prompt the message on update bar
                var descriptionMessage = "",
                    analyticsDescriptionMessage = "";

                switch (statusObj.err) {
                case _nodeErrorMessages.CHECKSUM_DID_NOT_MATCH:
                    descriptionMessage = Strings.CHECKSUM_DID_NOT_MATCH;
                    analyticsDescriptionMessage = "Checksum didn't match.";
                    break;
                case _nodeErrorMessages.INSTALLER_NOT_FOUND:
                    descriptionMessage = Strings.INSTALLER_NOT_FOUND;
                    analyticsDescriptionMessage = "Installer not found.";
                    break;
                }
                HealthLogger.sendAnalyticsData(
                    autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_FAILED,
                    "autoUpdate",
                    "download",
                    "fail",
                    analyticsDescriptionMessage
                );
                UpdateInfoBar.showUpdateBar({
                    type: "error",
                    title: Strings.VALIDATION_FAILED,
                    description: descriptionMessage
                });

                setUpdateStateInJSON("autoUpdateInProgress", false);
            }
        }
    }
function handleValidationStatus(statusObj) {
        enableCheckForUpdateEntry(true);
        UpdateStatus.cleanUpdateStatus();

        if (statusObj.valid) {

            // Installer is validated successfully
            var statusValidFn = function () {

                // Restart button click handler
                var restartBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
                        "autoUpdate",
                        "installNotification",
                        "installNow ",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath);
                };

                // Later button click handler
                var laterBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER,
                        "autoUpdate",
                        "installNotification",
                        "cancel",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    setUpdateStateInJSON('updateInitiatedInPrevSession', false);
                };

                //attaching UpdateBar handlers
                UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked);
                UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked);

                UpdateInfoBar.showUpdateBar({
                    title: Strings.DOWNLOAD_COMPLETE,
                    description: Strings.CLICK_RESTART_TO_UPDATE,
                    needButtons: true
                });

                setUpdateStateInJSON("autoUpdateInProgress", false);
                HealthLogger.sendAnalyticsData(
                    autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED,
                    "autoUpdate",
                    "installNotification",
                    "render",
                    ""
                );
            };

            if(!isAutoUpdateInitiated) {
                isAutoUpdateInitiated = true;
                updateJsonHandler.refresh()
                    .done(function() {
                        setUpdateStateInJSON('downloadCompleted', true)
                        .done(statusValidFn);
                });
            } else {
                 setUpdateStateInJSON('downloadCompleted', true)
                    .done(statusValidFn);
            }
        } else {

            // Installer validation failed

            if (updateJsonHandler.get("downloadCompleted")) {

                // If this was a cached download, retry downloading
                updateJsonHandler.reset();

                var statusInvalidFn = function () {
                    downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS;
                    getLatestInstaller();
                };

                setUpdateStateInJSON('downloadCompleted', false)
                    .done(statusInvalidFn);
            } else {

                // If this is a new download, prompt the message on update bar
                var descriptionMessage = "",
                    analyticsDescriptionMessage = "";

                switch (statusObj.err) {
                case _nodeErrorMessages.CHECKSUM_DID_NOT_MATCH:
                    descriptionMessage = Strings.CHECKSUM_DID_NOT_MATCH;
                    analyticsDescriptionMessage = "Checksum didn't match.";
                    break;
                case _nodeErrorMessages.INSTALLER_NOT_FOUND:
                    descriptionMessage = Strings.INSTALLER_NOT_FOUND;
                    analyticsDescriptionMessage = "Installer not found.";
                    break;
                }
                HealthLogger.sendAnalyticsData(
                    autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_FAILED,
                    "autoUpdate",
                    "download",
                    "fail",
                    analyticsDescriptionMessage
                );
                UpdateInfoBar.showUpdateBar({
                    type: "error",
                    title: Strings.VALIDATION_FAILED,
                    description: descriptionMessage
                });

                setUpdateStateInJSON("autoUpdateInProgress", false);
            }
        }
    }
function handleValidationStatus ( statusObj ) { enableCheckForUpdateEntry ( true ) ; UpdateStatus . cleanUpdateStatus ( ) ; if ( statusObj . valid ) { // Installer is validated successfully var statusValidFn = function ( ) { // Restart button click handler var restartBtnClicked = function ( ) { HealthLogger . sendAnalyticsData ( autoUpdateEventNames . AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART , "autoUpdate" , "installNotification" , "installNow " , "click" ) ; detachUpdateBarBtnHandlers ( ) ; initiateUpdateProcess ( statusObj . installerPath , statusObj . logFilePath , statusObj . installStatusFilePath ) ; } ; // Later button click handler var laterBtnClicked = function ( ) { HealthLogger . sendAnalyticsData ( autoUpdateEventNames . AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER , "autoUpdate" , "installNotification" , "cancel" , "click" ) ; detachUpdateBarBtnHandlers ( ) ; setUpdateStateInJSON ( 'updateInitiatedInPrevSession' , false ) ; } ; //attaching UpdateBar handlers UpdateInfoBar . on ( UpdateInfoBar . RESTART_BTN_CLICKED , restartBtnClicked ) ; UpdateInfoBar . on ( UpdateInfoBar . LATER_BTN_CLICKED , laterBtnClicked ) ; UpdateInfoBar . showUpdateBar ( { title : Strings . DOWNLOAD_COMPLETE , description : Strings . CLICK_RESTART_TO_UPDATE , needButtons : true } ) ; setUpdateStateInJSON ( "autoUpdateInProgress" , false ) ; HealthLogger . sendAnalyticsData ( autoUpdateEventNames . AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED , "autoUpdate" , "installNotification" , "render" , "" ) ; } ; if ( ! isAutoUpdateInitiated ) { isAutoUpdateInitiated = true ; updateJsonHandler . refresh ( ) . done ( function ( ) { setUpdateStateInJSON ( 'downloadCompleted' , true ) . done ( statusValidFn ) ; } ) ; } else { setUpdateStateInJSON ( 'downloadCompleted' , true ) . done ( statusValidFn ) ; } } else { // Installer validation failed if ( updateJsonHandler . get ( "downloadCompleted" ) ) { // If this was a cached download, retry downloading updateJsonHandler . reset ( ) ; var statusInvalidFn = function ( ) { downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS ; getLatestInstaller ( ) ; } ; setUpdateStateInJSON ( 'downloadCompleted' , false ) . done ( statusInvalidFn ) ; } else { // If this is a new download, prompt the message on update bar var descriptionMessage = "" , analyticsDescriptionMessage = "" ; switch ( statusObj . err ) { case _nodeErrorMessages . CHECKSUM_DID_NOT_MATCH : descriptionMessage = Strings . CHECKSUM_DID_NOT_MATCH ; analyticsDescriptionMessage = "Checksum didn't match." ; break ; case _nodeErrorMessages . INSTALLER_NOT_FOUND : descriptionMessage = Strings . INSTALLER_NOT_FOUND ; analyticsDescriptionMessage = "Installer not found." ; break ; } HealthLogger . sendAnalyticsData ( autoUpdateEventNames . AUTOUPDATE_DOWNLOAD_FAILED , "autoUpdate" , "download" , "fail" , analyticsDescriptionMessage ) ; UpdateInfoBar . showUpdateBar ( { type : "error" , title : Strings . VALIDATION_FAILED , description : descriptionMessage } ) ; setUpdateStateInJSON ( "autoUpdateInProgress" , false ) ; } } }
Handles the installer validation callback from Node
@param {object} statusObj - json containing - {
valid - (boolean)true for a valid installer, false otherwise,
installerPath, logFilePath,
installStatusFilePath - for a valid installer,
err - for an invalid installer }
Handles the installer validation callback from Node
Handle validation status