diff --git a/.changeset/tame-rings-hide.md b/.changeset/tame-rings-hide.md new file mode 100644 index 000000000000..5efe47427112 --- /dev/null +++ b/.changeset/tame-rings-hide.md @@ -0,0 +1,5 @@ +--- +"live-mobile": patch +--- + +Add activation drawer from onboarding entry point diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/index.tsx b/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/index.tsx index 11baf8cc1de1..4333330d948b 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/index.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/index.tsx @@ -7,7 +7,11 @@ import { useTheme } from "styled-components/native"; import { TrackScreen } from "~/analytics"; import Drawer from "LLM/components/Dummy/Drawer"; -const Activation = () => { +type Props = T extends true + ? { isInsideDrawer: T; openSyncMethodDrawer: () => void } + : { isInsideDrawer?: T; openSyncMethodDrawer?: undefined }; + +const Activation: React.FC> = ({ isInsideDrawer, openSyncMethodDrawer }) => { const { colors } = useTheme(); const { t } = useTranslation(); @@ -18,7 +22,7 @@ const Activation = () => { }; const onPressHasAlreadyCreatedAKey = () => { - setIsDrawerOpen(true); + isInsideDrawer ? openSyncMethodDrawer() : setIsDrawerOpen(true); }; const onPressCloseDrawer = () => { @@ -48,7 +52,7 @@ const Activation = () => { onPressHasAlreadyCreatedAKey={onPressHasAlreadyCreatedAKey} onPressSyncAccounts={onPressSyncAccounts} /> - + {!isInsideDrawer && } ); }; diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/ActivationDrawer.tsx b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/ActivationDrawer.tsx new file mode 100644 index 000000000000..538907d6b93b --- /dev/null +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/ActivationDrawer.tsx @@ -0,0 +1,38 @@ +import React from "react"; +import QueuedDrawer from "LLM/components/QueuedDrawer"; +import Activation from "../../components/Activation"; +import Drawer from "LLM/components/Dummy/Drawer"; +import { TrackScreen } from "~/analytics"; + +type Props = { + isOpen: boolean; + reopenDrawer: () => void; + handleClose: () => void; +}; + +const ActivationDrawer = ({ isOpen, handleClose, reopenDrawer }: Props) => { + const [isSyncMethodDrawerOpen, setIsSyncMethodDrawerOpen] = React.useState(false); + + const onPressCloseDrawer = () => { + setIsSyncMethodDrawerOpen(false); + reopenDrawer(); + }; + + const openSyncMethodDrawer = () => { + setIsSyncMethodDrawerOpen(true); + handleClose(); + }; + + return ( + <> + + + + + + + + ); +}; + +export default ActivationDrawer; diff --git a/apps/ledger-live-mobile/src/screens/Onboarding/steps/accessExistingWallet.tsx b/apps/ledger-live-mobile/src/screens/Onboarding/steps/accessExistingWallet.tsx index 4d65281aeece..5137f58ebca7 100644 --- a/apps/ledger-live-mobile/src/screens/Onboarding/steps/accessExistingWallet.tsx +++ b/apps/ledger-live-mobile/src/screens/Onboarding/steps/accessExistingWallet.tsx @@ -13,8 +13,8 @@ import { OnboardingType } from "~/reducers/types"; import { SelectionCards } from "./Cards/SelectionCard"; import OnboardingView from "./OnboardingView"; import { useFeature } from "@ledgerhq/live-common/featureFlags/index"; -import Drawer from "LLM/components/Dummy/Drawer"; import { logDrawer } from "LLM/components/QueuedDrawer/utils/logDrawer"; +import ActivationDrawer from "LLM/features/WalletSync/screens/Activation/ActivationDrawer"; type NavigationProps = StackNavigatorProps< OnboardingNavigatorParamList & BaseNavigatorStackParamList, @@ -54,6 +54,11 @@ function AccessExistingWallet() { logDrawer("Wallet Sync Welcome back", "close"); }, []); + const reopenDrawer = useCallback(() => { + setIsDrawerVisible(true); + logDrawer("Wallet Sync Welcome back", "reopen"); + }, []); + return ( - + ); }