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

ui - move popup auto-close after tx conf to ui entrypoint

This commit is contained in:
kumavis 2017-03-31 13:32:47 -07:00
parent 49d8877fd7
commit 60a48e713f
2 changed files with 9 additions and 6 deletions

View File

@ -17,13 +17,17 @@ global.METAMASK_UI_TYPE = windowType
closePopupIfOpen(windowType) closePopupIfOpen(windowType)
// setup stream to background // setup stream to background
const extensionPort = extension.runtime.connect({ windowType }) const extensionPort = extension.runtime.connect({ name: windowType })
const connectionStream = new PortStream(extensionPort) const connectionStream = new PortStream(extensionPort)
// start ui // start ui
const container = document.getElementById('app-content') const container = document.getElementById('app-content')
startPopup({ container, connectionStream }, (err, store) => { startPopup({ container, connectionStream }, (err, store) => {
if (err) return displayCriticalError(err) if (err) return displayCriticalError(err)
store.subscribe(() => {
const state = store.getState()
if (state.appState.shouldClose) notificationManager.closePopup()
})
}) })

View File

@ -1,12 +1,10 @@
const extend = require('xtend') const extend = require('xtend')
const actions = require('../actions') const actions = require('../actions')
const txHelper = require('../../lib/tx-helper') const txHelper = require('../../lib/tx-helper')
const NotificationManager = require('../../../app/scripts/lib/notification-manager')
const notificationManager = new NotificationManager()
module.exports = reduceApp module.exports = reduceApp
function reduceApp (state, action) { function reduceApp (state, action) {
log.debug('App Reducer got ' + action.type) log.debug('App Reducer got ' + action.type)
// clone and defaults // clone and defaults
@ -36,6 +34,7 @@ function reduceApp (state, action) {
// default state // default state
var appState = extend({ var appState = extend({
shouldClose: false,
menuOpen: false, menuOpen: false,
currentView: seedWords ? seedConfView : defaultView, currentView: seedWords ? seedConfView : defaultView,
accountDetail: { accountDetail: {
@ -331,9 +330,9 @@ function reduceApp (state, action) {
}) })
} else { } else {
log.debug('attempting to close popup') log.debug('attempting to close popup')
notificationManager.closePopup()
return extend(appState, { return extend(appState, {
// indicate notification should close
shouldClose: true,
transForward: false, transForward: false,
warning: null, warning: null,
currentView: { currentView: {