Fix drive UI stuck offline

pull/1/head
yflory 4 years ago
parent 890e516f3a
commit 96b2b00b24

@ -139,6 +139,9 @@ define([
var folders = {}; var folders = {};
var readOnly; var readOnly;
var startOnline = false;
var onReco;
nThen(function (waitFor) { nThen(function (waitFor) {
$(waitFor(function () { $(waitFor(function () {
UI.addLoadingScreen(); UI.addLoadingScreen();
@ -148,6 +151,10 @@ define([
})); }));
SFCommon.create(waitFor(function (c) { common = c; })); SFCommon.create(waitFor(function (c) { common = c; }));
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
onReco = common.getSframeChannel().on('EV_NETWORK_RECONNECT', function () {
startOnline = true;
});
$('#cp-app-drive-connection-state').text(Messages.disconnected); $('#cp-app-drive-connection-state').text(Messages.disconnected);
var privReady = Util.once(waitFor()); var privReady = Util.once(waitFor());
var metadataMgr = common.getMetadataMgr(); var metadataMgr = common.getMetadataMgr();
@ -278,7 +285,7 @@ define([
if (!proxy.drive || typeof(proxy.drive) !== 'object') { if (!proxy.drive || typeof(proxy.drive) !== 'object') {
throw new Error("Corrupted drive"); throw new Error("Corrupted drive");
} }
APP.online = !privateData.offline; APP.online = startOnline || !privateData.offline;
var drive = DriveUI.create(common, { var drive = DriveUI.create(common, {
$limit: usageBar && usageBar.$container, $limit: usageBar && usageBar.$container,
proxy: proxy, proxy: proxy,
@ -309,6 +316,7 @@ define([
sframeChan.on('EV_NETWORK_DISCONNECT', function () { sframeChan.on('EV_NETWORK_DISCONNECT', function () {
onDisconnect(); onDisconnect();
}); });
onReco.stop();
sframeChan.on('EV_NETWORK_RECONNECT', function () { sframeChan.on('EV_NETWORK_RECONNECT', function () {
onReconnect(); onReconnect();
}); });

Loading…
Cancel
Save