Merge pull request #666 from MetaMask/i#626

Dont generate a popup notification for transactions from within metmask-extension
feature/default_network_editable
kumavis 8 years ago committed by GitHub
commit d3bd6236a8
  1. 3
      CHANGELOG.md
  2. 25
      app/scripts/background.js
  3. 4
      ui/app/conf-tx.js

@ -2,6 +2,9 @@
## Current Master ## Current Master
- Fixed bug where if you send a transaction from within MetaMask extension the
popup notification opens up.
## 2.12.0 2016-09-14 ## 2.12.0 2016-09-14
- Add a QR button to the Account detail screen - Add a QR button to the Account detail screen

@ -10,31 +10,22 @@ const MetamaskController = require('./metamask-controller')
const extension = require('./lib/extension') const extension = require('./lib/extension')
const STORAGE_KEY = 'metamask-config' const STORAGE_KEY = 'metamask-config'
var popupIsOpen = false
const controller = new MetamaskController({ const controller = new MetamaskController({
// User confirmation callbacks: // User confirmation callbacks:
showUnconfirmedMessage, showUnconfirmedMessage: triggerUi,
unlockAccountMessage, unlockAccountMessage: triggerUi,
showUnconfirmedTx, showUnconfirmedTx: triggerUi,
// Persistence Methods: // Persistence Methods:
setData, setData,
loadData, loadData,
}) })
const idStore = controller.idStore const idStore = controller.idStore
function unlockAccountMessage () { function triggerUi () {
notification.show() if (!popupIsOpen) notification.show()
}
function showUnconfirmedMessage (msgParams, msgId) {
notification.show()
} }
function showUnconfirmedTx (txParams, txData, onTxDoneCb) {
notification.show()
}
// On first install, open a window to MetaMask website to how-it-works. // On first install, open a window to MetaMask website to how-it-works.
extension.runtime.onInstalled.addListener(function (details) { extension.runtime.onInstalled.addListener(function (details) {
@ -53,7 +44,8 @@ function connectRemote (remotePort) {
var portStream = new PortStream(remotePort) var portStream = new PortStream(remotePort)
if (isMetaMaskInternalProcess) { if (isMetaMaskInternalProcess) {
// communication with popup // communication with popup
setupTrustedCommunication(portStream, 'MetaMask') popupIsOpen = remotePort.name === 'popup'
setupTrustedCommunication(portStream, 'MetaMask', remotePort.name)
} else { } else {
// communication with page // communication with page
var originDomain = urlUtil.parse(remotePort.sender.url).hostname var originDomain = urlUtil.parse(remotePort.sender.url).hostname
@ -95,6 +87,7 @@ function setupControllerConnection (stream) {
// teardown on disconnect // teardown on disconnect
eos(stream, () => { eos(stream, () => {
controller.ethStore.removeListener('update', controller.sendUpdate.bind(controller)) controller.ethStore.removeListener('update', controller.sendUpdate.bind(controller))
popupIsOpen = false
}) })
}) })
} }

@ -140,7 +140,9 @@ ConfirmTxScreen.prototype.goHome = function (event) {
} }
function warningIfExists (warning) { function warningIfExists (warning) {
if (warning) { if (warning &&
// Do not display user rejections on this screen:
warning.indexOf('User denied transaction signature') === -1) {
return h('span.error', { style: { margin: 'auto' } }, warning) return h('span.error', { style: { margin: 'auto' } }, warning)
} }
} }

Loading…
Cancel
Save