Skip to content

Commit

Permalink
cleanup unused stuff and progress on backups flow
Browse files Browse the repository at this point in the history
  • Loading branch information
walmat committed Jan 22, 2024
1 parent 3bd0dab commit 948af92
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 95 deletions.
3 changes: 3 additions & 0 deletions src/design-system/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type TextProps = {
testID?: string;
uppercase?: boolean;
weight?: TextWeight;
onPress?: () => void;
} & (
| {
containsEmoji: true;
Expand All @@ -53,6 +54,7 @@ export const Text = forwardRef<ElementRef<typeof NativeText>, TextProps>(
testID,
uppercase,
weight,
onPress,
style,
},
ref
Expand Down Expand Up @@ -94,6 +96,7 @@ export const Text = forwardRef<ElementRef<typeof NativeText>, TextProps>(
ref={ref}
style={[textStyle, style || {}]}
testID={testID}
onPress={onPress}
>
{ios && containsEmojiProp && nodeIsString(children)
? renderStringWithEmoji(children)
Expand Down
3 changes: 2 additions & 1 deletion src/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,8 @@
"cloud_backup_title": "Cloud Backup",
"not_backed_up": "Not backed up",
"not_backed_up_message": "This %{backupType} isn't backed up. Back up now so you can restore it if you lose your device or get a new one.",
"cloud_backup_description": "Securely back up your wallets to iCloud so you can restore them if you lose your device or get a new one. Learn more…",
"cloud_backup_description": "Securely back up your wallets to iCloud so you can restore them if you lose your device or get a new one.",
"cloud_backup_link": "Learn more…",
"view_private_key": "View private key",
"copy_wallet_address": "Copy wallet address"
},
Expand Down
2 changes: 0 additions & 2 deletions src/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { migrateNotificationSettingsToV2 } from '@/migrations/migrations/migrate
import { prepareDefaultNotificationGroupSettingsState } from '@/migrations/migrations/prepareDefaultNotificationGroupSettingsState';
import { changeLanguageKeys } from './migrations/changeLanguageKeys';
import { fixHiddenUSDC } from './migrations/fixHiddenUSDC';
import { setInitialBackupMethod } from './migrations/setInitialBackupMethod';

/**
* Local storage for migrations only. Should not be exported.
Expand All @@ -37,7 +36,6 @@ const migrations: Migration[] = [
migrateNotificationSettingsToV2(),
changeLanguageKeys(),
fixHiddenUSDC(),
setInitialBackupMethod(),
];

/**
Expand Down
54 changes: 0 additions & 54 deletions src/migrations/migrations/setInitialBackupMethod.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ export default function BackupSheet() {
);
case WalletBackupStepTypes.imported:
return (
// TODO: ADD CloudPlatform to back_up.description
<BackupSheetSection
descriptionText={lang.t('modal.back_up.imported.description', {
cloudPlatformName: cloudPlatform,
})}
onPrimaryAction={onIcloudBackup}
onSecondaryAction={goBack}
primaryButtonTestId="backup-sheet-imported-back-up-button"
primaryLabel={`􀙶 ${lang.t('modal.back_up.imported.button.back_up', {
cloudPlatformName: cloudPlatform,
})}`}
Expand Down
17 changes: 14 additions & 3 deletions src/screens/SettingsSheet/components/Backups/ViewWalletBackup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import WalletTypes from '@/helpers/walletTypes';
import { useRecoilState } from 'recoil';
import { addressCopiedToastAtom } from '@/recoil/addressCopiedToastAtom';
import Routes from '@/navigation/routesNames';
import { navigate } from '@/navigation/Navigation';
import { navigate, useNavigation } from '@/navigation/Navigation';
import walletBackupStepTypes from '@/helpers/walletBackupStepTypes';

type ViewWalletBackupParams = {
ViewWalletBackup: { walletId: string };
Expand All @@ -46,12 +47,22 @@ const ViewWalletBackup = () => {
const { wallets } = useWallets();
const wallet = wallets?.[walletId];

const { navigate } = useNavigation();

const { manageCloudBackups } = useManageCloudBackups();

const [isToastActive, setToastActive] = useRecoilState(
addressCopiedToastAtom
);

const enableCloudBackups = useCallback(() => {}, []);

const onManualBackup = useCallback(() => {
navigate(Routes.SETTINGS_WARN_SECRET_VIEW, {
walletId,
});
}, [navigate]);

const onCreateNewWallet = useCallback(() => {}, []);

const handleCopyAddress = React.useCallback(
Expand Down Expand Up @@ -140,7 +151,7 @@ const ViewWalletBackup = () => {
<MenuItem
hasSfSymbol
leftComponent={<MenuItem.TextIcon icon="􀊯" isLink />}
onPress={manageCloudBackups}
onPress={enableCloudBackups}
size={52}
titleComponent={
<MenuItem.Title
Expand All @@ -152,7 +163,7 @@ const ViewWalletBackup = () => {
<MenuItem
hasSfSymbol
leftComponent={<MenuItem.TextIcon icon="􀈊" isLink />}
onPress={manageCloudBackups}
onPress={onManualBackup}
size={52}
titleComponent={
<MenuItem.Title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ContactAvatar } from '@/components/contacts';
import { useTheme } from '@/theme';
import Routes from '@/navigation/routesNames';
import WalletBackupStepTypes from '@/helpers/walletBackupStepTypes';
import { backupsCard } from '@/components/cards/utils/constants';

const WalletsAndBackup = () => {
const { colors, isDarkMode } = useTheme();
Expand All @@ -33,7 +34,12 @@ const WalletsAndBackup = () => {
});
}, [navigate]);

const onBackupToCloud = useCallback(() => {}, []);
const onBackupToCloud = useCallback(() => {
navigate(Routes.BACKUP_SHEET, {
nativeScreen: true,
step: WalletBackupStepTypes.cloud,
});
}, [navigate]);

const onCreateNewSecretPhrase = useCallback(() => {}, []);

Expand Down Expand Up @@ -148,6 +154,13 @@ const WalletsAndBackup = () => {
text={lang.t('wallet.back_ups.cloud_backup_description', {
link: lang.t('wallet.back_ups.cloud_backup_link'),
})}
linkText={lang.t('wallet.back_ups.cloud_backup_link')}
onPress={() =>
navigate(Routes.LEARN_WEB_VIEW_SCREEN, {
...backupsCard,
type: 'square',
})
}
/>
}
/>
Expand Down
22 changes: 17 additions & 5 deletions src/screens/SettingsSheet/components/MenuHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import { Source } from 'react-native-fast-image';
import { Box, Space, Stack, Text } from '@/design-system';
import { Box, Inline, Space, Stack, Text } from '@/design-system';
import { ImgixImage } from '@/components/images';
import { useTheme } from '@/theme';
import { ImageSourcePropType } from 'react-native';
import { ButtonPressAnimation } from '@/components/animations';

interface ImageIconProps {
size?: number;
Expand Down Expand Up @@ -156,19 +157,30 @@ const Title = ({ text, weight = 'semibold' }: TitleProps) => (

interface LabelProps {
text: string;
warn?: boolean;
linkText?: string;
onPress?: () => void;
}

const Label = ({ text, warn }: LabelProps) => {
const { colors } = useTheme();
const Label = ({ text, linkText, onPress }: LabelProps) => {
return (
<Text
color={warn ? { custom: colors.orangeLight } : 'secondary60 (Deprecated)'}
color={'secondary60 (Deprecated)'}
size="14px / 19px (Deprecated)"
align="center"
weight="medium"
>
{text}
{linkText && onPress && (
<Text
onPress={onPress}
color="blue"
size="14px / 19px (Deprecated)"
weight="medium"
>
{' '}
{linkText}
</Text>
)}
</Text>
);
};
Expand Down
11 changes: 1 addition & 10 deletions src/storage/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import { MMKV } from 'react-native-mmkv';

import {
Account,
BackupsSettings,
Cards,
Campaigns,
Device,
Review,
} from '@/storage/schema';
import { Account, Cards, Campaigns, Device, Review } from '@/storage/schema';
import { EthereumAddress } from '@/entities';
import { Network } from '@/networks/types';

Expand Down Expand Up @@ -88,6 +81,4 @@ export const review = new Storage<[], Review>({ id: 'review' });

export const campaigns = new Storage<[], Campaigns>({ id: 'campaigns' });

export const backups = new Storage<[], BackupsSettings>({ id: 'backups' });

export const cards = new Storage<[], Cards>({ id: 'cards' });
18 changes: 0 additions & 18 deletions src/storage/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,6 @@ type CampaignMetadata = {

export type Campaigns = CampaignKeys & CampaignMetadata;

export const enum BackupProvider {
NoProvider = 'NoProvider',
CloudProvider = 'CloudProvider',
ManualProvider = 'ManualProvider',
}

export const enum BackupStatus {
NoBackup = 'NoBackup',
UpToDate = 'UpToDate',
OutOfDate = 'OutOfDate',
}

export type BackupsSettings = {
lastBackupTimestamp: string;
provider: BackupProvider;
status: BackupStatus;
};

export type Cards = {
[cardKey: string]: boolean;
};

0 comments on commit 948af92

Please sign in to comment.