aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorAkihiro <an0326ja@gmail.com>2018-07-21 10:29:48 +0800
committerAkihiro <an0326ja@gmail.com>2018-07-21 10:29:48 +0800
commit3e6d13d309b27644f6e3050d0c7e62dfacda6072 (patch)
treecee2d031f710ae1f9d1c78c28d8b65d7ddc36fb2 /app
parent8c77e998e0491dfb48c91d2938644c9f855a2532 (diff)
parentc5520de1159718466ab846add99e0fea1da1cb06 (diff)
downloadtangerine-wallet-browser-3e6d13d309b27644f6e3050d0c7e62dfacda6072.tar
tangerine-wallet-browser-3e6d13d309b27644f6e3050d0c7e62dfacda6072.tar.gz
tangerine-wallet-browser-3e6d13d309b27644f6e3050d0c7e62dfacda6072.tar.bz2
tangerine-wallet-browser-3e6d13d309b27644f6e3050d0c7e62dfacda6072.tar.lz
tangerine-wallet-browser-3e6d13d309b27644f6e3050d0c7e62dfacda6072.tar.xz
tangerine-wallet-browser-3e6d13d309b27644f6e3050d0c7e62dfacda6072.tar.zst
tangerine-wallet-browser-3e6d13d309b27644f6e3050d0c7e62dfacda6072.zip
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/detect-tokens.js17
-rw-r--r--app/scripts/metamask-controller.js2
2 files changed, 13 insertions, 6 deletions
diff --git a/app/scripts/controllers/detect-tokens.js b/app/scripts/controllers/detect-tokens.js
index f1810cfa1..b30dc00f1 100644
--- a/app/scripts/controllers/detect-tokens.js
+++ b/app/scripts/controllers/detect-tokens.js
@@ -64,10 +64,9 @@ class DetectTokensController {
*
*/
restartTokenDetection () {
- if (this.isActive && this.selectedAddress) {
- this.detectNewTokens()
- this.interval = DEFAULT_INTERVAL
- }
+ if (!(this.isActive && this.selectedAddress)) { return }
+ this.detectNewTokens()
+ this.interval = DEFAULT_INTERVAL
}
/**
@@ -113,11 +112,19 @@ class DetectTokensController {
this._keyringMemStore = keyringMemStore
this._keyringMemStore.subscribe(({ isUnlocked }) => {
if (this.isUnlocked !== isUnlocked) {
- if (isUnlocked) { this.restartTokenDetection() }
this.isUnlocked = isUnlocked
+ if (isUnlocked) { this.restartTokenDetection() }
}
})
}
+
+ /**
+ * Internal isActive state
+ * @type {Object}
+ */
+ get isActive () {
+ return this.isOpen && this.isUnlocked
+ }
}
module.exports = DetectTokensController
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index e629d1359..3b303a95c 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -1432,6 +1432,7 @@ module.exports = class MetamaskController extends EventEmitter {
set isClientOpen (open) {
this._isClientOpen = open
this.isClientOpenAndUnlocked = this.getState().isUnlocked && open
+ this.detectTokensController.isOpen = open
}
/**
@@ -1442,6 +1443,5 @@ module.exports = class MetamaskController extends EventEmitter {
*/
set isClientOpenAndUnlocked (active) {
this.tokenRatesController.isActive = active
- this.detectTokensController.isActive = active
}
}