Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit 95305dc

Browse files
authored
Merge pull request #4615 from brave/bitcoin-without-coinbase
do not show coinbase for unsupported countries
2 parents 43c0100 + 067f6a7 commit 95305dc

File tree

5 files changed

+89
-16
lines changed

5 files changed

+89
-16
lines changed

app/extensions/brave/locales/en-US/preferences.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ ok=Ok
6767
notifications=Show payment notifications
6868
moneyAdd=Use your debit/credit card
6969
moneyAddSubTitle=No Bitcoin needed!
70-
outsideUSAPayment=Need to buy Bitcoin outside of the USA?
70+
outsideUSAPayment=Buy Bitcoin at our recommended source
7171
coinbaseNotAvailable=Sorry! Adding funds with a credit/debit card is only available for contributions of $5/month at the moment.
7272
add=Fund with debit/credit
7373
transferTime=Transfer may take up to 40 minutes
@@ -78,6 +78,7 @@ firstKey=Key 1
7878
secondKey=Key 2
7979
firstRecoveryKey=Recovery Key 1
8080
secondRecoveryKey=Recovery Key 2
81+
addFundsAlternate=Add funds to your Brave Wallet
8182
copyToClipboard=Copy to clipboard
8283
smartphoneTitle=Use your smartphone app to transfer Bitcoin
8384
displayQRCode=Display QR code

js/about/preferences.js

+43-13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const appConfig = require('../constants/appConfig')
1818
const preferenceTabs = require('../constants/preferenceTabs')
1919
const messages = require('../constants/messages')
2020
const settings = require('../constants/settings')
21+
const coinbaseCountries = require('../constants/coinbaseCountries')
2122
const {passwordManagers, extensionIds} = require('../constants/passwordManagers')
2223
const aboutActions = require('./aboutActions')
2324
const getSetting = require('../settings').getSetting
@@ -300,11 +301,15 @@ class BitcoinDashboard extends ImmutableComponent {
300301
</div>
301302
}
302303
get qrcodeOverlayFooter () {
303-
return <div>
304-
<div id='coinbaseLogo' />
305-
<div id='appstoreLogo' />
306-
<div id='playstoreLogo' />
307-
</div>
304+
if (coinbaseCountries.indexOf(this.props.ledgerData.get('countryCode')) > -1) {
305+
return <div>
306+
<div id='coinbaseLogo' />
307+
<a href='https://itunes.apple.com/us/app/coinbase-bitcoin-wallet/id886427730?mt=8' target='_blank' id='appstoreLogo' />
308+
<a href='https://play.google.com/store/apps/details?id=com.coinbase.android' target='_blank' id='playstoreLogo' />
309+
</div>
310+
} else {
311+
return null
312+
}
308313
}
309314
get currency () {
310315
return this.props.ledgerData.get('currency') || 'USD'
@@ -319,6 +324,19 @@ class BitcoinDashboard extends ImmutableComponent {
319324
const countryCode = this.props.ledgerData.get('countryCode')
320325
return !(countryCode && countryCode !== 'US')
321326
}
327+
get worldWidePanel () {
328+
return <div className='panel'>
329+
<div className='settingsPanelDivider'>
330+
<span className='fa fa-credit-card' />
331+
<div className='settingsListTitle' data-l10n-id='outsideUSAPayment' />
332+
</div>
333+
<div className='settingsPanelDivider'>
334+
<a target='_blank' className='browserButton primaryButton' href='https://www.buybitcoinworldwide.com/'>
335+
buybitcoinworldwide.com
336+
</a>
337+
</div>
338+
</div>
339+
}
322340
get coinbasePanel () {
323341
if (this.canUseCoinbase) {
324342
return <div className='panel'>
@@ -348,9 +366,9 @@ class BitcoinDashboard extends ImmutableComponent {
348366
get exchangePanel () {
349367
const url = this.props.ledgerData.getIn(['exchangeInfo', 'exchangeURL'])
350368
const name = this.props.ledgerData.getIn(['exchangeInfo', 'exchangeName'])
351-
// Call coinbasePanel if we don't have the URL or Name
369+
// Call worldWidePanel if we don't have the URL or Name
352370
if (!url || !name) {
353-
return this.coinbasePanel
371+
return this.worldWidePanel
354372
} else {
355373
return <div className='panel'>
356374
<div className='settingsPanelDivider'>
@@ -377,11 +395,15 @@ class BitcoinDashboard extends ImmutableComponent {
377395
</div>
378396
}
379397
get panelFooter () {
380-
return <div className='panelFooter'>
381-
<div id='coinbaseLogo' />
382-
<span className='coinbaseMessage' data-l10n-id='coinbaseMessage' />
383-
<Button l10nId='done' className='pull-right whiteButton' onClick={this.props.hideParentOverlay} />
384-
</div>
398+
if (coinbaseCountries.indexOf(this.props.ledgerData.get('countryCode')) > -1) {
399+
return <div className='panelFooter'>
400+
<div id='coinbaseLogo' />
401+
<span className='coinbaseMessage' data-l10n-id='coinbaseMessage' />
402+
<Button l10nId='done' className='pull-right whiteButton' onClick={this.props.hideParentOverlay} />
403+
</div>
404+
} else {
405+
return null
406+
}
385407
}
386408
copyToClipboard (text) {
387409
aboutActions.setClipboard(text)
@@ -843,6 +865,14 @@ class PaymentsTab extends ImmutableComponent {
843865
siteSettings={this.props.siteSettings} />
844866
}
845867

868+
get overlayTitle () {
869+
if (coinbaseCountries.indexOf(this.props.ledgerData.get('countryCode')) > -1) {
870+
return 'addFunds'
871+
} else {
872+
return 'addFundsAlternate'
873+
}
874+
}
875+
846876
get overlayContent () {
847877
return <BitcoinDashboard ledgerData={this.props.ledgerData}
848878
settings={this.props.settings}
@@ -1114,7 +1144,7 @@ class PaymentsTab extends ImmutableComponent {
11141144
return <div id='paymentsContainer'>
11151145
{
11161146
this.enabled && this.props.addFundsOverlayVisible
1117-
? <ModalOverlay title={'addFunds'} content={this.overlayContent} onHide={this.props.hideOverlay.bind(this, 'addFunds')} />
1147+
? <ModalOverlay title={this.overlayTitle} content={this.overlayContent} onHide={this.props.hideOverlay.bind(this, 'addFunds')} />
11181148
: null
11191149
}
11201150
{

js/constants/coinbaseCountries.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
3+
* You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
const coinbaseCountries = [
6+
'AT',
7+
'AU',
8+
'BE',
9+
'BG',
10+
'CA',
11+
'CH',
12+
'CY',
13+
'CZ',
14+
'DK',
15+
'ES',
16+
'FI',
17+
'FR',
18+
'GB',
19+
'GR',
20+
'HR',
21+
'HU',
22+
'IE',
23+
'IT',
24+
'LI',
25+
'LV',
26+
'MC',
27+
'MT',
28+
'NL',
29+
'NO',
30+
'PL',
31+
'PT',
32+
'RO',
33+
'SE',
34+
'SG',
35+
'SI',
36+
'SK',
37+
'SM',
38+
'US'
39+
]
40+
41+
module.exports = coinbaseCountries

less/about/preferences.less

+2-1
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,9 @@ div.nextPaymentSubmission {
882882
color: @darkGray;
883883
clear: both;
884884
font-weight: normal;
885-
font-size: 13px;
885+
font-size: 14px;
886886
font-style: italic;
887+
line-height: 1.3em;
887888
}
888889
span {
889890
display: inline-block;

less/modalOverlay.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
height: auto;
6565
margin: 100px auto 0 auto;
6666
background: white;
67-
box-shadow: @buttonShadow;
67+
box-shadow: @dialogShadow;
6868

6969
button.close span {
7070
color: @gray;

0 commit comments

Comments
 (0)