﻿define(['appSettings', 'connectionManager'], function (appSettings, connectionManager) {
    'use strict';

    var syncPromise;

    return {

        sync: function (options) {

            if (syncPromise) {
                return syncPromise;
            }

            return new Promise(function (resolve, reject) {

                require(['multiserversync'], function (MultiServerSync) {

                    options = options || {};

                    options.cameraUploadServers = appSettings.cameraUploadServers();

                    syncPromise = new MultiServerSync().sync(connectionManager, options).then(function () {

                        syncPromise = null;
                        resolve();

                    }, function () {

                        syncPromise = null;
                        reject();
                    });
                });

            });
        },

        getSyncStatus: function () {

            if (syncPromise != null) {
                return 'Syncing';
            }
            return 'Idle';
        }
    };

});
@@ -894,172 +894,8 @@
 %7D);%0A
-        %7D,%0A%0A        getSyncStatus: function () %7B%0A%0A            if (syncPromise != null) %7B%0A                return 'Syncing';%0A            %7D%0A            return 'Idle';%0A
     

update localsync.js