leaflet: better docunloading message to the user

Change-Id: I60ac82647a999cf24c694a9db824dfaaf6c44db3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 6b9cdc1c37b09b52332f470d8391492645063d8c)
This commit is contained in:
Ashod Nakashian 2021-07-29 10:18:46 -04:00 committed by Ashod Nakashian
parent 9e5043db47
commit e3fa38a1d1
2 changed files with 8 additions and 4 deletions

View file

@ -907,8 +907,10 @@ app.definitions.Socket = L.Class.extend({
this._map._active = false;
clearTimeout(vex.timer);
if (this.ReconnectCount++ >= 10)
if (this.ReconnectCount++ >= 10) {
this._map.fire('error', {msg: errorMessages.docunloadinggiveup});
return; // Give up.
}
map = this._map;
vex.timer = setInterval(function() {
@ -921,8 +923,9 @@ app.definitions.Socket = L.Class.extend({
// .5, 2, 4.5, 8, 12.5, 18, 24.5, 32, 40.5 seconds
}, 500 * this.ReconnectCount * this.ReconnectCount); // Exponential back-off.
this._map.fire('error', {msg: errorMessages.docunloading});
if (this.ReconnectCount > 1) {
this._map.fire('error', {msg: errorMessages.docunloadingretry});
}
}
if (passwordNeeded) {

View file

@ -24,7 +24,8 @@ errorMessages.faileddocloading = _('Failed to load the document. Please ensure t
errorMessages.invalidLink = _('Invalid link: \'%url\'');
errorMessages.leaving = _('You are leaving the editor, are you sure you want to visit %url?');
errorMessages.docloadtimeout = _('Failed to load the document. This document is either malformed or is taking more resources than allowed. Please contact the administrator.');
errorMessages.docunloading = _('We are in the process of cleaning up this document from the last session, please be patient and try again later.');
errorMessages.docunloadingretry = _('Cleaning up the document from the last session.');
errorMessages.docunloadinggiveup = _('We are in the process of cleaning up this document from the last session, please try again later.');
if (window.ThisIsAMobileApp) {
errorMessages.storage = {