Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/__tests__/creditCardPlugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, test } from '@jest/globals'
import { sprintf } from 'sprintf-js'

import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import { createPriorityArray } from '../plugins/gui/creditCardPlugin'
import { FiatProviderError } from '../plugins/gui/fiatProviderTypes'
import { getBestError } from '../plugins/gui/pluginUtils'
Expand All @@ -26,22 +26,22 @@ describe('creditCardPlugin', function () {
test('overLimit', function () {
const errors: FiatProviderError[] = [new FiatProviderError({ errorType: 'overLimit', errorAmount: 50 })]
const result = getBestError(errors, 'USD')
expect(result).toBe(sprintf(s.strings.fiat_plugin_buy_amount_over_limit, '50 USD'))
expect(result).toBe(sprintf(lstrings.fiat_plugin_buy_amount_over_limit, '50 USD'))
})
test('underLimit', function () {
const errors: FiatProviderError[] = [new FiatProviderError({ errorType: 'underLimit', errorAmount: 50 })]
const result = getBestError(errors, 'USD')
expect(result).toBe(sprintf(s.strings.fiat_plugin_buy_amount_under_limit, '50 USD'))
expect(result).toBe(sprintf(lstrings.fiat_plugin_buy_amount_under_limit, '50 USD'))
})
test('regionRestricted', function () {
const errors: FiatProviderError[] = [new FiatProviderError({ errorType: 'regionRestricted' })]
const result = getBestError(errors, 'USD')
expect(result).toBe(s.strings.fiat_plugin_buy_region_restricted)
expect(result).toBe(lstrings.fiat_plugin_buy_region_restricted)
})
test('assetUnsupported', function () {
const errors: FiatProviderError[] = [new FiatProviderError({ errorType: 'assetUnsupported' })]
const result = getBestError(errors, 'USD')
expect(result).toBe(s.strings.fiat_plugin_asset_unsupported)
expect(result).toBe(lstrings.fiat_plugin_asset_unsupported)
})
test('underLimit 1 2 3', function () {
const errors: FiatProviderError[] = [
Expand All @@ -50,7 +50,7 @@ describe('creditCardPlugin', function () {
new FiatProviderError({ errorType: 'underLimit', errorAmount: 3 })
]
const result = getBestError(errors, 'USD')
expect(result).toBe(sprintf(s.strings.fiat_plugin_buy_amount_under_limit, '1 USD'))
expect(result).toBe(sprintf(lstrings.fiat_plugin_buy_amount_under_limit, '1 USD'))
})
test('overLimit 1 2 3', function () {
const errors: FiatProviderError[] = [
Expand All @@ -59,7 +59,7 @@ describe('creditCardPlugin', function () {
new FiatProviderError({ errorType: 'overLimit', errorAmount: 3 })
]
const result = getBestError(errors, 'USD')
expect(result).toBe(sprintf(s.strings.fiat_plugin_buy_amount_over_limit, '3 USD'))
expect(result).toBe(sprintf(lstrings.fiat_plugin_buy_amount_over_limit, '3 USD'))
})
test('overLimit underLimit regionRestricted assetUnsupported', function () {
const errors: FiatProviderError[] = [
Expand All @@ -69,12 +69,12 @@ describe('creditCardPlugin', function () {
new FiatProviderError({ errorType: 'assetUnsupported' })
]
const result = getBestError(errors, 'USD')
expect(result).toBe(sprintf(s.strings.fiat_plugin_buy_amount_under_limit, '2 USD'))
expect(result).toBe(sprintf(lstrings.fiat_plugin_buy_amount_under_limit, '2 USD'))
})
test('regionRestricted assetUnsupported', function () {
const errors: FiatProviderError[] = [new FiatProviderError({ errorType: 'regionRestricted' }), new FiatProviderError({ errorType: 'assetUnsupported' })]
const result = getBestError(errors, 'USD')
expect(result).toBe(s.strings.fiat_plugin_buy_region_restricted)
expect(result).toBe(lstrings.fiat_plugin_buy_region_restricted)
})
})
})
4 changes: 2 additions & 2 deletions src/__tests__/reducers/sendConfirmationReducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, test } from '@jest/globals'
import { EdgeTransaction } from 'edge-core-js'
import { cloneDeep } from 'lodash'

import s from '../../locales/strings'
import { lstrings } from '../../locales/strings'
import { initialState, sendConfirmation } from '../../reducers/scenes/SendConfirmationReducer'

describe('sendConfirmation reducer', () => {
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('sendConfirmation reducer', () => {
signedTx: '',
txid: ''
}
const error = new Error(s.strings.incorrect_pin)
const error = new Error(lstrings.incorrect_pin)
// use initialState after sendConfirmation reducer not longer mutates state
const initialStateClone: any = cloneDeep(initialState)
const actual = sendConfirmation(initialStateClone, {
Expand Down
8 changes: 4 additions & 4 deletions src/actions/AccountActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react'

import { TextInputModal } from '../components/modals/TextInputModal'
import { Airship, showError } from '../components/services/AirshipInstance'
import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import { ThunkAction } from '../types/reduxTypes'
import { NavigationBase } from '../types/routerTypes'

Expand All @@ -30,15 +30,15 @@ interface ValidatePasswordOptions {

export function validatePassword(opts: ValidatePasswordOptions = {}): ThunkAction<Promise<boolean>> {
return async (dispatch, getState) => {
const { message, submitLabel, title = s.strings.confirm_password_text, warningMessage } = opts
const { message, submitLabel, title = lstrings.confirm_password_text, warningMessage } = opts
const state = getState()
const { account } = state.core
const password = await Airship.show<string | undefined>(bridge => (
<TextInputModal
autoFocus={warningMessage == null}
autoCorrect={false}
bridge={bridge}
inputLabel={s.strings.enter_your_password}
inputLabel={lstrings.enter_your_password}
message={message}
returnKeyType="go"
secureTextEntry
Expand All @@ -47,7 +47,7 @@ export function validatePassword(opts: ValidatePasswordOptions = {}): ThunkActio
warningMessage={warningMessage}
onSubmit={async password => {
const isOk = await account.checkPassword(password)
if (!isOk) return s.strings.password_reminder_invalid
if (!isOk) return lstrings.password_reminder_invalid
dispatch({ type: 'PASSWORD_USED' })
return true
}}
Expand Down
20 changes: 10 additions & 10 deletions src/actions/CreateWalletActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AccountPaymentParams } from '../components/scenes/CreateWalletAccountSe
import { Airship, showError } from '../components/services/AirshipInstance'
import { WalletCreateItem } from '../components/themed/WalletList'
import { getPluginId, SPECIAL_CURRENCY_INFO } from '../constants/WalletAndCurrencyConstants'
import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import { HandleAvailableStatus } from '../reducers/scenes/CreateWalletReducer'
import { getExchangeDenomination } from '../selectors/DenominationSelectors'
import { config } from '../theme/appConfig'
Expand Down Expand Up @@ -199,21 +199,21 @@ export function createAccountTransaction(
if (error) {
console.log(error)
setTimeout(() => {
Alert.alert(s.strings.create_wallet_account_error_sending_transaction)
Alert.alert(lstrings.create_wallet_account_error_sending_transaction)
}, 750)
} else if (edgeTransaction) {
logEvent('Activate_Wallet_Done', {
currencyCode: createdWalletCurrencyCode
})
const edgeMetadata: EdgeMetadata = {
name: sprintf(s.strings.create_wallet_account_metadata_name, createdWalletCurrencyCode),
category: 'Expense:' + sprintf(s.strings.create_wallet_account_metadata_category, createdWalletCurrencyCode),
notes: sprintf(s.strings.create_wallet_account_metadata_notes, createdWalletCurrencyCode, createdWalletCurrencyCode, config.supportEmail)
name: sprintf(lstrings.create_wallet_account_metadata_name, createdWalletCurrencyCode),
category: 'Expense:' + sprintf(lstrings.create_wallet_account_metadata_category, createdWalletCurrencyCode),
notes: sprintf(lstrings.create_wallet_account_metadata_notes, createdWalletCurrencyCode, createdWalletCurrencyCode, config.supportEmail)
}
paymentWallet.saveTxMetadata(edgeTransaction.txid, currencyCode, edgeMetadata).then(() => {
navigation.navigate('walletsTab', { screen: 'walletList' })
setTimeout(() => {
Alert.alert(s.strings.create_wallet_account_payment_sent_title, s.strings.create_wallet_account_payment_sent_message)
Alert.alert(lstrings.create_wallet_account_payment_sent_title, lstrings.create_wallet_account_payment_sent_message)
}, 750)
})
}
Expand Down Expand Up @@ -245,9 +245,9 @@ export function createHandleUnavailableModal(navigation: NavigationBase, newWall
await Airship.show<'ok' | undefined>(bridge => (
<ButtonsModal
bridge={bridge}
title={s.strings.create_wallet_account_handle_unavailable_modal_title}
message={sprintf(s.strings.create_wallet_account_handle_unavailable_modal_message, accountName)}
buttons={{ ok: { label: s.strings.string_ok } }}
title={lstrings.create_wallet_account_handle_unavailable_modal_title}
message={sprintf(lstrings.create_wallet_account_handle_unavailable_modal_message, accountName)}
buttons={{ ok: { label: lstrings.string_ok } }}
/>
))
navigation.pop()
Expand Down Expand Up @@ -306,7 +306,7 @@ export function enableTokensAcrossWallets(newTokenItems: TokenWalletCreateItem[]
export const getUniqueWalletName = (account: EdgeAccount, pluginId: string): string => {
const { currencyWallets, currencyConfig } = account
const { displayName } = currencyConfig[pluginId].currencyInfo
const defaultName = SPECIAL_CURRENCY_INFO[pluginId]?.initWalletName ?? sprintf(s.strings.my_crypto_wallet_name, displayName)
const defaultName = SPECIAL_CURRENCY_INFO[pluginId]?.initWalletName ?? sprintf(lstrings.my_crypto_wallet_name, displayName)

const existingWalletNames = Object.keys(currencyWallets)
.filter(walletId => currencyWallets[walletId].currencyInfo.pluginId === pluginId)
Expand Down
16 changes: 8 additions & 8 deletions src/actions/CryptoExchangeActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { trackConversion } from '../actions/TrackingActions'
import { InsufficientFeesModal } from '../components/modals/InsufficientFeesModal'
import { Airship, showError } from '../components/services/AirshipInstance'
import { formatNumber } from '../locales/intl'
import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import { getDisplayDenomination, getExchangeDenomination } from '../selectors/DenominationSelectors'
import { convertCurrency } from '../selectors/WalletSelectors'
import { RootState, ThunkAction } from '../types/reduxTypes'
Expand Down Expand Up @@ -222,7 +222,7 @@ function processSwapQuoteError(error: unknown): ThunkAction<void> {

return dispatch({
type: 'GENERIC_SHAPE_SHIFT_ERROR',
data: sprintf(s.strings.amount_above_limit, displayMax, currentCurrencyDenomination.name)
data: sprintf(lstrings.amount_above_limit, displayMax, currentCurrencyDenomination.name)
})
}

Expand All @@ -238,23 +238,23 @@ function processSwapQuoteError(error: unknown): ThunkAction<void> {

return dispatch({
type: 'GENERIC_SHAPE_SHIFT_ERROR',
data: sprintf(s.strings.amount_below_limit, displayMin, currentCurrencyDenomination.name)
data: sprintf(lstrings.amount_below_limit, displayMin, currentCurrencyDenomination.name)
})
}

const currencyError = asMaybeSwapCurrencyError(error)
if (currencyError != null) {
return dispatch({
type: 'GENERIC_SHAPE_SHIFT_ERROR',
data: sprintf(s.strings.ss_unable, fromCurrencyCode, toCurrencyCode)
data: sprintf(lstrings.ss_unable, fromCurrencyCode, toCurrencyCode)
})
}

const permissionError = asMaybeSwapPermissionError(error)
if (permissionError?.reason === 'geoRestriction') {
return dispatch({
type: 'GENERIC_SHAPE_SHIFT_ERROR',
data: s.strings.ss_geolock
data: lstrings.ss_geolock
})
}

Expand Down Expand Up @@ -292,7 +292,7 @@ export function shiftCryptoCurrency(navigation: NavigationBase, swapInfo: GuiSwa
const name = isTransfer ? toWalletName : swapInfo.displayName
const swapType = isTransfer ? 'transfer' : 'exchange'
const swapTarget = isTransfer ? toWalletName : toCurrencyCode
const category = `${swapType}:${fromCurrencyCode} ${s.strings.word_to_in_convert_from_to_string} ${swapTarget}`
const category = `${swapType}:${fromCurrencyCode} ${lstrings.word_to_in_convert_from_to_string} ${swapTarget}`

const result: EdgeSwapResult = await quote.approve({ metadata: { name, category } })

Expand Down Expand Up @@ -337,7 +337,7 @@ export function shiftCryptoCurrency(navigation: NavigationBase, swapInfo: GuiSwa
logEvent('Exchange_Shift_Failed', { error: String(error) }) // TODO: Do we need to parse/clean all cases?
dispatch({ type: 'DONE_SHIFT_TRANSACTION' })
setTimeout(() => {
showError(`${s.strings.exchange_failed}. ${error.message}`)
showError(`${lstrings.exchange_failed}. ${error.message}`)
}, 1)
}
}
Expand Down Expand Up @@ -390,7 +390,7 @@ export function checkEnabledExchanges(): ThunkAction<void> {
}

if (!isAnyExchangeEnabled) {
Alert.alert(s.strings.no_exchanges_available, s.strings.check_exchange_settings)
Alert.alert(lstrings.no_exchanges_available, lstrings.check_exchange_settings)
}
}
}
Expand Down
14 changes: 6 additions & 8 deletions src/actions/DeepLinkingActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { launchPriceChangeBuySellSwapModal } from '../components/modals/PriceCha
import { pickWallet } from '../components/modals/WalletListModal'
import { showError, showToast } from '../components/services/AirshipInstance'
import { guiPlugins } from '../constants/plugins/GuiPlugins'
import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import { asFiatPaymentType } from '../plugins/gui/fiatPluginTypes'
import { DeepLink } from '../types/DeepLinkTypes'
import { Dispatch, RootState, ThunkAction } from '../types/reduxTypes'
Expand Down Expand Up @@ -174,7 +174,7 @@ export async function handleLink(navigation: NavigationBase, dispatch: Dispatch,
if (matchingWalletIdsAndUris.length === 0) {
if (!allWalletsLoaded) return false

showError(s.strings.alert_deep_link_no_wallet_for_uri)
showError(lstrings.alert_deep_link_no_wallet_for_uri)
return true
}

Expand All @@ -194,7 +194,7 @@ export async function handleLink(navigation: NavigationBase, dispatch: Dispatch,
})
const walletListResult = await pickWallet({ account, allowedWalletIds, assets, navigation })
if (walletListResult == null) {
showError(s.strings.scan_camera_no_matching_wallet)
showError(lstrings.scan_camera_no_matching_wallet)
return true
}

Expand All @@ -220,19 +220,17 @@ export async function handleLink(navigation: NavigationBase, dispatch: Dispatch,
return true
}
}

return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You accidentally deleted this line!

}

async function launchAzteco(navigation: NavigationBase, edgeWallet: EdgeCurrencyWallet, uri: string): Promise<void> {
const address = await edgeWallet.getReceiveAddress()
const response = await fetch(`${uri}${address.publicAddress}`)
if (response.ok) {
showToast(s.strings.azteco_success)
showToast(lstrings.azteco_success)
} else if (response.status === 400) {
showError(s.strings.azteco_invalid_code)
showError(lstrings.azteco_invalid_code)
} else {
showError(s.strings.azteco_service_unavailable)
showError(lstrings.azteco_service_unavailable)
}
navigation.navigate('walletsTab', { screen: 'walletList' })
}
10 changes: 5 additions & 5 deletions src/actions/DeleteWalletModalActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react'
import { ButtonsModal } from '../components/modals/ButtonsModal'
import { Airship } from '../components/services/AirshipInstance'
import { ModalMessage } from '../components/themed/ModalParts'
import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import { B } from '../styles/common/textStyles'
import { ThunkAction } from '../types/reduxTypes'
import { getWalletName } from '../util/CurrencyWalletHelpers'
Expand All @@ -17,15 +17,15 @@ export function showDeleteWalletModal(walletId: string, additionalMsg?: string):
const resolveValue = await Airship.show<'confirm' | 'cancel' | undefined>(bridge => (
<ButtonsModal
bridge={bridge}
title={s.strings.fragment_wallets_delete_wallet}
title={lstrings.fragment_wallets_delete_wallet}
buttons={{
confirm: { label: s.strings.string_archive },
cancel: { label: s.strings.string_cancel_cap }
confirm: { label: lstrings.string_archive },
cancel: { label: lstrings.string_cancel_cap }
}}
>
<>
<ModalMessage>
{s.strings.fragmet_wallets_delete_wallet_first_confirm_message_mobile}
{lstrings.fragmet_wallets_delete_wallet_first_confirm_message_mobile}
<B>{getWalletName(currencyWallets[walletId])}?</B>
</ModalMessage>
{additionalMsg == null ? null : <ModalMessage>{additionalMsg}</ModalMessage>}
Expand Down
6 changes: 3 additions & 3 deletions src/actions/FioActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'
import { FioExpiredModal } from '../components/modals/FioExpiredModal'
import { Airship } from '../components/services/AirshipInstance'
import { FIO_WALLET_TYPE } from '../constants/WalletAndCurrencyConstants'
import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import {
addToFioAddressCache,
getExpiredSoonFioDomains,
Expand Down Expand Up @@ -85,8 +85,8 @@ export function checkFioObtData(walletId: string, transactions: EdgeTransaction[
if (obtForTx == null) return

if (edgeMetadata.notes == null) edgeMetadata.notes = ''
let fioNotes = `${s.strings.fragment_transaction_list_sent_prefix}${s.strings.word_to_in_convert_from_to_string} ${obtForTx.payee_fio_address}`
if (obtForTx.content.memo != null && obtForTx.content.memo !== '') fioNotes += `\n${s.strings.fio_sender_memo_label}: ${obtForTx.content.memo}`
let fioNotes = `${lstrings.fragment_transaction_list_sent_prefix}${lstrings.word_to_in_convert_from_to_string} ${obtForTx.payee_fio_address}`
if (obtForTx.content.memo != null && obtForTx.content.memo !== '') fioNotes += `\n${lstrings.fio_sender_memo_label}: ${obtForTx.content.memo}`
edgeMetadata.notes = `${fioNotes}\n${edgeMetadata.notes || ''}`
edgeMetadata.name = obtForTx.payer_fio_address

Expand Down
4 changes: 2 additions & 2 deletions src/actions/FioAddressActions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EdgeCurrencyWallet } from 'edge-core-js'

import { FIO_WALLET_TYPE } from '../constants/WalletAndCurrencyConstants'
import s from '../locales/strings'
import { lstrings } from '../locales/strings'
import { refreshConnectedWalletsForFioAddress, refreshFioNames } from '../modules/FioAddress/util'
import { ThunkAction } from '../types/reduxTypes'
import { createCurrencyWallet } from './CreateWalletActions'
Expand All @@ -10,7 +10,7 @@ export function createFioWallet(): ThunkAction<Promise<EdgeCurrencyWallet>> {
return async (dispatch, getState) => {
const state = getState()
const fiatCurrencyCode = state.ui.settings.defaultIsoFiat
return await dispatch(createCurrencyWallet(s.strings.fio_address_register_default_fio_wallet_name, FIO_WALLET_TYPE, fiatCurrencyCode))
return await dispatch(createCurrencyWallet(lstrings.fio_address_register_default_fio_wallet_name, FIO_WALLET_TYPE, fiatCurrencyCode))
}
}

Expand Down
Loading