Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backups V2 Follow-up Fixes / Improvements #6213

Merged
merged 53 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c035b9f
remove useState that is getting wiped between renders
walmat Oct 18, 2024
ea2fd09
lots of provider structure changes
walmat Oct 19, 2024
3735f81
Merge branch 'develop' into @matthew/APP-1297
walmat Oct 25, 2024
4afed74
lots more progress on restructuring and code sharing
walmat Nov 6, 2024
fb913bc
more code quality improvements
walmat Nov 6, 2024
afc42bf
prevent App.tsx from re-rendering unless it needs to
walmat Nov 8, 2024
6946626
fix password not being pulled from local password keychain and add lo…
walmat Nov 8, 2024
9ea81dd
misc backups improvements
walmat Nov 8, 2024
fd16a13
Update .vscode/settings.json
walmat Nov 8, 2024
00d1bff
cleanup
walmat Nov 8, 2024
7016d47
Merge branch '@matthew/APP-1297' of https://github.com/rainbow-me/rai…
walmat Nov 8, 2024
5420054
fix lint
walmat Nov 11, 2024
c20670c
Merge branch 'develop' into @matthew/APP-1297
walmat Nov 14, 2024
5784cb2
fix overlay causing top leve re-renders
walmat Nov 14, 2024
0c81b5f
nav back to wallet screen on both new user restore / existing restore
walmat Nov 14, 2024
1fadaf5
convert cloud backup provider to zustand store, remove userData as it…
walmat Nov 16, 2024
a9948af
lots of cleanup
walmat Nov 18, 2024
5c5a848
add icon to indicate wrogn backup password
walmat Nov 18, 2024
6d7b6fa
simplify prompt to backup selected wallet
walmat Nov 18, 2024
9823919
more manual backup to cloud backup transitions
walmat Nov 18, 2024
7b18523
Update src/components/backup/RestoreCloudStep.tsx
walmat Nov 18, 2024
1f42ab9
reset backup provider to undefined if no condition is met
walmat Nov 18, 2024
466f3dc
adjust logic for displaying backed up status on Android when switchin…
walmat Nov 18, 2024
461ee79
more android tweaks
walmat Nov 18, 2024
053231c
more android fixes
walmat Nov 25, 2024
e1569fa
cleanup logs, prevent consolidatedTransactions when no address, and p…
walmat Nov 25, 2024
176cac6
prevent backups on wallets which are damaged
walmat Nov 25, 2024
11f079f
prevent portal overlay on pin authentication screen
walmat Nov 25, 2024
ebd631d
Merge branch 'develop' into @matthew/APP-1297
walmat Nov 25, 2024
25bb9c2
prevent copying address and more improvements to disabling backups if…
walmat Nov 25, 2024
664a035
i18n wallet loading states
walmat Nov 26, 2024
f550f68
fix lint
walmat Nov 26, 2024
3ccb2fb
fix lint
walmat Nov 26, 2024
e995093
Merge branch 'develop' into @matthew/APP-1297
walmat Nov 26, 2024
380103f
possibly fix the enable cloud backups on android
walmat Nov 27, 2024
d0fd2e3
fix button not being disabled and confetti (#6281)
walmat Nov 27, 2024
11fbc3c
[1297] - Prevent a few faceID prompts during restore / backup flow (#…
walmat Dec 3, 2024
109ca08
fix backup prompt seemingly being stuck (#6289)
walmat Dec 4, 2024
7dfd7e2
[1297] - Fix infinite sync (#6280)
walmat Dec 4, 2024
64d075b
fix: code review changes
walmat Dec 4, 2024
48c346a
prevent backup prompt from firing until backups status is synced
walmat Dec 4, 2024
515691b
replace inline flex with flatlist 3 column
walmat Dec 4, 2024
ee330be
fix non-visible wallets from appearing in backup section wallet addre…
walmat Dec 4, 2024
869a1fe
properly space items and calculate width based on device
walmat Dec 4, 2024
f9249f8
fix inconsistencies with keys
walmat Dec 4, 2024
308437a
fix lint
walmat Dec 6, 2024
7494991
add backup prompt to checks to avoid stacking sheets
walmat Dec 6, 2024
1b4e81f
add authentication in order to allow backup deletion
walmat Dec 6, 2024
1091d47
chore: merge
walmat Dec 11, 2024
fc5ee51
chore: merge
walmat Dec 19, 2024
6ccfad1
chore: merge
walmat Dec 19, 2024
1b149e9
fix botched merge
walmat Dec 20, 2024
ff305c6
remove unused imports
walmat Dec 20, 2024
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
32 changes: 21 additions & 11 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@/languages';
import * as Sentry from '@sentry/react-native';
import React, { useCallback, useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState, memo } from 'react';
import { AppRegistry, Dimensions, LogBox, StyleSheet, View } from 'react-native';
import { Toaster } from 'sonner-native';
import { MobileWalletProtocolProvider } from '@coinbase/mobile-wallet-protocol-host';
Expand All @@ -9,9 +9,8 @@ import { useApplicationSetup } from '@/hooks/useApplicationSetup';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
import { enableScreens } from 'react-native-screens';
import { connect, Provider as ReduxProvider } from 'react-redux';
import { connect, Provider as ReduxProvider, shallowEqual } from 'react-redux';
import { RecoilRoot } from 'recoil';
import PortalConsumer from '@/components/PortalConsumer';
import ErrorBoundary from '@/components/error-boundary/ErrorBoundary';
import { OfflineToast } from '@/components/toasts';
import { designSystemPlaygroundEnabled, reactNativeDisableYellowBox, showNetworkRequests, showNetworkResponses } from '@/config/debug';
Expand All @@ -24,7 +23,6 @@ import store, { AppDispatch, type AppState } from '@/redux/store';
import { MainThemeProvider } from '@/theme/ThemeContext';
import { SharedValuesProvider } from '@/helpers/SharedValuesContext';
import { InitialRouteContext } from '@/navigation/initialRoute';
import { Portal } from '@/react-native-cool-modals/Portal';
import { NotificationsHandler } from '@/notifications/NotificationsHandler';
import { analyticsV2 } from '@/analytics';
import { getOrCreateDeviceId } from '@/analytics/utils';
Expand All @@ -39,6 +37,7 @@ import { RootStackParamList } from '@/navigation/types';
import { IS_ANDROID, IS_DEV } from '@/env';
import { prefetchDefaultFavorites } from '@/resources/favorites';
import Routes from '@/navigation/Routes';
import { BackupsSync } from '@/state/sync/BackupsSync';
import { BackendNetworks } from '@/components/BackendNetworks';
import { AbsolutePortalRoot } from './components/AbsolutePortal';

Expand Down Expand Up @@ -68,28 +67,39 @@ function App({ walletReady }: AppProps) {
}, []);

return (
<Portal>
<>
<View style={[sx.container, { paddingBottom: IS_ANDROID ? bottom : 0 }]}>
{initialRoute && (
<InitialRouteContext.Provider value={initialRoute}>
<Routes ref={handleNavigatorRef} />
<PortalConsumer />
<AbsolutePortalRoot />
</InitialRouteContext.Provider>
)}
<OfflineToast />
<Toaster />
</View>
<NotificationsHandler walletReady={walletReady} />
<DeeplinkHandler initialRoute={initialRoute} walletReady={walletReady} />
<BackupsSync />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In charge of initial backup store sync on mount

<BackendNetworks />
</Portal>
<AbsolutePortalRoot />
</>
);
}

const AppWithRedux = connect<AppProps, AppDispatch, AppProps, AppState>(state => ({
walletReady: state.appState.walletReady,
}))(App);
const AppWithRedux = connect<AppProps, AppDispatch, AppProps, AppState>(
state => ({
walletReady: state.appState.walletReady,
}),
null,
null,
{
areStatesEqual: (next, prev) => {
// Only update if walletReady actually changed
return next.appState.walletReady === prev.appState.walletReady;
},
areOwnPropsEqual: shallowEqual,
}
)(memo(App));
Comment on lines +89 to +102
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we only really want to re-render the App when walletReady has changed.. this fixes that


function Root() {
const [initializing, setInitializing] = useState(true);
Expand Down
6 changes: 3 additions & 3 deletions src/components/AbsolutePortal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { PropsWithChildren, ReactNode, useEffect, useState } from 'react';
import { View } from 'react-native';
import { StyleProp, ViewStyle, View } from 'react-native';

const absolutePortal = {
nodes: [] as ReactNode[],
Expand All @@ -24,15 +24,15 @@ const absolutePortal = {
},
};

export const AbsolutePortalRoot = () => {
export const AbsolutePortalRoot = ({ style }: { style?: StyleProp<ViewStyle> }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

are you using this component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

const [nodes, setNodes] = useState(absolutePortal.nodes);

useEffect(() => {
const unsubscribe = absolutePortal.subscribe(setNodes);
return () => unsubscribe();
}, []);

return <View style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, pointerEvents: 'box-none' }}>{nodes}</View>;
return <View style={[style, { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, pointerEvents: 'box-none' }]}>{nodes}</View>;
};

export const AbsolutePortal = ({ children }: PropsWithChildren) => {
Expand Down
5 changes: 1 addition & 4 deletions src/components/ExchangeTokenRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import isEqual from 'react-fast-compare';
import { Box, Column, Columns, Inline, Stack, Text } from '@/design-system';
import { isNativeAsset } from '@/handlers/assets';
import { useAsset, useDimensions } from '@/hooks';
import { useAsset } from '@/hooks';
import { ButtonPressAnimation } from '@/components/animations';
import { FloatingEmojis } from '@/components/floating-emojis';
import { IS_IOS } from '@/env';
Expand Down Expand Up @@ -34,7 +34,6 @@ export default React.memo(function ExchangeTokenRow({
disabled,
},
}: ExchangeTokenRowProps) {
const { width: deviceWidth } = useDimensions();
const item = useAsset({
address,
chainId,
Expand Down Expand Up @@ -101,10 +100,8 @@ export default React.memo(function ExchangeTokenRow({
{isInfoButtonVisible && <Info contextMenuProps={contextMenuProps} showFavoriteButton={showFavoriteButton} theme={theme} />}
{showFavoriteButton &&
(IS_IOS ? (
// @ts-ignore
<FloatingEmojis
centerVertically
deviceWidth={deviceWidth}
disableHorizontalMovement
disableVerticalMovement
distance={70}
Expand Down
18 changes: 0 additions & 18 deletions src/components/PortalConsumer.js

This file was deleted.

17 changes: 17 additions & 0 deletions src/components/WalletLoadingListener.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { useEffect } from 'react';
import { LoadingOverlay } from './modal';
import { sheetVerticalOffset } from '@/navigation/effects';
import { walletLoadingStore } from '@/state/walletLoading/walletLoading';

export default function WalletLoadingListener() {
const loadingState = walletLoadingStore(state => state.loadingState);

useEffect(() => {
if (loadingState) {
walletLoadingStore.getState().setComponent(<LoadingOverlay paddingTop={sheetVerticalOffset} title={loadingState} />);
}
return walletLoadingStore.getState().hide;
}, [loadingState]);

return null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,8 @@ export default React.memo(function FastCurrencySelectionRow({
{showFavoriteButton &&
chainId === ChainId.mainnet &&
(ios ? (
// @ts-ignore
<FloatingEmojis
centerVertically
deviceWidth={deviceWidth}
disableHorizontalMovement
disableVerticalMovement
distance={70}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function ProfileActionButtonsRow() {
</Column>
<Column>
<Animated.View style={[expandStyle]}>
<MoreButton />
<CopyButton />
</Animated.View>
</Column>
</Columns>
Expand Down Expand Up @@ -216,21 +216,25 @@ function SendButton() {
);
}

export function MoreButton() {
// ////////////////////////////////////////////////////
// Handlers

export function CopyButton() {
const [isToastActive, setToastActive] = useRecoilState(addressCopiedToastAtom);
const { accountAddress } = useAccountProfile();
const { isDamaged } = useWallets();

const handlePressCopy = React.useCallback(() => {
if (isDamaged) {
showWalletErrorAlert();
return;
}

if (!isToastActive) {
setToastActive(true);
setTimeout(() => {
setToastActive(false);
}, 2000);
}
Clipboard.setString(accountAddress);
}, [accountAddress, isToastActive, setToastActive]);
}, [accountAddress, isDamaged, isToastActive, setToastActive]);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export function ProfileNameRow({
scaleTo={0}
size={50}
wiggleFactor={0}
// @ts-expect-error – JS component
setOnNewEmoji={newOnNewEmoji => (onNewEmoji.current = newOnNewEmoji)}
/>
</Box>
Expand Down
123 changes: 0 additions & 123 deletions src/components/backup/AddWalletToCloudBackupStep.tsx

This file was deleted.

Loading
Loading