Skip to content

Commit

Permalink
[Wallet] Changes to Simplex cash in (#5855)
Browse files Browse the repository at this point in the history
### Description

Implement the changes discussed in this thread: https://celo-org.slack.com/archives/CL7BVQPHB/p1605212144230400
- Open Simplex webpage instead of using a webview.
- Selection: right now, seems like the selection for cUSD/CELO is dependent on the method selected vs the country (eg CELO should always be selectable, but then only provide the option for ‘cryptocurrency exchange’
- Debit Card copy change-- update “Debit, Credit, or Bank Account” to “Debit Card or Bank Account”

### Tested

Manually
  • Loading branch information
gnardini authored Nov 13, 2020
1 parent 92abe60 commit 8f70672
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 89 deletions.
2 changes: 1 addition & 1 deletion packages/mobile/locales/en-US/fiatExchangeFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dollarsNotYetEnabledNote": "Celo Dollars are not yet available on any providers. To get Celo Dollars, purchase CELO and exchange it for Celo Dollars in the CELO tab.",
"selectDigitalCurrency": "Select a digital currency",
"selectPaymentMethod": "Pay with:",
"payWithFiat": "Debit, credit, or bank account",
"payWithFiat": "Debit card or bank account",
"payWithExchange": "Cryptocurrency exchange",
"selectCashOutMethod": "Receive funds in:",
"receiveOnAddress": "cUSD/CELO address",
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/locales/es-419/fiatExchangeFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dollarsNotYetEnabledNote": "Los Celo Dólares aún no están disponibles en ningún proveedor. Para obtener Celo Dólares, compra CELO y cámbialos por Celo Dólares dentro de Valora, bajo la pestaña CELO.",
"selectDigitalCurrency": "Selecciona una moneda digital",
"selectPaymentMethod": "Pague con:",
"payWithFiat": "Débito, crédito, o cuanta bancaria",
"payWithFiat": "Tarjeta de débito o cuenta bancaria",
"payWithExchange": "Exchange de criptomonedas",
"selectCashOutMethod": "Recibe los fondos en:",
"receiveOnAddress": "Dirección de cUSD/CELO",
Expand Down
15 changes: 9 additions & 6 deletions packages/mobile/src/fiatExchanges/FiatExchangeOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { TouchableWithoutFeedback } from 'react-native-gesture-handler'
import { useSelector } from 'react-redux'
import { kotaniEnabledSelector, pontoEnabledSelector } from 'src/app/selectors'
import BackButton from 'src/components/BackButton'
import { KOTANI_URI, PONTO_URI } from 'src/config'
import { KOTANI_URI, PONTO_URI, SIMPLEX_URI } from 'src/config'
import FundingEducationDialog from 'src/fiatExchanges/FundingEducationDialog'
import i18n, { Namespaces } from 'src/i18n'
import InfoIcon from 'src/icons/InfoIcon'
Expand All @@ -26,7 +26,9 @@ import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import { StackParamList } from 'src/navigator/types'
import { useCountryFeatures } from 'src/utils/countryFeatures'
import { navigateToURI } from 'src/utils/linking'
import Logger from 'src/utils/Logger'
import { currentAccountSelector } from 'src/web3/selectors'

const FALLBACK_CURRENCY = LocalCurrencyCode.USD

Expand Down Expand Up @@ -116,6 +118,7 @@ function PaymentMethodRadioItem({
function FiatExchangeOptions({ route, navigation }: Props) {
const { t } = useTranslation(Namespaces.fiatExchangeFlow)
const isAddFunds = route.params?.isAddFunds ?? true
const account = useSelector(currentAccountSelector)
const localCurrency = useSelector(getLocalCurrencyCode)
const {
SIMPLEX_DISABLED,
Expand All @@ -130,11 +133,9 @@ function FiatExchangeOptions({ route, navigation }: Props) {

Logger.debug(`Ponto: ${pontoEnabled} Kotani: ${kotaniEnabled}`)

const [selectedCurrency, setSelectedCurrency] = useState<CURRENCY_ENUM>(
SIMPLEX_DISABLED ? CURRENCY_ENUM.GOLD : CURRENCY_ENUM.DOLLAR
)
const [selectedCurrency, setSelectedCurrency] = useState<CURRENCY_ENUM>(CURRENCY_ENUM.DOLLAR)
const [selectedPaymentMethod, setSelectedPaymentMethod] = useState<PaymentMethod>(
isAddFunds && (!SIMPLEX_DISABLED || !MOONPAY_DISABLED)
isAddFunds && !SIMPLEX_DISABLED && !MOONPAY_DISABLED
? PaymentMethod.FIAT
: PaymentMethod.EXCHANGE
)
Expand All @@ -151,8 +152,10 @@ function FiatExchangeOptions({ route, navigation }: Props) {
navigate(Screens.LocalProviderCashOut, { uri: KOTANI_URI })
} else if (selectedPaymentMethod === PaymentMethod.ADDRESS) {
navigate(Screens.WithdrawCeloScreen, { isCashOut: true })
} else if (selectedCurrency === CURRENCY_ENUM.DOLLAR) {
navigateToURI(`${SIMPLEX_URI}?address=${account}`)
} else {
navigate(selectedCurrency === CURRENCY_ENUM.GOLD ? Screens.MoonPay : Screens.Simplex, {
navigate(Screens.MoonPay, {
localAmount: new BigNumber(0),
currencyCode: localCurrency || FALLBACK_CURRENCY,
})
Expand Down
66 changes: 0 additions & 66 deletions packages/mobile/src/fiatExchanges/Simplex.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ exports[`FiatExchangeOptions renders correctly 1`] = `
"lineHeight": 22,
"marginLeft": 16,
},
Object {
"color": "#B4B9BD",
},
Object {},
]
}
>
Expand Down Expand Up @@ -349,17 +347,10 @@ exports[`FiatExchangeOptions renders correctly 1`] = `
cx="10"
cy="10"
r="9"
stroke="#1AB775"
stroke="#B4B9BD"
strokeWidth={2}
style={Object {}}
/>
<circle
cx="10"
cy="10"
fill="#1AB775"
r="6"
style={Object {}}
/>
</svg>
<Text
style={
Expand Down Expand Up @@ -418,10 +409,17 @@ exports[`FiatExchangeOptions renders correctly 1`] = `
cx="10"
cy="10"
r="9"
stroke="#B4B9BD"
stroke="#1AB775"
strokeWidth={2}
style={Object {}}
/>
<circle
cx="10"
cy="10"
fill="#1AB775"
r="6"
style={Object {}}
/>
</svg>
<Text
style={
Expand Down
2 changes: 0 additions & 2 deletions packages/mobile/src/navigator/Navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import LocalProviderCashOut, {
localProviderCashOutOptions,
} from 'src/fiatExchanges/LocalProviderCashOut'
import MoonPay, { moonPayOptions } from 'src/fiatExchanges/MoonPay'
import Simplex, { simplexOptions } from 'src/fiatExchanges/Simplex'
import Spend, { spendScreenOptions } from 'src/fiatExchanges/Spend'
import { CURRENCY_ENUM } from 'src/geth/consts'
import i18n from 'src/i18n'
Expand Down Expand Up @@ -429,7 +428,6 @@ const settingsScreens = (Navigator: typeof Stack) => (
component={LocalProviderCashOut}
/>
<Navigator.Screen options={moonPayOptions} name={Screens.MoonPay} component={MoonPay} />
<Navigator.Screen options={simplexOptions} name={Screens.Simplex} component={Simplex} />
</>
)

Expand Down
1 change: 0 additions & 1 deletion packages/mobile/src/navigator/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ export type StackParamList = {
[Screens.Settings]:
| { promptFornoModal?: boolean; promptConfirmRemovalModal?: boolean }
| undefined
[Screens.Simplex]: undefined
[Screens.Spend]: undefined
[Screens.Support]: undefined
[Screens.SupportContact]: undefined
Expand Down

0 comments on commit 8f70672

Please sign in to comment.