Use JSON objects for messaging.

Set timeout for closing the feedback dialogue to ensure that we sent the message.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: Ieaff907faac0506b065c991e5e8fac4ccad8d8e2
pull/4292/head
Gökay Şatır 2022-02-23 15:51:07 +03:00 committed by Gökay ŞATIR
parent b965b90b3a
commit 1fe48cd0a0
3 changed files with 8 additions and 2 deletions

View File

@ -70,7 +70,7 @@ L.IFrameDialog = L.Class.extend({
this._loading = true;
setTimeout(function () {
if (!that.isVisible()) {
window.postMessage(msg);
window.postMessage('{"MessageId":"' + msg + '"}');
}
}, 500);
},

View File

@ -96,6 +96,7 @@ L.Map.Feedback = L.Handler.extend({
onMessage: function (e) {
var data = e.data;
data = JSON.parse(data).MessageId;
if (data == 'feedback-show') {
this._iframeDialog.show();
@ -112,7 +113,11 @@ L.Map.Feedback = L.Handler.extend({
} else if (data == 'feedback-submit') {
window.localStorage.setItem('WSDFeedbackEnabled', 'false');
window.localStorage.removeItem('WSDFeedbackCount');
this._iframeDialog.remove();
var that = this;
setTimeout(function() {
that._iframeDialog.remove();
}, 400);
} else if (data == 'iframe-feedback-load' && !this._iframeDialog.isVisible()) {
this._iframeDialog.remove();
setTimeout(L.bind(this.onFeedback, this), this._map.options.feedbackTimeout);

View File

@ -78,6 +78,7 @@ L.Map.Welcome = L.Handler.extend({
onMessage: function (e) {
var data = e.data;
data = JSON.parse(data).MessageId;
if (data === 'welcome-show') {
this._iframeWelcome.show();