WIP
This commit is contained in:
@@ -14,13 +14,15 @@ define([
|
||||
'/common/common-codemirror.js',
|
||||
'/common/common-file.js',
|
||||
'/file/file-crypto.js',
|
||||
'/common/common-realtime.js',
|
||||
|
||||
'/common/clipboard.js',
|
||||
'/common/pinpad.js',
|
||||
'/customize/application_config.js',
|
||||
'/common/media-tag.js',
|
||||
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
|
||||
Messaging, CodeMirror, Files, FileCrypto, Clipboard, Pinpad, AppConfig, MediaTag) {
|
||||
Messaging, CodeMirror, Files, FileCrypto, Realtime, Clipboard,
|
||||
Pinpad, AppConfig, MediaTag) {
|
||||
|
||||
// Configure MediaTags to use our local viewer
|
||||
if (MediaTag && MediaTag.PdfPlugin) {
|
||||
@@ -129,6 +131,9 @@ define([
|
||||
common.getLatestMessages = Messaging.getLatestMessages;
|
||||
common.initMessagingUI = Messaging.UI.init;
|
||||
|
||||
// Realtime
|
||||
var whenRealtimeSyncs = common.whenRealtimeSyncs = Realtime.whenRealtimeSyncs;
|
||||
|
||||
// Userlist
|
||||
common.createUserList = UserList.create;
|
||||
|
||||
@@ -244,36 +249,6 @@ define([
|
||||
return;
|
||||
};
|
||||
|
||||
common.infiniteSpinnerDetected = false;
|
||||
var BAD_STATE_TIMEOUT = typeof(AppConfig.badStateTimeout) === 'number'?
|
||||
AppConfig.badStateTimeout: 30000;
|
||||
var whenRealtimeSyncs = common.whenRealtimeSyncs = function (realtime, cb) {
|
||||
realtime.sync();
|
||||
|
||||
window.setTimeout(function () {
|
||||
if (realtime.getAuthDoc() === realtime.getUserDoc()) {
|
||||
return void cb();
|
||||
}
|
||||
|
||||
var to = setTimeout(function () {
|
||||
realtime.abort();
|
||||
// don't launch more than one popup
|
||||
if (common.infiniteSpinnerDetected) { return; }
|
||||
|
||||
// inform the user their session is in a bad state
|
||||
common.confirm(Messages.realtime_unrecoverableError, function (yes) {
|
||||
if (!yes) { return; }
|
||||
window.location.reload();
|
||||
});
|
||||
common.infiniteSpinnerDetected = true;
|
||||
}, BAD_STATE_TIMEOUT);
|
||||
realtime.onSettle(function () {
|
||||
clearTimeout(to);
|
||||
cb();
|
||||
});
|
||||
}, 0);
|
||||
};
|
||||
|
||||
common.getWebsocketURL = function () {
|
||||
if (!Config.websocketPath) { return Config.websocketURL; }
|
||||
var path = Config.websocketPath;
|
||||
|
||||
Reference in New Issue
Block a user