From aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294 Mon Sep 17 00:00:00 2001 From: Jeffrey Tong Date: Wed, 7 Mar 2018 20:09:40 -0800 Subject: fixed multiple notification windows when executing batch --- app/scripts/background.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app/scripts/background.js') diff --git a/app/scripts/background.js b/app/scripts/background.js index 601ae0372..6cb80244f 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -40,6 +40,7 @@ const isIE = !!document.documentMode const isEdge = !isIE && !!window.StyleMedia let popupIsOpen = false +let notifcationIsOpen = false; let openMetamaskTabsIDs = {} // state persistence @@ -136,6 +137,11 @@ function setupController (initState) { } }) } + if (remotePort.name === 'notification') { + endOfStream(portStream, () => { + notifcationIsOpen = false + }); + } } else { // communication with page const originDomain = urlUtil.parse(remotePort.sender.url).hostname @@ -178,7 +184,10 @@ function setupController (initState) { function triggerUi () { extension.tabs.query({ active: true }, (tabs) => { const currentlyActiveMetamaskTab = tabs.find(tab => openMetamaskTabsIDs[tab.id]) - if (!popupIsOpen && !currentlyActiveMetamaskTab) notificationManager.showPopup() + if (!popupIsOpen && !currentlyActiveMetamaskTab) notificationManager.showPopup((notification) => { + notifcationIsOpen = notification; + }); + notifcationIsOpen = true; }) } -- cgit