diff options
author | Jeffrey Tong <trigun0x2@gmail.com> | 2018-03-08 12:09:40 +0800 |
---|---|---|
committer | Jeffrey Tong <trigun0x2@gmail.com> | 2018-03-08 12:09:40 +0800 |
commit | aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294 (patch) | |
tree | e93b77feabffb0a938c8bad8fdd2753a1cbff5c9 /app | |
parent | 40b1688c67bfb820aca437751dda87df98e9513a (diff) | |
download | tangerine-wallet-browser-aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294.tar tangerine-wallet-browser-aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294.tar.gz tangerine-wallet-browser-aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294.tar.bz2 tangerine-wallet-browser-aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294.tar.lz tangerine-wallet-browser-aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294.tar.xz tangerine-wallet-browser-aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294.tar.zst tangerine-wallet-browser-aaef2aeefde39ce11ef07603fd1cb5d2cbb1e294.zip |
fixed multiple notification windows when executing batch
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/background.js | 11 | ||||
-rw-r--r-- | app/scripts/lib/notification-manager.js | 5 |
2 files changed, 14 insertions, 2 deletions
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; }) } diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js index 1283933e1..351f82694 100644 --- a/app/scripts/lib/notification-manager.js +++ b/app/scripts/lib/notification-manager.js @@ -9,7 +9,7 @@ class NotificationManager { // Public // - showPopup () { + showPopup (cb) { this._getPopup((err, popup) => { if (err) throw err @@ -23,6 +23,9 @@ class NotificationManager { type: 'popup', width, height, + }, (win) => { + // naming of popup window and a popup in chrome extension sense is confusing + cb((win.type == 'popup')); }) } }) |