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
4 changes: 4 additions & 0 deletions src/components/scenes/DefaultFiatSettingScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ export class DefaultFiatSettingComponent extends React.Component<Props, State> {

render() {
const filteredArray = this.props.supportedFiats.filter(entry => {
const key = `currency_label_${entry.value}`
const subTitle = lstrings[key as keyof typeof lstrings] ?? ''

Comment on lines +79 to +81
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually build a table for this type of thing, so like:

const fiatTitles = {
  USD: lstrings.currency_label_usd,
  EUR: lstrings.currency_label_eur,
  ...
}

That was we can't "escape" into the broader strings table, because we do the lookup on a safe subset.

Now, while I would prefer to see it done this way, I won't insist on it because we are really close to the merge and we want to get this in.

const lowerCaseText = this.state.searchTerm.toLowerCase()
return (
subTitle.toLowerCase().includes(lowerCaseText) ||
FIAT_COUNTRY[entry.value]?.countryName.toLowerCase().includes(lowerCaseText) ||
entry.label.toLowerCase().includes(lowerCaseText) ||
entry.value.toLowerCase().includes(lowerCaseText)
Expand Down
33 changes: 32 additions & 1 deletion src/components/scenes/WalletListScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { EdgeButton } from '../buttons/EdgeButton'
import { SceneButtons } from '../buttons/SceneButtons'
import { CrossFade } from '../common/CrossFade'
import { SceneWrapper } from '../common/SceneWrapper'
import { WalletListModal, WalletListResult } from '../modals/WalletListModal'
import { SortOption, WalletListSortModal } from '../modals/WalletListSortModal'
import { AccountSyncBar } from '../progress-indicators/AccountSyncBar'
import { Airship, showError } from '../services/AirshipInstance'
Expand Down Expand Up @@ -85,6 +86,33 @@ export function WalletListScene(props: Props) {
navigation.navigate('walletRestore')
})

const tokenSupportingWalletIds = React.useMemo(() => {
const walletIds: string[] = []
for (const wallet of Object.values(account.currencyWallets)) {
if (Object.keys(wallet.currencyConfig.builtinTokens).length > 0) {
walletIds.push(wallet.id)
}
}
return walletIds
}, [account])

const handlePressAddEditToken = useHandler(async () => {
const walletListResult = await Airship.show<WalletListResult>(bridge => (
<WalletListModal
bridge={bridge}
navigation={props.navigation as NavigationBase}
headerTitle={lstrings.choose_custom_token_wallet}
allowedWalletIds={tokenSupportingWalletIds}
/>
))
if (walletListResult?.type === 'wallet') {
const { walletId } = walletListResult
navigation.navigate('editToken', {
walletId
})
}
})

const handleFooterLayoutHeight = useHandler((height: number) => {
setFooterHeight(height)
})
Expand All @@ -98,8 +126,11 @@ export function WalletListScene(props: Props) {
}, [handleSort, navigation, isSearching, sorting])

const renderListFooter = React.useMemo(() => {
if (isSearching && tokenSupportingWalletIds.length > 0) {
return <SceneButtons secondary={{ label: lstrings.add_custom_token, onPress: handlePressAddEditToken }} />
}
return <SceneButtons secondary={{ label: lstrings.restore_wallets_modal_title, onPress: handlePressRestoreWallets }} />
}, [handlePressRestoreWallets])
}, [handlePressAddEditToken, handlePressRestoreWallets, tokenSupportingWalletIds, isSearching])

const renderFooter: FooterRender = React.useCallback(
sceneWrapperInfo => {
Expand Down
2 changes: 1 addition & 1 deletion src/constants/plugins/sellPluginList.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"US"
],
"notStateProvinces": {
"US": ["AK", "AR", "CT", "NC", "NY", "TX", "FL"]
"US": ["AK", "AR", "CT", "LA", "NC", "NY", "TX", "FL"]
},
"cryptoCodes": [],
"paymentTypeLogoKey": "bank"
Expand Down