diff options
author | Frankie <frankie.diamond@gmail.com> | 2017-01-28 08:11:59 +0800 |
---|---|---|
committer | Frankie <frankie.diamond@gmail.com> | 2017-01-29 12:28:20 +0800 |
commit | 8be68575bbef1dcc89b51355abaee90dbf018387 (patch) | |
tree | c8da5e217b838bff46bcc9ddfb8300133022ca91 /ui | |
parent | a8ed780d9b3659474c59c7856ab2ee1430c17b42 (diff) | |
download | tangerine-wallet-browser-8be68575bbef1dcc89b51355abaee90dbf018387.tar tangerine-wallet-browser-8be68575bbef1dcc89b51355abaee90dbf018387.tar.gz tangerine-wallet-browser-8be68575bbef1dcc89b51355abaee90dbf018387.tar.bz2 tangerine-wallet-browser-8be68575bbef1dcc89b51355abaee90dbf018387.tar.lz tangerine-wallet-browser-8be68575bbef1dcc89b51355abaee90dbf018387.tar.xz tangerine-wallet-browser-8be68575bbef1dcc89b51355abaee90dbf018387.tar.zst tangerine-wallet-browser-8be68575bbef1dcc89b51355abaee90dbf018387.zip |
Clean up message manger includes:
Provider egine bump
Remove presence of message manger in keyring controller
Change the status wording fom conf to approved
make Message manager a class
fix messages not being apart of the badge
re write message manger to better reflect controller pattern
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/account-detail.js | 6 | ||||
-rw-r--r-- | ui/app/accounts/index.js | 10 | ||||
-rw-r--r-- | ui/app/app.js | 4 | ||||
-rw-r--r-- | ui/app/components/transaction-list-item-icon.js | 8 | ||||
-rw-r--r-- | ui/app/components/transaction-list-item.js | 1 | ||||
-rw-r--r-- | ui/app/components/transaction-list.js | 4 | ||||
-rw-r--r-- | ui/app/conf-tx.js | 10 | ||||
-rw-r--r-- | ui/app/css/index.css | 10 | ||||
-rw-r--r-- | ui/app/reducers/app.js | 18 | ||||
-rw-r--r-- | ui/app/reducers/metamask.js | 14 | ||||
-rw-r--r-- | ui/example.js | 6 | ||||
-rw-r--r-- | ui/index.js | 4 | ||||
-rw-r--r-- | ui/lib/tx-helper.js | 6 |
13 files changed, 52 insertions, 49 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 387a1720a..7f6f155f3 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -27,7 +27,7 @@ function mapStateToProps (state) { address: state.metamask.selectedAccount, accountDetail: state.appState.accountDetail, network: state.metamask.network, - unconfMsgs: valuesFor(state.metamask.unconfMsgs), + unapprovedMsgs: valuesFor(state.metamask.unapprovedMsgs), shapeShiftTxList: state.metamask.shapeShiftTxList, transactions: state.metamask.selectedAccountTxList || [], } @@ -245,11 +245,11 @@ AccountDetailScreen.prototype.subview = function () { } AccountDetailScreen.prototype.transactionList = function () { - const {transactions, unconfMsgs, address, network, shapeShiftTxList } = this.props + const {transactions, unapprovedMsgs, address, network, shapeShiftTxList } = this.props return h(TransactionList, { transactions: transactions.sort((a, b) => b.time - a.time), network, - unconfMsgs, + unapprovedMsgs, address, shapeShiftTxList, viewPendingTx: (txId) => { diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index e6f376735..db380cd39 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -10,15 +10,15 @@ const AccountListItem = require('./account-list-item') module.exports = connect(mapStateToProps)(AccountsScreen) function mapStateToProps (state) { - const pendingTxs = valuesFor(state.metamask.unconfTxs) + const pendingTxs = valuesFor(state.metamask.unapprovedTxs) .filter(tx => tx.txParams.metamaskNetworkId === state.metamask.network) - const pendingMsgs = valuesFor(state.metamask.unconfMsgs) + const pendingMsgs = valuesFor(state.metamask.unapprovedMsgs) const pending = pendingTxs.concat(pendingMsgs) return { accounts: state.metamask.accounts, identities: state.metamask.identities, - unconfTxs: state.metamask.unconfTxs, + unapprovedTxs: state.metamask.unapprovedTxs, selectedAccount: state.metamask.selectedAccount, scrollToBottom: state.appState.scrollToBottom, pending, @@ -35,7 +35,7 @@ AccountsScreen.prototype.render = function () { const props = this.props const { keyrings } = props const identityList = valuesFor(props.identities) - const unconfTxList = valuesFor(props.unconfTxs) + const unapprovedTxList = valuesFor(props.unapprovedTxs) return ( @@ -107,7 +107,7 @@ AccountsScreen.prototype.render = function () { h('hr.horizontal-line'), ]), - unconfTxList.length ? ( + unapprovedTxList.length ? ( h('.unconftx-link.flex-row.flex-center', { onClick: this.navigateToConfTx.bind(this), diff --git a/ui/app/app.js b/ui/app/app.js index d8dedd397..3bc4897c8 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -52,8 +52,8 @@ function mapStateToProps (state) { activeAddress: state.appState.activeAddress, transForward: state.appState.transForward, seedWords: state.metamask.seedWords, - unconfTxs: state.metamask.unconfTxs, - unconfMsgs: state.metamask.unconfMsgs, + unapprovedTxs: state.metamask.unapprovedTxs, + unapprovedMsgs: state.metamask.unapprovedMsgs, menuOpen: state.appState.menuOpen, network: state.metamask.network, provider: state.metamask.provider, diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js index 353401099..90b4ec094 100644 --- a/ui/app/components/transaction-list-item-icon.js +++ b/ui/app/components/transaction-list-item-icon.js @@ -15,15 +15,9 @@ TransactionIcon.prototype.render = function () { const { transaction, txParams, isMsg } = this.props switch (transaction.status) { case 'unapproved': - return h('.unapproved-tx', { + return h( !isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg', { style: { width: '24px', - height: '24px', - background: '#4dffff', - border: 'solid', - borderColor: '#AEAEAE', - borderWidth: '0.5px', - borderRadius: '13px', }, }) diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 95e850264..44d2dc587 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -33,7 +33,6 @@ TransactionListItem.prototype.render = function () { var isMsg = ('msgParams' in transaction) var isTx = ('txParams' in transaction) var isPending = transaction.status === 'unapproved' - let txParams if (isTx) { txParams = transaction.txParams diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js index b055ca9d5..3ae953637 100644 --- a/ui/app/components/transaction-list.js +++ b/ui/app/components/transaction-list.js @@ -13,13 +13,13 @@ function TransactionList () { } TransactionList.prototype.render = function () { - const { transactions, network, unconfMsgs } = this.props + const { transactions, network, unapprovedMsgs } = this.props var shapeShiftTxList if (network === '1') { shapeShiftTxList = this.props.shapeShiftTxList } - const txsToRender = !shapeShiftTxList ? transactions.concat(unconfMsgs) : transactions.concat(unconfMsgs, shapeShiftTxList) + const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList) .sort((a, b) => b.time - a.time) return ( diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 1bd69f7d9..f4fea03e9 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -20,8 +20,8 @@ function mapStateToProps (state) { identities: state.metamask.identities, accounts: state.metamask.accounts, selectedAccount: state.metamask.selectedAccount, - unconfTxs: state.metamask.unconfTxs, - unconfMsgs: state.metamask.unconfMsgs, + unapprovedTxs: state.metamask.unapprovedTxs, + unapprovedMsgs: state.metamask.unapprovedMsgs, index: state.appState.currentView.context, warning: state.appState.warning, network: state.metamask.network, @@ -39,10 +39,10 @@ ConfirmTxScreen.prototype.render = function () { var network = state.network var provider = state.provider - var unconfTxs = state.unconfTxs - var unconfMsgs = state.unconfMsgs + var unapprovedTxs = state.unapprovedTxs + var unapprovedMsgs = state.unapprovedMsgs - var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) + var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, network) var index = state.index !== undefined && unconfTxList[index] ? state.index : 0 var txData = unconfTxList[index] || {} var txParams = txData.params || {} diff --git a/ui/app/css/index.css b/ui/app/css/index.css index 16e1dbe7e..c3beacef2 100644 --- a/ui/app/css/index.css +++ b/ui/app/css/index.css @@ -408,6 +408,16 @@ input.large-input { .name-label{ } + +.unapproved-tx-icon { + height: 24px; + background: #4dffff; + border: solid; + borderColor: #AEAEAE; + borderWidth: 0.5px; + borderRadius: 13px; +} + .edit-text { height: 100%; visibility: hidden; diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 6a2c93f78..3b960e4c1 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -307,11 +307,11 @@ function reduceApp (state, action) { }) case actions.COMPLETED_TX: - var unconfTxs = state.metamask.unconfTxs - var unconfMsgs = state.metamask.unconfMsgs + var unapprovedTxs = state.metamask.unapprovedTxs + var unapprovedMsgs = state.metamask.unapprovedMsgs var network = state.metamask.network - var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) + var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, network) .filter(tx => tx !== tx.id) if (unconfTxList && unconfTxList.length > 0) { @@ -572,18 +572,18 @@ function reduceApp (state, action) { } function hasPendingTxs (state) { - var unconfTxs = state.metamask.unconfTxs - var unconfMsgs = state.metamask.unconfMsgs + var unapprovedTxs = state.metamask.unapprovedTxs + var unapprovedMsgs = state.metamask.unapprovedMsgs var network = state.metamask.network - var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) + var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, network) return unconfTxList.length > 0 } function indexForPending (state, txId) { - var unconfTxs = state.metamask.unconfTxs - var unconfMsgs = state.metamask.unconfMsgs + var unapprovedTxs = state.metamask.unapprovedTxs + var unapprovedMsgs = state.metamask.unapprovedMsgs var network = state.metamask.network - var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) + var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, network) let idx unconfTxList.forEach((tx, i) => { if (tx.id === txId) { diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 8679ab062..5cf249197 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -12,7 +12,7 @@ function reduceMetamask (state, action) { isUnlocked: false, rpcTarget: 'https://rawtestrpc.metamask.io/', identities: {}, - unconfTxs: {}, + unapprovedTxs: {}, currentFiat: 'USD', conversionRate: 0, conversionDate: 'N/A', @@ -76,17 +76,17 @@ function reduceMetamask (state, action) { case actions.COMPLETED_TX: var stringId = String(action.id) newState = extend(metamaskState, { - unconfTxs: {}, - unconfMsgs: {}, + unapprovedTxs: {}, + unapprovedMsgs: {}, }) - for (const id in metamaskState.unconfTxs) { + for (const id in metamaskState.unapprovedTxs) { if (id !== stringId) { - newState.unconfTxs[id] = metamaskState.unconfTxs[id] + newState.unapprovedTxs[id] = metamaskState.unapprovedTxs[id] } } - for (const id in metamaskState.unconfMsgs) { + for (const id in metamaskState.unapprovedMsgs) { if (id !== stringId) { - newState.unconfMsgs[id] = metamaskState.unconfMsgs[id] + newState.unapprovedMsgs[id] = metamaskState.unapprovedMsgs[id] } } return newState diff --git a/ui/example.js b/ui/example.js index 888748c48..4627c0e9c 100644 --- a/ui/example.js +++ b/ui/example.js @@ -29,7 +29,7 @@ var identities = { }, } -var unconfTxs = {} +var unapprovedTxs = {} addUnconfTx({ from: '0x222462427bcc9133bb46e88bcbe39cd7ef0e7222', to: '0x1113462427bcc9133bb46e88bcbe39cd7ef0e111', @@ -45,7 +45,7 @@ addUnconfTx({ function addUnconfTx (txParams) { var time = (new Date()).getTime() var id = createRandomId() - unconfTxs[id] = { + unapprovedTxs[id] = { id: id, txParams: txParams, time: time, @@ -59,7 +59,7 @@ function getState () { return { isUnlocked: isUnlocked, identities: isUnlocked ? identities : {}, - unconfTxs: isUnlocked ? unconfTxs : {}, + unapprovedTxs: isUnlocked ? unapprovedTxs : {}, selectedAccount: selectedAccount, } } diff --git a/ui/index.js b/ui/index.js index dedfd8c8c..8855064f6 100644 --- a/ui/index.js +++ b/ui/index.js @@ -32,8 +32,8 @@ function startApp (metamaskState, accountManager, opts) { }) // if unconfirmed txs, start on txConf page - var unconfirmedTxsAll = txHelper(metamaskState.unconfTxs, metamaskState.unconfMsgs, metamaskState.network) - if (unconfirmedTxsAll.length > 0) { + var unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.network) + if (unapprovedTxsAll.length > 0) { store.dispatch(actions.showConfTxPage()) } diff --git a/ui/lib/tx-helper.js b/ui/lib/tx-helper.js index c984bc9af..fa7a94cdc 100644 --- a/ui/lib/tx-helper.js +++ b/ui/lib/tx-helper.js @@ -1,8 +1,8 @@ const valuesFor = require('../app/util').valuesFor -module.exports = function (unconfTxs, unconfMsgs, network) { - var txValues = network ? valuesFor(unconfTxs).filter(tx => tx.txParams.metamaskNetworkId === network) : valuesFor(unconfTxs) - var msgValues = valuesFor(unconfMsgs) +module.exports = function (unapprovedTxs, unapprovedMsgs, network) { + var txValues = network ? valuesFor(unapprovedTxs).filter(tx => tx.txParams.metamaskNetworkId === network) : valuesFor(unapprovedTxs) + var msgValues = valuesFor(unapprovedMsgs) var allValues = txValues.concat(msgValues) return allValues.sort(tx => tx.time) } |