From ca065e557e04ae7efce30351dda1a410e9b55db3 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 12 Nov 2020 11:29:05 +0100 Subject: [PATCH] Improve notification prompt --- www/common/toolbar.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/common/toolbar.js b/www/common/toolbar.js index 709d659b5..5d453f061 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -999,16 +999,18 @@ MessengerUI, Messages) { pads_options.unshift(h("hr")); pads_options.unshift(allowNotif); var $allow = $(allowNotif).click(function () { - Common.getSframeChannel().event('Q_ASK_NOTIFICATION', null, function (granted) { - if (!granted) { return; } + Common.getSframeChannel().event('Q_ASK_NOTIFICATION', null, function (e, allow) { + if (!allow) { return; } $(allowNotif).remove(); }); }); - metadataMgr.onChange(function () { + var onChange = function () { var privateData = metadataMgr.getPrivateData(); if (!privateData.notifications) { return; } $allow.remove(); - }); + metadataMgr.off('change', onChange); + }; + metadataMgr.onChange(onChange); }