1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

UI confirm screen closes confirmation window on submit or cancel of a tx

This commit is contained in:
Dan Miller 2018-07-23 22:20:06 -02:30
parent b208d33b3b
commit 2359062b62
3 changed files with 25 additions and 8 deletions

View File

@ -14,6 +14,12 @@ class ExtensionPlatform {
extension.tabs.create({ url }) extension.tabs.create({ url })
} }
closeCurrentWindow (cb) {
return extension.windows.getCurrent((windowDetails) => {
return extension.windows.remove(windowDetails.id)
})
}
getVersion () { getVersion () {
return extension.runtime.getManifest().version return extension.runtime.getManifest().version
} }

View File

@ -64,16 +64,16 @@ async function start () {
css = betaUIState ? NewMetaMaskUiCss() : OldMetaMaskUiCss() css = betaUIState ? NewMetaMaskUiCss() : OldMetaMaskUiCss()
deleteInjectedCss = injectCss(css) deleteInjectedCss = injectCss(css)
} }
if (state.appState.shouldClose) notificationManager.closePopup() // if (state.appState.shouldClose) notificationManager.closePopup()
}) })
}) })
function closePopupIfOpen (windowType) { function closePopupIfOpen (windowType) {
if (windowType !== ENVIRONMENT_TYPE_NOTIFICATION) { // if (windowType !== ENVIRONMENT_TYPE_NOTIFICATION) {
// should close only chrome popup // should close only chrome popup
notificationManager.closePopup() // notificationManager.closePopup()
} // }
} }
function displayCriticalError (err) { function displayCriticalError (err) {

View File

@ -8,6 +8,9 @@ import {
INSUFFICIENT_FUNDS_ERROR_KEY, INSUFFICIENT_FUNDS_ERROR_KEY,
TRANSACTION_ERROR_KEY, TRANSACTION_ERROR_KEY,
} from '../../../constants/error-keys' } from '../../../constants/error-keys'
import {
ENVIRONMENT_TYPE_NOTIFICATION,
} from '../../../../../app/scripts/lib/enums'
export default class ConfirmTransactionBase extends Component { export default class ConfirmTransactionBase extends Component {
static contextTypes = { static contextTypes = {
@ -250,8 +253,12 @@ export default class ConfirmTransactionBase extends Component {
} else { } else {
cancelTransaction(txData) cancelTransaction(txData)
.then(() => { .then(() => {
clearConfirmTransaction() if (global.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_NOTIFICATION) {
history.push(DEFAULT_ROUTE) return global.platform.closeCurrentWindow()
} else {
clearConfirmTransaction()
history.push(DEFAULT_ROUTE)
}
}) })
} }
} }
@ -264,8 +271,12 @@ export default class ConfirmTransactionBase extends Component {
} else { } else {
sendTransaction(txData) sendTransaction(txData)
.then(() => { .then(() => {
clearConfirmTransaction() if (global.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_NOTIFICATION) {
history.push(DEFAULT_ROUTE) return global.platform.closeCurrentWindow()
} else {
clearConfirmTransaction()
history.push(DEFAULT_ROUTE)
}
}) })
} }
} }