|
|
|
@ -1373,11 +1373,15 @@ define([
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var loadUniversal = function (Module, type, waitFor) {
|
|
|
|
|
var loadUniversal = function (Module, type, waitFor, clientId) {
|
|
|
|
|
if (store.modules[type]) { return; }
|
|
|
|
|
store.modules[type] = Module.init({
|
|
|
|
|
Store: Store,
|
|
|
|
|
store: store,
|
|
|
|
|
updateLoadingProgress: function (data) {
|
|
|
|
|
data.type = "team";
|
|
|
|
|
postMessage(clientId, 'LOADING_DRIVE', data);
|
|
|
|
|
},
|
|
|
|
|
updateMetadata: function () {
|
|
|
|
|
broadcast([], "UPDATE_METADATA");
|
|
|
|
|
},
|
|
|
|
@ -2480,9 +2484,6 @@ define([
|
|
|
|
|
addSharedFolderHandler();
|
|
|
|
|
|
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
|
postMessage(clientId, 'LOADING_DRIVE', {
|
|
|
|
|
state: 2
|
|
|
|
|
});
|
|
|
|
|
userObject.migrate(waitFor());
|
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
|
initAnonRpc(null, null, waitFor());
|
|
|
|
@ -2490,22 +2491,25 @@ define([
|
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
|
Migrate(proxy, waitFor(), function (version, progress) {
|
|
|
|
|
postMessage(clientId, 'LOADING_DRIVE', {
|
|
|
|
|
state: (2 + (version / 10)),
|
|
|
|
|
type: 'migrate',
|
|
|
|
|
progress: progress
|
|
|
|
|
});
|
|
|
|
|
}, store);
|
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
|
postMessage(clientId, 'LOADING_DRIVE', {
|
|
|
|
|
state: 3
|
|
|
|
|
});
|
|
|
|
|
userObject.fixFiles();
|
|
|
|
|
SF.loadSharedFolders(Store, store.network, store, userObject, waitFor);
|
|
|
|
|
SF.loadSharedFolders(Store, store.network, store, userObject, waitFor, function (obj) {
|
|
|
|
|
var data = {
|
|
|
|
|
type: 'sf',
|
|
|
|
|
progress: 100*obj.progress/obj.max
|
|
|
|
|
};
|
|
|
|
|
postMessage(clientId, 'LOADING_DRIVE', data);
|
|
|
|
|
});
|
|
|
|
|
loadCursor();
|
|
|
|
|
loadOnlyOffice();
|
|
|
|
|
loadUniversal(Messenger, 'messenger', waitFor);
|
|
|
|
|
store.messenger = store.modules['messenger'];
|
|
|
|
|
loadUniversal(Profile, 'profile', waitFor);
|
|
|
|
|
loadUniversal(Team, 'team', waitFor);
|
|
|
|
|
loadUniversal(Team, 'team', waitFor, clientId);
|
|
|
|
|
loadUniversal(History, 'history', waitFor);
|
|
|
|
|
cleanFriendRequests();
|
|
|
|
|
}).nThen(function () {
|
|
|
|
@ -2607,6 +2611,12 @@ define([
|
|
|
|
|
if (!hash) {
|
|
|
|
|
return void cb({error: '[Store.init] Unable to find or create a drive hash. Aborting...'});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var updateProgress = function (data) {
|
|
|
|
|
data.type = 'drive';
|
|
|
|
|
postMessage(clientId, 'LOADING_DRIVE', data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// No password for drive
|
|
|
|
|
var secret = Hash.getSecrets('drive', hash);
|
|
|
|
|
store.driveChannel = secret.channel;
|
|
|
|
@ -2620,6 +2630,7 @@ define([
|
|
|
|
|
userName: 'fs',
|
|
|
|
|
logLevel: 1,
|
|
|
|
|
ChainPad: ChainPad,
|
|
|
|
|
updateProgress: updateProgress,
|
|
|
|
|
classic: true,
|
|
|
|
|
};
|
|
|
|
|
var rt = window.rt = Listmap.create(listmapConfig);
|
|
|
|
@ -2643,7 +2654,6 @@ define([
|
|
|
|
|
&& !drive['filesData']) {
|
|
|
|
|
drive[Constants.oldStorageKey] = [];
|
|
|
|
|
}
|
|
|
|
|
postMessage(clientId, 'LOADING_DRIVE', { state: 1 });
|
|
|
|
|
// Drive already exist: return the existing drive, don't load data from legacy store
|
|
|
|
|
onReady(clientId, returned, cb);
|
|
|
|
|
})
|
|
|
|
|