Skip to content

Commit

Permalink
Add names to wallet list info in backups v2 (#5692)
Browse files Browse the repository at this point in the history
* add names to wallet info in backups v2

* cleanup

* more cleanup
  • Loading branch information
walmat committed May 7, 2024
1 parent af27740 commit d4cc1df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
import { RouteProp, useRoute } from '@react-navigation/native';
import ContextMenuButton from '@/components/native-context-menu/contextMenu';
import { ContextCircleButton } from '@/components/context-menu';
Expand Down Expand Up @@ -272,7 +273,7 @@ const ViewWalletBackup = () => {
// If we found it and it's not damaged use it to create the new account
if (wallet && !wallet.damaged) {
const newWallets = await dispatch(createAccountForWallet(wallet.id, color, name));
// @ts-ignore
// @ts-expect-error - no params
await initializeWallet();
// If this wallet was previously backed up to the cloud
// We need to update userData backup so it can be restored too
Expand All @@ -296,7 +297,7 @@ const ViewWalletBackup = () => {
clearCallbackOnStartCreation: true,
});
await dispatch(walletsLoadState(profilesEnabled));
// @ts-ignore
// @ts-expect-error - no params
await initializeWallet();
}
} catch (e) {
Expand Down Expand Up @@ -538,12 +539,14 @@ const ViewWalletBackup = () => {
disabled
leftComponent={<WalletAvatar account={account} />}
labelComponent={
account.label.endsWith('.eth') ? <MenuItem.Label text={abbreviations.address(account.address, 3, 5) || ''} /> : null
account.label.endsWith('.eth') || account.label !== '' ? (
<MenuItem.Label text={abbreviations.address(account.address, 3, 5) || ''} />
) : null
}
titleComponent={
<MenuItem.Title
text={
account.label.endsWith('.eth')
account.label.endsWith('.eth') || account.label !== ''
? abbreviations.abbreviateEnsForDisplay(removeFirstEmojiFromString(account.label), 20) ?? ''
: abbreviations.address(account.address, 3, 5) ?? ''
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
import React, { useCallback, useMemo } from 'react';
import { cloudPlatform } from '@/utils/platform';
import Menu from '../Menu';
Expand Down Expand Up @@ -74,7 +75,7 @@ const WalletPill = ({ account }: WalletPillProps) => {
<Text color={'secondary (Deprecated)'} size="11pt" weight="semibold">
{label.endsWith('.eth')
? abbreviations.abbreviateEnsForDisplay(label, 8, 4) ?? ''
: abbreviations.address(account.address, 3, 5) ?? ''}
: abbreviations.address(label !== '' ? label : account.address, 3, 5) ?? ''}
</Text>
</Box>
);
Expand Down Expand Up @@ -222,7 +223,7 @@ export const WalletsAndBackup = () => {

await dispatch(walletsLoadState(profilesEnabled));

// @ts-ignore
// @ts-expect-error - no params
await initializeWallet();
} catch (err) {
logger.error(new RainbowError('Failed to create new secret phrase'), {
Expand Down Expand Up @@ -661,12 +662,13 @@ export const WalletsAndBackup = () => {
backupAllNonBackedUpWalletsTocloud,
sortedWallets,
onCreateNewSecretPhrase,
onViewCloudBackups,
manageCloudBackups,
navigate,
onNavigateToWalletView,
allBackedUp,
mostRecentBackup,
lastBackupDate,
onViewCloudBackups,
manageCloudBackups,
onPressLearnMoreAboutCloudBackups,
]);

Expand Down

0 comments on commit d4cc1df

Please sign in to comment.