1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Merge pull request #603 from MetaMask/i566-NoPopupWhenOpen

Don't show popup when sending tx from within metamask
This commit is contained in:
Kevin Serrano 2016-09-01 11:39:08 -07:00 committed by GitHub
commit a76e198c9c
4 changed files with 22 additions and 15 deletions

View File

@ -3,6 +3,7 @@
## Current Master ## Current Master
- Fix bug where provider menu did not allow switching to custom network from a custom network. - Fix bug where provider menu did not allow switching to custom network from a custom network.
- Sending a transaction from within MetaMask no longer triggers a popup.
## 2.10.0 2016-08-29 ## 2.10.0 2016-08-29

View File

@ -9,11 +9,12 @@ module.exports = notifications
window.METAMASK_NOTIFIER = notifications window.METAMASK_NOTIFIER = notifications
function show () { function show () {
getPopup((popup) => { getWindows((windows) => {
if (popup) {
return extension.windows.update(popup.id, { focused: true })
}
if (windows.length > 0) {
const win = windows[0]
return extension.windows.update(win.id, { focused: true })
}
extension.windows.create({ extension.windows.create({
url: 'notification.html', url: 'notification.html',
@ -25,22 +26,29 @@ function show () {
}) })
} }
function getPopup(cb) { function getWindows(cb) {
// Ignore in test environment // Ignore in test environment
if (!extension.windows) { if (!extension.windows) {
return cb(null) return cb()
} }
extension.windows.getAll({}, (windows) => { extension.windows.getAll({}, (windows) => {
let popup = windows.find((win) => { cb(null, windows)
return win.type === 'popup'
})
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() { function closePopup() {
getPopup((popup) => { getPopup((popup) => {
if (!popup) return if (!popup) return

View File

@ -276,8 +276,6 @@ function signMsg (msgData) {
function signTx (txData) { function signTx (txData) {
return (dispatch) => { return (dispatch) => {
dispatch(actions.showLoadingIndication())
web3.eth.sendTransaction(txData, (err, data) => { web3.eth.sendTransaction(txData, (err, data) => {
dispatch(actions.hideLoadingIndication()) dispatch(actions.hideLoadingIndication())
@ -285,6 +283,7 @@ function signTx (txData) {
dispatch(actions.hideWarning()) dispatch(actions.hideWarning())
dispatch(actions.goHome()) dispatch(actions.goHome())
}) })
dispatch(this.showConfTxPage())
} }
} }

View File

@ -236,7 +236,6 @@ SendTransactionScreen.prototype.onSubmit = function () {
} }
this.props.dispatch(actions.hideWarning()) this.props.dispatch(actions.hideWarning())
this.props.dispatch(actions.showLoadingIndication())
var txParams = { var txParams = {
from: this.props.address, from: this.props.address,