aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorEsteban MIno <efmino@uc.cl>2018-08-17 07:19:19 +0800
committerEsteban MIno <efmino@uc.cl>2018-08-17 07:19:19 +0800
commitbb868f58348962d4a85415380d11f72892a2e28c (patch)
tree0ee1d9a6da025379fd0ca5e81febdb15dbec34f2 /ui
parent2ace30bcd1d8280b440a4ce2a7156f94cf4f78f2 (diff)
downloadtangerine-wallet-browser-bb868f58348962d4a85415380d11f72892a2e28c.tar
tangerine-wallet-browser-bb868f58348962d4a85415380d11f72892a2e28c.tar.gz
tangerine-wallet-browser-bb868f58348962d4a85415380d11f72892a2e28c.tar.bz2
tangerine-wallet-browser-bb868f58348962d4a85415380d11f72892a2e28c.tar.lz
tangerine-wallet-browser-bb868f58348962d4a85415380d11f72892a2e28c.tar.xz
tangerine-wallet-browser-bb868f58348962d4a85415380d11f72892a2e28c.tar.zst
tangerine-wallet-browser-bb868f58348962d4a85415380d11f72892a2e28c.zip
correct behavior when notification is closed when popup
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js23
-rw-r--r--ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js12
-rw-r--r--ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js3
-rw-r--r--ui/app/components/pages/home.js1
4 files changed, 23 insertions, 16 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 4e3c87756..0760377c2 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -1626,16 +1626,21 @@ function addTokens (tokens) {
function removeSuggestedTokens () {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
- background.removeSuggestedTokens((err) => {
- dispatch(actions.hideLoadingIndication())
- if (err) {
- dispatch(actions.displayWarning(err.message))
- }
- dispatch(actions.clearPendingTokens())
- if (global.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_NOTIFICATION) {
- return global.platform.closeCurrentWindow()
- }
+ return new Promise((resolve, reject) => {
+ background.removeSuggestedTokens((err, suggestedTokens) => {
+ dispatch(actions.hideLoadingIndication())
+ if (err) {
+ dispatch(actions.displayWarning(err.message))
+ }
+ dispatch(actions.clearPendingTokens())
+ if (global.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_NOTIFICATION) {
+ return global.platform.closeCurrentWindow()
+ }
+ resolve(suggestedTokens)
+ })
})
+ .then(() => updateMetamaskStateFromBackground())
+ .then(suggestedTokens => dispatch(actions.updateMetamaskState({...suggestedTokens})))
}
}
diff --git a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js
index e8155b5f0..37d9aca02 100644
--- a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js
+++ b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.component.js
@@ -33,7 +33,7 @@ export default class ConfirmAddSuggestedToken extends Component {
}
render () {
- const { addToken, clearPendingTokens, pendingTokens, removeSuggestedTokens, history } = this.props
+ const { addToken, pendingTokens, removeSuggestedTokens, history } = this.props
const pendingTokenKey = Object.keys(pendingTokens)[0]
const pendingToken = pendingTokens[pendingTokenKey]
@@ -96,8 +96,10 @@ export default class ConfirmAddSuggestedToken extends Component {
className="page-container__footer-button"
onClick={() => {
removeSuggestedTokens()
- history.push(DEFAULT_ROUTE)
- }}
+ .then(() => {
+ history.push(DEFAULT_ROUTE)
+ })
+ }}
>
{ this.context.t('cancel') }
</Button>
@@ -109,7 +111,9 @@ export default class ConfirmAddSuggestedToken extends Component {
addToken(pendingToken)
.then(() => {
removeSuggestedTokens()
- history.push(DEFAULT_ROUTE)
+ .then(() => {
+ history.push(DEFAULT_ROUTE)
+ })
})
}}
>
diff --git a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js
index 97e07afda..89291ff4f 100644
--- a/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js
+++ b/ui/app/components/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js
@@ -5,7 +5,7 @@ import { withRouter } from 'react-router-dom'
const extend = require('xtend')
-const { addToken, clearPendingTokens, removeSuggestedTokens } = require('../../../actions')
+const { addToken, removeSuggestedTokens } = require('../../../actions')
const mapStateToProps = ({ metamask }) => {
const { pendingTokens, suggestedTokens } = metamask
@@ -19,7 +19,6 @@ const mapStateToProps = ({ metamask }) => {
const mapDispatchToProps = dispatch => {
return {
addToken: ({address, symbol, decimals, imageUrl}) => dispatch(addToken(address, symbol, decimals, imageUrl)),
- clearPendingTokens: () => dispatch(clearPendingTokens()),
removeSuggestedTokens: () => dispatch(removeSuggestedTokens()),
}
}
diff --git a/ui/app/components/pages/home.js b/ui/app/components/pages/home.js
index 629dc11fc..6ee083579 100644
--- a/ui/app/components/pages/home.js
+++ b/ui/app/components/pages/home.js
@@ -40,7 +40,6 @@ class Home extends Component {
// suggested new tokens
if (Object.keys(suggestedTokens).length > 0) {
- console.log('CALLING CONFIRM ADD SUGGESTED')
history.push(CONFIRM_ADD_SUGGESTED_TOKEN_ROUTE)
}