diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-08-26 06:46:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-26 06:46:44 +0800 |
commit | 78f73038e789f4483f728a7cc9ea1c68b0b3d7fa (patch) | |
tree | a838945b8518079e0e1022bb176a544d11a2ab50 /app/scripts/metamask-controller.js | |
parent | b6b57d928a8854baf674763211c407bb4c976dba (diff) | |
parent | 8b81009a307eaf5384a2ab364a717f5188b3c501 (diff) | |
download | tangerine-wallet-browser-78f73038e789f4483f728a7cc9ea1c68b0b3d7fa.tar tangerine-wallet-browser-78f73038e789f4483f728a7cc9ea1c68b0b3d7fa.tar.gz tangerine-wallet-browser-78f73038e789f4483f728a7cc9ea1c68b0b3d7fa.tar.bz2 tangerine-wallet-browser-78f73038e789f4483f728a7cc9ea1c68b0b3d7fa.tar.lz tangerine-wallet-browser-78f73038e789f4483f728a7cc9ea1c68b0b3d7fa.tar.xz tangerine-wallet-browser-78f73038e789f4483f728a7cc9ea1c68b0b3d7fa.tar.zst tangerine-wallet-browser-78f73038e789f4483f728a7cc9ea1c68b0b3d7fa.zip |
Merge pull request #554 from MetaMask/PopupNotifications
Replace chrome notifications with windows.create
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index d53094e43..e94db2dfd 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -12,6 +12,7 @@ module.exports = class MetamaskController { constructor (opts) { this.opts = opts + this.listeners = [] this.configManager = new ConfigManager(opts) this.idStore = new IdentityStore({ configManager: this.configManager, @@ -112,9 +113,9 @@ module.exports = class MetamaskController { } sendUpdate () { - if (this.remote) { - this.remote.sendUpdate(this.getState()) - } + this.listeners.forEach((remote) => { + remote.sendUpdate(this.getState()) + }) } initializeProvider (opts) { @@ -130,10 +131,17 @@ module.exports = class MetamaskController { }, // tx signing approveTransaction: this.newUnsignedTransaction.bind(this), - signTransaction: idStore.signTransaction.bind(idStore), + signTransaction: (...args) => { + idStore.signTransaction(...args) + this.sendUpdate() + }, + // msg signing approveMessage: this.newUnsignedMessage.bind(this), - signMessage: idStore.signMessage.bind(idStore), + signMessage: (...args) => { + idStore.signMessage(...args) + this.sendUpdate() + }, } var provider = MetaMaskProvider(providerOpts) @@ -193,6 +201,8 @@ module.exports = class MetamaskController { // It's locked if (!state.isUnlocked) { + + // Allow the environment to define an unlock message. this.opts.unlockAccountMessage() idStore.addUnconfirmedTransaction(txParams, onTxDoneCb, noop) @@ -200,6 +210,7 @@ module.exports = class MetamaskController { } else { idStore.addUnconfirmedTransaction(txParams, onTxDoneCb, (err, txData) => { if (err) return onTxDoneCb(err) + this.sendUpdate() this.opts.showUnconfirmedTx(txParams, txData, onTxDoneCb) }) } @@ -212,6 +223,7 @@ module.exports = class MetamaskController { this.opts.unlockAccountMessage() } else { this.addUnconfirmedMessage(msgParams, cb) + this.sendUpdate() } } |