aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/notification-manager.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-04 02:21:17 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-04 02:21:17 +0800
commit595447ccac0c6d178d63850d45f0ad5456964e4f (patch)
tree61b83e1ba63615351da8e4c2dc7b446353411c9d /app/scripts/lib/notification-manager.js
parent11736e6318182ab5b43430410a46059e5f46ad52 (diff)
parent2e9bd7e9d101287b4466475561df9131f0ef56a6 (diff)
downloadtangerine-wallet-browser-595447ccac0c6d178d63850d45f0ad5456964e4f.tar.gz
tangerine-wallet-browser-595447ccac0c6d178d63850d45f0ad5456964e4f.tar.zst
tangerine-wallet-browser-595447ccac0c6d178d63850d45f0ad5456964e4f.zip
Merge remote-tracking branch 'upstream/develop' into HEAD
Diffstat (limited to 'app/scripts/lib/notification-manager.js')
-rw-r--r--app/scripts/lib/notification-manager.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js
index 5dfb42078..969a9459a 100644
--- a/app/scripts/lib/notification-manager.js
+++ b/app/scripts/lib/notification-manager.js
@@ -26,13 +26,15 @@ class NotificationManager {
// bring focus to existing chrome popup
extension.windows.update(popup.id, { focused: true })
} else {
+ const cb = (currentPopup) => { this._popupId = currentPopup.id }
// create new notification popup
- extension.windows.create({
+ const creation = extension.windows.create({
url: 'notification.html',
type: 'popup',
width,
height,
- })
+ }, cb)
+ creation && creation.then && creation.then(cb)
}
})
}
@@ -84,7 +86,7 @@ class NotificationManager {
}
/**
- * Given an array of windows, returns the first that has a 'popup' type, or null if no such window exists.
+ * Given an array of windows, returns the 'popup' that has been opened by MetaMask, or null if no such window exists.
*
* @private
* @param {array} windows An array of objects containing data about the open MetaMask extension windows.
@@ -93,7 +95,7 @@ class NotificationManager {
_getPopupIn (windows) {
return windows ? windows.find((win) => {
// Returns notification popup
- return (win && win.type === 'popup')
+ return (win && win.type === 'popup' && win.id === this._popupId)
}) : null
}