aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/app/modals/deposit-ether-modal.js25
-rw-r--r--ui/app/components/app/send/send-footer/send-footer.container.js3
-rw-r--r--ui/app/components/app/send/send-footer/send-footer.utils.js4
-rw-r--r--ui/app/store/actions.js30
4 files changed, 46 insertions, 16 deletions
diff --git a/ui/app/components/app/modals/deposit-ether-modal.js b/ui/app/components/app/modals/deposit-ether-modal.js
index 082ff76a9..def88f085 100644
--- a/ui/app/components/app/modals/deposit-ether-modal.js
+++ b/ui/app/components/app/modals/deposit-ether-modal.js
@@ -16,6 +16,8 @@ let WYRE_ROW_TEXT
let SHAPESHIFT_ROW_TITLE
let SHAPESHIFT_ROW_TEXT
let FAUCET_ROW_TITLE
+let COINSWITCH_ROW_TITLE
+let COINSWITCH_ROW_TEXT
function mapStateToProps (state) {
return {
@@ -27,7 +29,10 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
toCoinbase: (address) => {
- dispatch(actions.buyEth({ network: '1', address, amount: 0 }))
+ dispatch(actions.buyEth({ service: 'coinbase', address, amount: 0 }))
+ },
+ toCoinSwitch: (address) => {
+ dispatch(actions.buyEth({ service: 'coinswitch', address }))
},
hideModal: () => {
dispatch(actions.hideModal())
@@ -54,6 +59,8 @@ function DepositEtherModal (props, context) {
SHAPESHIFT_ROW_TITLE = context.t('depositShapeShift')
SHAPESHIFT_ROW_TEXT = context.t('depositShapeShiftExplainer')
FAUCET_ROW_TITLE = context.t('testFaucet')
+ COINSWITCH_ROW_TITLE = context.t('buyCoinSwitch')
+ COINSWITCH_ROW_TEXT = context.t('buyCoinSwitchExplainer')
this.state = {
buyingWithShapeshift: false,
@@ -123,7 +130,7 @@ DepositEtherModal.prototype.renderRow = function ({
}
DepositEtherModal.prototype.render = function () {
- const { network, toCoinbase, address, toFaucet } = this.props
+ const { network, toCoinbase, toCoinSwitch, address, toFaucet } = this.props
const { buyingWithShapeshift } = this.state
const isTestNetwork = ['3', '4', '42'].find(n => n === network)
@@ -190,6 +197,20 @@ DepositEtherModal.prototype.render = function () {
this.renderRow({
logo: h('div.deposit-ether-modal__logo', {
style: {
+ backgroundImage: 'url(\'./images/coinswitch_logo.png\')',
+ height: '40px',
+ },
+ }),
+ title: COINSWITCH_ROW_TITLE,
+ text: COINSWITCH_ROW_TEXT,
+ buttonLabel: this.context.t('continueToCoinSwitch'),
+ onButtonClick: () => toCoinSwitch(address),
+ hide: isTestNetwork || buyingWithShapeshift,
+ }),
+
+ this.renderRow({
+ logo: h('div.deposit-ether-modal__logo', {
+ style: {
backgroundImage: 'url(\'./images/shapeshift logo.png\')',
},
}),
diff --git a/ui/app/components/app/send/send-footer/send-footer.container.js b/ui/app/components/app/send/send-footer/send-footer.container.js
index 502159a81..ea3fd7ee4 100644
--- a/ui/app/components/app/send/send-footer/send-footer.container.js
+++ b/ui/app/components/app/send/send-footer/send-footer.container.js
@@ -96,9 +96,10 @@ function mapDispatchToProps (dispatch) {
return dispatch(updateTransaction(editingTx))
},
+
addToAddressBookIfNew: (newAddress, toAccounts, nickname = '') => {
const hexPrefixedAddress = ethUtil.addHexPrefix(newAddress)
- if (addressIsNew(toAccounts)) {
+ if (addressIsNew(toAccounts, hexPrefixedAddress)) {
// TODO: nickname, i.e. addToAddressBook(recipient, nickname)
dispatch(addToAddressBook(hexPrefixedAddress, nickname))
}
diff --git a/ui/app/components/app/send/send-footer/send-footer.utils.js b/ui/app/components/app/send/send-footer/send-footer.utils.js
index f82ff1e9b..abb2ebc77 100644
--- a/ui/app/components/app/send/send-footer/send-footer.utils.js
+++ b/ui/app/components/app/send/send-footer/send-footer.utils.js
@@ -74,7 +74,9 @@ function constructUpdatedTx ({
}
function addressIsNew (toAccounts, newAddress) {
- return !toAccounts.find(({ address }) => newAddress === address)
+ const newAddressNormalized = newAddress.toLowerCase()
+ const foundMatching = toAccounts.some(({ address }) => address === newAddressNormalized)
+ return !foundMatching
}
module.exports = {
diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js
index b2aa28c93..e5825b5f6 100644
--- a/ui/app/store/actions.js
+++ b/ui/app/store/actions.js
@@ -2488,21 +2488,27 @@ function setShowFiatConversionOnTestnetsPreference (value) {
}
function setCompletedOnboarding () {
- return dispatch => {
+ return async dispatch => {
dispatch(actions.showLoadingIndication())
- return new Promise((resolve, reject) => {
- background.completeOnboarding(err => {
- dispatch(actions.hideLoadingIndication())
- if (err) {
- dispatch(actions.displayWarning(err.message))
- return reject(err)
- }
+ try {
+ await pify(background.markAllNoticesRead).call(background)
+ } catch (err) {
+ dispatch(actions.displayWarning(err.message))
+ throw err
+ }
- dispatch(actions.completeOnboarding())
- resolve()
- })
- })
+ dispatch(actions.clearNotices())
+
+ try {
+ await pify(background.completeOnboarding).call(background)
+ } catch (err) {
+ dispatch(actions.displayWarning(err.message))
+ throw err
+ }
+
+ dispatch(actions.completeOnboarding())
+ dispatch(actions.hideLoadingIndication())
}
}