src/extensions/default/AutoUpdate/main.js
function initiateAutoUpdate(updateParams) {
        _updateParams = updateParams;
        downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS;

        initializeState()
            .done(function () {

                 var setUpdateInProgress = function() {
                    var initNodeFn = function () {
                        isAutoUpdateInitiated = true;
                        postMessageToNode(MessageIds.INITIALIZE_STATE, _updateParams);
                    };

                    if (updateJsonHandler.get('latestBuildNumber') !== _updateParams.latestBuildNumber) {
                        setUpdateStateInJSON('latestBuildNumber', _updateParams.latestBuildNumber)
                            .done(initNodeFn);
                    } else {
                        initNodeFn();
                    }
                };

                checkIfAnotherSessionInProgress()
                    .done(function(inProgress) {
                        if(inProgress) {
                            UpdateInfoBar.showUpdateBar({
                                type: "error",
                                title: Strings.AUTOUPDATE_ERROR,
                                description: Strings.AUTOUPDATE_IN_PROGRESS
                            });
                        } else {
                             setUpdateStateInJSON("autoUpdateInProgress", true)
                                .done(setUpdateInProgress);

                        }
                    })
                    .fail(function() {
                        setUpdateStateInJSON("autoUpdateInProgress", true)
                            .done(setUpdateInProgress);

                    });

            })
            .fail(function () {
                UpdateInfoBar.showUpdateBar({
                    type: "error",
                    title: Strings.INITIALISATION_FAILED,
                    description: ""
                });
            });
    }
function initiateAutoUpdate(updateParams) {
        _updateParams = updateParams;
        downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS;

        initializeState()
            .done(function () {

                 var setUpdateInProgress = function() {
                    var initNodeFn = function () {
                        isAutoUpdateInitiated = true;
                        postMessageToNode(MessageIds.INITIALIZE_STATE, _updateParams);
                    };

                    if (updateJsonHandler.get('latestBuildNumber') !== _updateParams.latestBuildNumber) {
                        setUpdateStateInJSON('latestBuildNumber', _updateParams.latestBuildNumber)
                            .done(initNodeFn);
                    } else {
                        initNodeFn();
                    }
                };

                checkIfAnotherSessionInProgress()
                    .done(function(inProgress) {
                        if(inProgress) {
                            UpdateInfoBar.showUpdateBar({
                                type: "error",
                                title: Strings.AUTOUPDATE_ERROR,
                                description: Strings.AUTOUPDATE_IN_PROGRESS
                            });
                        } else {
                             setUpdateStateInJSON("autoUpdateInProgress", true)
                                .done(setUpdateInProgress);

                        }
                    })
                    .fail(function() {
                        setUpdateStateInJSON("autoUpdateInProgress", true)
                            .done(setUpdateInProgress);

                    });

            })
            .fail(function () {
                UpdateInfoBar.showUpdateBar({
                    type: "error",
                    title: Strings.INITIALISATION_FAILED,
                    description: ""
                });
            });
    }
function initiateAutoUpdate ( updateParams ) { _updateParams = updateParams ; downloadAttemptsRemaining = MAX_DOWNLOAD_ATTEMPTS ; initializeState ( ) . done ( function ( ) { var setUpdateInProgress = function ( ) { var initNodeFn = function ( ) { isAutoUpdateInitiated = true ; postMessageToNode ( MessageIds . INITIALIZE_STATE , _updateParams ) ; } ; if ( updateJsonHandler . get ( 'latestBuildNumber' ) !== _updateParams . latestBuildNumber ) { setUpdateStateInJSON ( 'latestBuildNumber' , _updateParams . latestBuildNumber ) . done ( initNodeFn ) ; } else { initNodeFn ( ) ; } } ; checkIfAnotherSessionInProgress ( ) . done ( function ( inProgress ) { if ( inProgress ) { UpdateInfoBar . showUpdateBar ( { type : "error" , title : Strings . AUTOUPDATE_ERROR , description : Strings . AUTOUPDATE_IN_PROGRESS } ) ; } else { setUpdateStateInJSON ( "autoUpdateInProgress" , true ) . done ( setUpdateInProgress ) ; } } ) . fail ( function ( ) { setUpdateStateInJSON ( "autoUpdateInProgress" , true ) . done ( setUpdateInProgress ) ; } ) ; } ) . fail ( function ( ) { UpdateInfoBar . showUpdateBar ( { type : "error" , title : Strings . INITIALISATION_FAILED , description : "" } ) ; } ) ; }
Handles the auto update event, which is triggered when user clicks GetItNow in UpdateNotification dialog
@param {object} updateParams - json object containing update information {
installerName - name of the installer
downloadURL - download URL
latestBuildNumber - build number
checksum - checksum }
Handles the auto update event which is triggered when user clicks GetItNow in UpdateNotification dialog