Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wallet] Changes to Simplex cash in #5855

Merged
merged 10 commits into from
Nov 13, 2020
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.