aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-09-02 02:39:08 +0800
committerGitHub <noreply@github.com>2016-09-02 02:39:08 +0800
commita76e198c9c23cfe93346ea7690925fe9d3be5843 (patch)
tree671a308c73f61fc1e2b3fba3cc71ef1d3ac77477 /app
parent32345bda7751f962105bb8bd4ea402f549f30409 (diff)
parent34fd23803d5eea94bd588b805872377edf48a9c6 (diff)
downloadtangerine-wallet-browser-a76e198c9c23cfe93346ea7690925fe9d3be5843.tar
tangerine-wallet-browser-a76e198c9c23cfe93346ea7690925fe9d3be5843.tar.gz
tangerine-wallet-browser-a76e198c9c23cfe93346ea7690925fe9d3be5843.tar.bz2
tangerine-wallet-browser-a76e198c9c23cfe93346ea7690925fe9d3be5843.tar.lz
tangerine-wallet-browser-a76e198c9c23cfe93346ea7690925fe9d3be5843.tar.xz
tangerine-wallet-browser-a76e198c9c23cfe93346ea7690925fe9d3be5843.tar.zst
tangerine-wallet-browser-a76e198c9c23cfe93346ea7690925fe9d3be5843.zip
Merge pull request #603 from MetaMask/i566-NoPopupWhenOpen
Don't show popup when sending tx from within metamask
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/notifications.js30
1 files changed, 19 insertions, 11 deletions
diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js
index 432ad0445..df4fe73dd 100644
--- a/app/scripts/lib/notifications.js
+++ b/app/scripts/lib/notifications.js
@@ -9,11 +9,12 @@ module.exports = notifications
window.METAMASK_NOTIFIER = notifications
function show () {
- getPopup((popup) => {
- if (popup) {
- return extension.windows.update(popup.id, { focused: true })
- }
+ getWindows((windows) => {
+ if (windows.length > 0) {
+ const win = windows[0]
+ return extension.windows.update(win.id, { focused: true })
+ }
extension.windows.create({
url: 'notification.html',
@@ -25,22 +26,29 @@ function show () {
})
}
-function getPopup(cb) {
-
+function getWindows(cb) {
// Ignore in test environment
if (!extension.windows) {
- return cb(null)
+ return cb()
}
extension.windows.getAll({}, (windows) => {
- let popup = windows.find((win) => {
- return win.type === 'popup'
- })
+ cb(null, windows)
+ })
+}
- cb(popup)
+function getPopup(cb) {
+ getWindows((windows) => {
+ cb(getPopupIn(windows))
})
}
+function getPopupIn(windows) {
+ return windows ? windows.find((win) => {
+ return win.type === 'popup'
+ }) : null
+}
+
function closePopup() {
getPopup((popup) => {
if (!popup) return