1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 04:20:53 +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 })
}
closeCurrentWindow (cb) {
return extension.windows.getCurrent((windowDetails) => {
return extension.windows.remove(windowDetails.id)
})
}
getVersion () {
return extension.runtime.getManifest().version
}

View File

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

View File

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