aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-01-31 07:57:49 +0800
committerGitHub <noreply@github.com>2017-01-31 07:57:49 +0800
commit82578538198de74955d7bc5cfd3c9a02d1b69a6d (patch)
treeaad1a62ee4ed4b7e34c0bd78b9f680dc2aeaaded /ui/app
parentb6909574a7036c396ed85809cbd90aa2171b012f (diff)
parent0b9d37c6c8e714eb26bec5156e984a6b0cd268ad (diff)
downloadtangerine-wallet-browser-82578538198de74955d7bc5cfd3c9a02d1b69a6d.tar
tangerine-wallet-browser-82578538198de74955d7bc5cfd3c9a02d1b69a6d.tar.gz
tangerine-wallet-browser-82578538198de74955d7bc5cfd3c9a02d1b69a6d.tar.bz2
tangerine-wallet-browser-82578538198de74955d7bc5cfd3c9a02d1b69a6d.tar.lz
tangerine-wallet-browser-82578538198de74955d7bc5cfd3c9a02d1b69a6d.tar.xz
tangerine-wallet-browser-82578538198de74955d7bc5cfd3c9a02d1b69a6d.tar.zst
tangerine-wallet-browser-82578538198de74955d7bc5cfd3c9a02d1b69a6d.zip
Merge pull request #1069 from MetaMask/i1066
Introduce Preferences Controller
Diffstat (limited to 'ui/app')
-rw-r--r--ui/app/account-detail.js2
-rw-r--r--ui/app/accounts/account-list-item.js4
-rw-r--r--ui/app/accounts/index.js11
-rw-r--r--ui/app/actions.js13
-rw-r--r--ui/app/components/buy-button-subview.js1
-rw-r--r--ui/app/components/coinbase-form.js1
-rw-r--r--ui/app/components/pending-msg-details.js2
-rw-r--r--ui/app/components/pending-tx-details.js2
-rw-r--r--ui/app/components/shapeshift-form.js1
-rw-r--r--ui/app/conf-tx.js8
-rw-r--r--ui/app/reducers/app.js8
-rw-r--r--ui/app/reducers/metamask.js6
-rw-r--r--ui/app/send.js2
13 files changed, 22 insertions, 39 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js
index 0bcfbcaab..aa418a1ba 100644
--- a/ui/app/account-detail.js
+++ b/ui/app/account-detail.js
@@ -24,7 +24,7 @@ function mapStateToProps (state) {
metamask: state.metamask,
identities: state.metamask.identities,
accounts: state.metamask.accounts,
- address: state.metamask.selectedAccount,
+ address: state.metamask.selectedAddress,
accountDetail: state.appState.accountDetail,
network: state.metamask.network,
unconfMsgs: valuesFor(state.metamask.unconfMsgs),
diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js
index 74ecef07f..2a3c13d05 100644
--- a/ui/app/accounts/account-list-item.js
+++ b/ui/app/accounts/account-list-item.js
@@ -15,10 +15,10 @@ function AccountListItem () {
}
AccountListItem.prototype.render = function () {
- const { identity, selectedAccount, accounts, onShowDetail } = this.props
+ const { identity, selectedAddress, accounts, onShowDetail } = this.props
const checksumAddress = identity && identity.address && ethUtil.toChecksumAddress(identity.address)
- const isSelected = selectedAccount === identity.address
+ const isSelected = selectedAddress === identity.address
const account = accounts[identity.address]
const selectedClass = isSelected ? '.selected' : ''
diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js
index e6f376735..7c35a83dd 100644
--- a/ui/app/accounts/index.js
+++ b/ui/app/accounts/index.js
@@ -19,7 +19,7 @@ function mapStateToProps (state) {
accounts: state.metamask.accounts,
identities: state.metamask.identities,
unconfTxs: state.metamask.unconfTxs,
- selectedAccount: state.metamask.selectedAccount,
+ selectedAddress: state.metamask.selectedAddress,
scrollToBottom: state.appState.scrollToBottom,
pending,
keyrings: state.metamask.keyrings,
@@ -80,7 +80,7 @@ AccountsScreen.prototype.render = function () {
return h(AccountListItem, {
key: `acct-panel-${identity.address}`,
identity,
- selectedAccount: this.props.selectedAccount,
+ selectedAddress: this.props.selectedAddress,
accounts: this.props.accounts,
onShowDetail: this.onShowDetail.bind(this),
pending,
@@ -139,13 +139,6 @@ AccountsScreen.prototype.navigateToConfTx = function () {
this.props.dispatch(actions.showConfTxPage())
}
-AccountsScreen.prototype.onSelect = function (address, event) {
- event.stopPropagation()
- // if already selected, deselect
- if (this.props.selectedAccount === address) address = null
- this.props.dispatch(actions.setSelectedAccount(address))
-}
-
AccountsScreen.prototype.onShowDetail = function (address, event) {
event.stopPropagation()
this.props.dispatch(actions.showAccountDetail(address))
diff --git a/ui/app/actions.js b/ui/app/actions.js
index a0fed265f..fa1e0deb5 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -90,7 +90,6 @@ var actions = {
TRANSACTION_ERROR: 'TRANSACTION_ERROR',
NEXT_TX: 'NEXT_TX',
PREVIOUS_TX: 'PREV_TX',
- setSelectedAccount: setSelectedAccount,
signMsg: signMsg,
cancelMsg: cancelMsg,
sendTx: sendTx,
@@ -287,7 +286,7 @@ function importNewAccount (strategy, args) {
dispatch(actions.updateMetamaskState(newState))
dispatch({
type: actions.SHOW_ACCOUNT_DETAIL,
- value: newState.selectedAccount,
+ value: newState.selectedAddress,
})
})
}
@@ -309,10 +308,6 @@ function showInfoPage () {
}
}
-function setSelectedAccount (address) {
- return callBackgroundThenUpdate(background.setSelectedAccount, address)
-}
-
function setCurrentFiat (fiat) {
return (dispatch) => {
dispatch(this.showLoadingIndication())
@@ -508,16 +503,14 @@ function lockMetamask () {
function showAccountDetail (address) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
- background.setSelectedAccount(address, (err, newState) => {
+ background.setSelectedAddress(address, (err) => {
dispatch(actions.hideLoadingIndication())
if (err) {
return dispatch(actions.displayWarning(err.message))
}
-
- dispatch(actions.updateMetamaskState(newState))
dispatch({
type: actions.SHOW_ACCOUNT_DETAIL,
- value: newState.selectedAccount,
+ value: address,
})
})
}
diff --git a/ui/app/components/buy-button-subview.js b/ui/app/components/buy-button-subview.js
index afda5bf59..3074bd7cd 100644
--- a/ui/app/components/buy-button-subview.js
+++ b/ui/app/components/buy-button-subview.js
@@ -13,7 +13,6 @@ module.exports = connect(mapStateToProps)(BuyButtonSubview)
function mapStateToProps (state) {
return {
- selectedAccount: state.selectedAccount,
warning: state.appState.warning,
buyView: state.appState.buyView,
network: state.metamask.network,
diff --git a/ui/app/components/coinbase-form.js b/ui/app/components/coinbase-form.js
index 430a3eead..40f5719bb 100644
--- a/ui/app/components/coinbase-form.js
+++ b/ui/app/components/coinbase-form.js
@@ -9,7 +9,6 @@ module.exports = connect(mapStateToProps)(CoinbaseForm)
function mapStateToProps (state) {
return {
- selectedAccount: state.selectedAccount,
warning: state.appState.warning,
}
}
diff --git a/ui/app/components/pending-msg-details.js b/ui/app/components/pending-msg-details.js
index 404cb8ae2..16308d121 100644
--- a/ui/app/components/pending-msg-details.js
+++ b/ui/app/components/pending-msg-details.js
@@ -16,7 +16,7 @@ PendingMsgDetails.prototype.render = function () {
var msgData = state.txData
var msgParams = msgData.msgParams || {}
- var address = msgParams.from || state.selectedAccount
+ var address = msgParams.from || state.selectedAddress
var identity = state.identities[address] || { address: address }
var account = state.accounts[address] || { address: address }
diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js
index 286931f6f..e8615404e 100644
--- a/ui/app/components/pending-tx-details.js
+++ b/ui/app/components/pending-tx-details.js
@@ -22,7 +22,7 @@ PTXP.render = function () {
var txData = props.txData
var txParams = txData.txParams || {}
- var address = txParams.from || props.selectedAccount
+ var address = txParams.from || props.selectedAddress
var identity = props.identities[address] || { address: address }
var account = props.accounts[address]
var balance = account ? account.balance : '0x0'
diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js
index 383d5b623..8c9686035 100644
--- a/ui/app/components/shapeshift-form.js
+++ b/ui/app/components/shapeshift-form.js
@@ -10,7 +10,6 @@ module.exports = connect(mapStateToProps)(ShapeshiftForm)
function mapStateToProps (state) {
return {
- selectedAccount: state.selectedAccount,
warning: state.appState.warning,
isSubLoading: state.appState.isSubLoading,
qrRequested: state.appState.qrRequested,
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 1bd69f7d9..ca6c28ac9 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -19,7 +19,7 @@ function mapStateToProps (state) {
return {
identities: state.metamask.identities,
accounts: state.metamask.accounts,
- selectedAccount: state.metamask.selectedAccount,
+ selectedAddress: state.metamask.selectedAddress,
unconfTxs: state.metamask.unconfTxs,
unconfMsgs: state.metamask.unconfMsgs,
index: state.appState.currentView.context,
@@ -99,12 +99,12 @@ ConfirmTxScreen.prototype.render = function () {
// Properties
txData: txData,
key: txData.id,
- selectedAccount: state.selectedAccount,
+ selectedAddress: state.selectedAddress,
accounts: state.accounts,
identities: state.identities,
insufficientBalance: this.checkBalanceAgainstTx(txData),
// Actions
- buyEth: this.buyEth.bind(this, txParams.from || state.selectedAccount),
+ buyEth: this.buyEth.bind(this, txParams.from || state.selectedAddress),
sendTransaction: this.sendTransaction.bind(this, txData),
cancelTransaction: this.cancelTransaction.bind(this, txData),
signMessage: this.signMessage.bind(this, txData),
@@ -131,7 +131,7 @@ function currentTxView (opts) {
ConfirmTxScreen.prototype.checkBalanceAgainstTx = function (txData) {
if (!txData.txParams) return false
var state = this.props
- var address = txData.txParams.from || state.selectedAccount
+ var address = txData.txParams.from || state.selectedAddress
var account = state.accounts[address]
var balance = account ? account.balance : '0x0'
var maxCost = new BN(txData.maxCost, 16)
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 6a2c93f78..4fe9352a7 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -7,10 +7,10 @@ module.exports = reduceApp
function reduceApp (state, action) {
// clone and defaults
- const selectedAccount = state.metamask.selectedAccount
+ const selectedAddress = state.metamask.selectedAddress
const pendingTxs = hasPendingTxs(state)
let name = 'accounts'
- if (selectedAccount) {
+ if (selectedAddress) {
name = 'accountDetail'
}
if (pendingTxs) {
@@ -20,7 +20,7 @@ function reduceApp (state, action) {
var defaultView = {
name,
detailView: null,
- context: selectedAccount,
+ context: selectedAddress,
}
// confirm seed words
@@ -331,7 +331,7 @@ function reduceApp (state, action) {
warning: null,
currentView: {
name: 'accountDetail',
- context: state.metamask.selectedAccount,
+ context: state.metamask.selectedAddress,
},
accountDetail: {
subview: 'transactions',
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index 8679ab062..dec247c82 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -50,7 +50,7 @@ function reduceMetamask (state, action) {
return extend(metamaskState, {
isUnlocked: true,
isInitialized: true,
- selectedAccount: action.value,
+ selectedAddress: action.value,
})
case actions.LOCK_METAMASK:
@@ -101,7 +101,7 @@ function reduceMetamask (state, action) {
newState = extend(metamaskState, {
isUnlocked: true,
isInitialized: true,
- selectedAccount: action.value,
+ selectedAddress: action.value,
})
delete newState.seedWords
return newState
@@ -110,7 +110,7 @@ function reduceMetamask (state, action) {
newState = extend(metamaskState, {
isUnlocked: true,
isInitialized: true,
- selectedAccount: action.value,
+ selectedAddress: action.value,
})
delete newState.seedWords
return newState
diff --git a/ui/app/send.js b/ui/app/send.js
index b8af19028..d16270b41 100644
--- a/ui/app/send.js
+++ b/ui/app/send.js
@@ -16,7 +16,7 @@ module.exports = connect(mapStateToProps)(SendTransactionScreen)
function mapStateToProps (state) {
var result = {
- address: state.metamask.selectedAccount,
+ address: state.metamask.selectedAddress,
accounts: state.metamask.accounts,
identities: state.metamask.identities,
warning: state.appState.warning,