aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/reducers
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/reducers')
-rw-r--r--ui/app/reducers/app.js92
-rw-r--r--ui/app/reducers/metamask.js7
2 files changed, 62 insertions, 37 deletions
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 3a4fb536d..c3ade5cdc 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -58,6 +58,7 @@ function reduceApp (state, action) {
isLoading: false,
// Used to display error text
warning: null,
+ buyView: {},
}, state.appState)
switch (action.type) {
@@ -169,7 +170,6 @@ function reduceApp (state, action) {
})
case actions.SHOW_IMPORT_PAGE:
-
return extend(appState, {
currentView: {
name: 'import-menu',
@@ -178,6 +178,24 @@ function reduceApp (state, action) {
warning: null,
})
+ case actions.SHOW_NEW_ACCOUNT_PAGE:
+ return extend(appState, {
+ currentView: {
+ name: 'new-account-page',
+ context: action.formToSelect,
+ },
+ transForward: true,
+ warning: null,
+ })
+
+ case actions.SET_NEW_ACCOUNT_FORM:
+ return extend(appState, {
+ currentView: {
+ name: appState.currentView.name,
+ context: action.formToSelect,
+ },
+ })
+
case actions.SHOW_INFO_PAGE:
return extend(appState, {
currentView: {
@@ -371,7 +389,7 @@ function reduceApp (state, action) {
return extend(appState, {
currentView: {
name: 'confTx',
- context: action.id ? indexForPending(state, action.id) : indexForLastPending(state),
+ context: action.id ? indexForPending(state, action.id) : 0,
},
transForward: action.transForward,
warning: null,
@@ -391,36 +409,36 @@ function reduceApp (state, action) {
case actions.COMPLETED_TX:
log.debug('reducing COMPLETED_TX for tx ' + action.value)
- // const otherUnconfActions = getUnconfActionList(state)
- // .filter(tx => tx.id !== action.value)
- // const hasOtherUnconfActions = otherUnconfActions.length > 0
-
- // if (hasOtherUnconfActions) {
- // log.debug('reducer detected txs - rendering confTx view')
- // return extend(appState, {
- // transForward: false,
- // currentView: {
- // name: 'confTx',
- // context: 0,
- // },
- // warning: null,
- // })
- // } else {
- log.debug('attempting to close popup')
- return extend(appState, {
- // indicate notification should close
- shouldClose: true,
- transForward: false,
- warning: null,
- currentView: {
- name: 'accountDetail',
- context: state.metamask.selectedAddress,
- },
- accountDetail: {
- subview: 'transactions',
- },
- })
- // }
+ const otherUnconfActions = getUnconfActionList(state)
+ .filter(tx => tx.id !== action.value)
+ const hasOtherUnconfActions = otherUnconfActions.length > 0
+
+ if (hasOtherUnconfActions) {
+ log.debug('reducer detected txs - rendering confTx view')
+ return extend(appState, {
+ transForward: false,
+ currentView: {
+ name: 'confTx',
+ context: 0,
+ },
+ warning: null,
+ })
+ } else {
+ log.debug('attempting to close popup')
+ return extend(appState, {
+ // indicate notification should close
+ shouldClose: true,
+ transForward: false,
+ warning: null,
+ currentView: {
+ name: 'accountDetail',
+ context: state.metamask.selectedAddress,
+ },
+ accountDetail: {
+ subview: 'transactions',
+ },
+ })
+ }
case actions.NEXT_TX:
return extend(appState, {
@@ -591,8 +609,8 @@ function reduceApp (state, action) {
marketinfo: action.value.marketinfo,
coinOptions: action.value.coinOptions,
},
- buyAddress: appState.buyView.buyAddress,
- amount: appState.buyView.amount,
+ buyAddress: action.value.buyAddress || appState.buyView.buyAddress,
+ amount: appState.buyView.amount || 0,
},
})
@@ -661,6 +679,6 @@ function indexForPending (state, txId) {
return index
}
-function indexForLastPending (state) {
- return getUnconfActionList(state).length
-}
+// function indexForLastPending (state) {
+// return getUnconfActionList(state).length
+// }
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index 95b41e5f3..294c29948 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -1,6 +1,7 @@
const extend = require('xtend')
const actions = require('../actions')
const MetamascaraPlatform = require('../../../app/scripts/platforms/window')
+const { OLD_UI_NETWORK_TYPE } = require('../../../app/scripts/config').enums
module.exports = reduceMetamask
@@ -39,6 +40,7 @@ function reduceMetamask (state, action) {
coinOptions: {},
useBlockie: false,
featureFlags: {},
+ networkEndpointType: OLD_UI_NETWORK_TYPE,
}, state.metamask)
switch (action.type) {
@@ -335,6 +337,11 @@ function reduceMetamask (state, action) {
featureFlags: action.value,
})
+ case actions.UPDATE_NETWORK_ENDPOINT_TYPE:
+ return extend(metamaskState, {
+ networkEndpointType: action.value,
+ })
+
default:
return metamaskState