summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-10-22 08:41:14 -0400
committerPedro Pinto Silva <pedro.silva@collabora.com>2022-01-26 13:32:41 +0100
commit7656508556cb15269517813f7511c784ead721bb (patch)
tree7774102ed2a3be21c7da427778ba74100c7141ca
parentbrowser: catch exception from JSON.parse (diff)
downloadonline-7656508556cb15269517813f7511c784ead721bb.tar.gz
online-7656508556cb15269517813f7511c784ead721bb.zip
browser: fallback for welcome dialog
Change-Id: Id05c658af02ab50ba45eaee8430b712bd4538a4c Signed-off-by: Henry Castro <hcastro@collabora.com>
-rw-r--r--browser/src/map/handler/Map.Welcome.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/browser/src/map/handler/Map.Welcome.js b/browser/src/map/handler/Map.Welcome.js
index 784a3a8896..0524270648 100644
--- a/browser/src/map/handler/Map.Welcome.js
+++ b/browser/src/map/handler/Map.Welcome.js
@@ -15,6 +15,8 @@ L.Map.Welcome = L.Handler.extend({
this._map.on('statusindicator', this.onStatusIndicator, this);
this._url = window.feedbackLocation.replace(/Rate\/feedback.html/g, 'Welcome/welcome.html');
+ this._retries = 2;
+ this._fallback = false;
},
addHooks: function () {
@@ -83,10 +85,24 @@ L.Map.Welcome = L.Handler.extend({
localStorage.setItem('WSDWelcomeVersion', app.socket.WSDServer.Version);
this.remove();
} else if (data == 'iframe-welcome-load' && !this._iframeWelcome.isVisible()) {
- var currentDate = new Date();
- localStorage.setItem('WSDWelcomeDisabled', 'true');
- localStorage.setItem('WSDWelcomeDisabledDate', currentDate.toDateString());
- this.remove();
+ if (this._retries-- > 0) {
+ this.remove();
+ setTimeout(L.bind(this.showWelcomeDialog, this), 200);
+ } else if (this._fallback) {
+ var currentDate = new Date();
+ localStorage.setItem('WSDWelcomeDisabled', 'true');
+ localStorage.setItem('WSDWelcomeDisabledDate', currentDate.toDateString());
+ this._iframeWelcome.show();
+ } else {
+ // fallback
+ var welcomeLocation = 'welcome/welcome-' + String.locale + '.html';
+ if (window.socketProxy)
+ welcomeLocation = window.makeWsUrl('/loleaflet/dist/' + welcomeLocation);
+
+ this._url = welcomeLocation;
+ this._fallback = true;
+ setTimeout(L.bind(this.showWelcomeDialog, this), 200);
+ }
}
}
});