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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- added: New Kado OTC provider integration.
- changed: Improved EdgeCrashEvent reporting with additional metadata, tags, and name/message information.
- changed: Integrate `installSurvey` endpoint for post-install survey options
- changed: Always show Add Wallet button at bottom of asset list

## 4.19.0

Expand Down
31 changes: 20 additions & 11 deletions src/components/scenes/WalletListScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function WalletListScene(props: Props) {
const sortOption = useSelector(state => state.ui.settings.walletsSort)

const account = useSelector(state => state.core.account)
const currencyWallets = useWatch(account, 'currencyWallets')
const allKeys = useWatch(account, 'allKeys')
const hasRestoreWallets = allKeys.filter(key => key.archived || key.deleted).length > 0

Expand Down Expand Up @@ -92,13 +93,13 @@ export function WalletListScene(props: Props) {

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

const handlePressAddEditToken = useHandler(async () => {
const walletListResult = await Airship.show<WalletListResult>(bridge => (
Expand Down Expand Up @@ -131,15 +132,23 @@ export function WalletListScene(props: Props) {

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

const renderFooter: FooterRender = React.useCallback(
sceneWrapperInfo => {
Expand Down Expand Up @@ -188,7 +197,7 @@ export function WalletListScene(props: Props) {
<WalletListSwipeable
key="fullList"
header={renderHeader}
footer={hasRestoreWallets ? renderListFooter : undefined}
footer={renderListFooter}
navigation={navigation}
insetStyle={insetStyle}
searching={isSearching}
Expand Down
Loading