diff --git a/.changeset/strange-shrimps-clean.md b/.changeset/strange-shrimps-clean.md new file mode 100644 index 000000000000..673b5f34c85e --- /dev/null +++ b/.changeset/strange-shrimps-clean.md @@ -0,0 +1,5 @@ +--- +"live-mobile": minor +--- + +LLM - Ledger Sync redirects to Qr code when syncing again after a successful sync diff --git a/apps/ledger-live-mobile/src/actions/types.ts b/apps/ledger-live-mobile/src/actions/types.ts index bc1686033660..a4e20fdd3dd9 100644 --- a/apps/ledger-live-mobile/src/actions/types.ts +++ b/apps/ledger-live-mobile/src/actions/types.ts @@ -36,6 +36,7 @@ import type { import type { Unpacked } from "../types/helpers"; import { HandlersPayloads } from "@ledgerhq/live-wallet/store"; import { ImportAccountsReduceInput } from "@ledgerhq/live-wallet/liveqr/importAccounts"; +import { Steps } from "LLM/features/WalletSync/types/Activation"; // === ACCOUNTS ACTIONS === @@ -530,11 +531,16 @@ export type MarketPayload = export enum WalletSyncActionTypes { WALLET_SYNC_SET_MANAGE_KEY_DRAWER = "WALLET_SYNC_SET_MANAGE_KEY_DRAWER", LEDGER_SYNC_SET_ACTIVATE_DRAWER = "LEDGER_SYNC_SET_ACTIVATE_DRAWER", + LEDGER_SYNC_SET_ACTIVATE_STEP = "LEDGER_SYNC_SET_ACTIVATE_STEP", } export type WalletSyncSetManageKeyDrawerPayload = boolean; export type WalletSyncSetActivateDrawer = boolean; -export type WalletSyncPayload = WalletSyncSetManageKeyDrawerPayload | WalletSyncSetActivateDrawer; +export type WalletSyncSetActivateStep = Steps; +export type WalletSyncPayload = + | WalletSyncSetManageKeyDrawerPayload + | WalletSyncSetActivateDrawer + | WalletSyncSetActivateStep; // === PAYLOADS === diff --git a/apps/ledger-live-mobile/src/actions/walletSync.ts b/apps/ledger-live-mobile/src/actions/walletSync.ts index 49563fdbcc15..70943a527383 100644 --- a/apps/ledger-live-mobile/src/actions/walletSync.ts +++ b/apps/ledger-live-mobile/src/actions/walletSync.ts @@ -1,6 +1,10 @@ import { createAction } from "redux-actions"; import { WalletSyncActionTypes } from "./types"; -import type { WalletSyncSetActivateDrawer, WalletSyncSetManageKeyDrawerPayload } from "./types"; +import type { + WalletSyncSetActivateDrawer, + WalletSyncSetActivateStep, + WalletSyncSetManageKeyDrawerPayload, +} from "./types"; export const setWallectSyncManageKeyDrawer = createAction( WalletSyncActionTypes.WALLET_SYNC_SET_MANAGE_KEY_DRAWER, @@ -9,3 +13,7 @@ export const setWallectSyncManageKeyDrawer = createAction( WalletSyncActionTypes.LEDGER_SYNC_SET_ACTIVATE_DRAWER, ); + +export const setLedgerSyncActivateStep = createAction( + WalletSyncActionTypes.LEDGER_SYNC_SET_ACTIVATE_STEP, +); diff --git a/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/components/StepFlow.tsx b/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/components/StepFlow.tsx index d0e6b600d21d..3b6aa7cc300b 100644 --- a/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/components/StepFlow.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/components/StepFlow.tsx @@ -11,14 +11,13 @@ import PinCodeDisplay from "LLM/features/WalletSync/screens/Synchronize/PinCodeD import PinCodeInput from "LLM/features/WalletSync/screens/Synchronize/PinCodeInput"; import { useInitMemberCredentials } from "LLM/features/WalletSync/hooks/useInitMemberCredentials"; import { useSyncWithQrCode } from "LLM/features/WalletSync/hooks/useSyncWithQrCode"; -import { SpecificError } from "~/newArch/features/WalletSync/components/Error/SpecificError"; -import { ErrorReason } from "~/newArch/features/WalletSync/hooks/useSpecificError"; +import { SpecificError } from "LLM/features/WalletSync/components/Error/SpecificError"; +import { ErrorReason } from "LLM/features/WalletSync/hooks/useSpecificError"; +import { useCurrentStep } from "LLM/features/WalletSync/hooks/useCurrentStep"; type Props = { - currentStep: Steps; currency?: CryptoCurrency | TokenCurrency | null; doesNotHaveAccount?: boolean; - setCurrentStep: (step: Steps) => void; setCurrentOption: (option: Options) => void; currentOption: Options; navigateToChooseSyncMethod: () => void; @@ -36,23 +35,22 @@ type Props = { const StepFlow = ({ doesNotHaveAccount, currency, - currentStep, setCurrentOption, currentOption, navigateToChooseSyncMethod, navigateToQrCodeMethod, onQrCodeScanned, qrProcess, - setCurrentStep, onCreateKey, }: Props) => { + const { currentStep, setCurrentStep } = useCurrentStep(); const { memberCredentials } = useInitMemberCredentials(); const { handleStart, handleSendDigits, inputCallback, nbDigits } = useSyncWithQrCode(); const handleQrCodeScanned = (data: string) => { onQrCodeScanned(); - if (memberCredentials) handleStart(data, memberCredentials, setCurrentStep); + if (memberCredentials) handleStart(data, memberCredentials); }; const handlePinCodeSubmit = (input: string) => { diff --git a/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/index.tsx b/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/index.tsx index 6e282ba63400..eec0ef8475a4 100644 --- a/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/index.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/Accounts/screens/AddAccount/index.tsx @@ -6,6 +6,7 @@ import DrawerHeader from "LLM/features/WalletSync/components/Synchronize/DrawerH import { Flex } from "@ledgerhq/native-ui"; import StepFlow from "./components/StepFlow"; import { Steps } from "LLM/features/WalletSync/types/Activation"; +import { useCurrentStep } from "LLM/features/WalletSync/hooks/useCurrentStep"; type ViewProps = ReturnType & AddAccountProps; @@ -21,10 +22,8 @@ function View({ doesNotHaveAccount, currency, onCloseAddAccountDrawer, - currentStep, onGoBack, currentOption, - setCurrentStep, setCurrentOption, navigateToChooseSyncMethod, navigateToQrCodeMethod, @@ -32,6 +31,7 @@ function View({ onQrCodeScanned, onCreateKey, }: ViewProps) { + const { currentStep } = useCurrentStep(); const CustomDrawerHeader = () => ; return ( @@ -46,8 +46,6 @@ function View({ { - const [currentStep, setCurrentStep] = useState(startingStep); + const { currentStep, setCurrentStep } = useCurrentStep(); const [currentOption, setCurrentOption] = useState(Options.SCAN); const navigateToChooseSyncMethod = () => setCurrentStep(Steps.ChooseSyncMethod); const navigateToQrCodeMethod = () => setCurrentStep(Steps.QrCodeMethod); const navigation = useNavigation(); - const onGoBack = () => setCurrentStep(prevStep => getPreviousStep(prevStep)); + const onGoBack = () => setCurrentStep(getPreviousStep(currentStep)); + + useEffect(() => { + setCurrentStep(startingStep); + }, [setCurrentStep]); const reset = () => { setCurrentStep(startingStep); @@ -49,15 +54,13 @@ const useAddAccountViewModel = ({ isOpened, onClose }: AddAccountDrawerProps) => }); }, []); - const onCloseAddAccountDrawer = useCallback(() => { + const onCloseAddAccountDrawer = () => { trackButtonClick("Close 'x'"); onClose(); reset(); - }, [trackButtonClick, onClose]); + }; const { url, error, isLoading, pinCode } = useQRCodeHost({ - setCurrentStep, - currentStep, currentOption, }); @@ -74,10 +77,8 @@ const useAddAccountViewModel = ({ isOpened, onClose }: AddAccountDrawerProps) => onCloseAddAccountDrawer, navigateToQrCodeMethod, navigateToChooseSyncMethod, - currentStep, setCurrentOption, currentOption, - setCurrentStep, onQrCodeScanned, onGoBack, qrProcess: { diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/synchronizeWithQrCode.integration.test.tsx b/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/synchronizeWithQrCode.integration.test.tsx index 499c64c42212..c2eb0e0fe71d 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/synchronizeWithQrCode.integration.test.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/synchronizeWithQrCode.integration.test.tsx @@ -6,8 +6,6 @@ import getWalletSyncEnvironmentParams from "@ledgerhq/live-common/walletSync/get jest.mock("../hooks/useQRCodeHost", () => ({ useQRCodeHost: () => ({ - setCurrentStep: jest.fn(), - currentStep: jest.fn(), currentOption: jest.fn(), url: "ledger.com", }), diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/ActivationFlow.tsx b/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/ActivationFlow.tsx index f45c01ec6e11..e20286db7b2b 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/ActivationFlow.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/components/Activation/ActivationFlow.tsx @@ -12,9 +12,9 @@ import { useInitMemberCredentials } from "../../hooks/useInitMemberCredentials"; import { useSyncWithQrCode } from "../../hooks/useSyncWithQrCode"; import { SpecificError } from "../Error/SpecificError"; import { ErrorReason } from "../../hooks/useSpecificError"; +import { useCurrentStep } from "../../hooks/useCurrentStep"; type Props = { - currentStep: Steps; navigateToChooseSyncMethod: () => void; navigateToQrCodeMethod: () => void; qrProcess: { @@ -26,28 +26,26 @@ type Props = { onQrCodeScanned: () => void; currentOption: Options; setOption: (option: Options) => void; - setCurrentStep: (step: Steps) => void; onCreateKey: () => void; }; const ActivationFlow = ({ - currentStep, navigateToChooseSyncMethod, navigateToQrCodeMethod, qrProcess, currentOption, setOption, onQrCodeScanned, - setCurrentStep, onCreateKey, }: Props) => { + const { currentStep, setCurrentStep } = useCurrentStep(); const { memberCredentials } = useInitMemberCredentials(); const { handleStart, handleSendDigits, inputCallback, nbDigits } = useSyncWithQrCode(); const handleQrCodeScanned = (data: string) => { onQrCodeScanned(); - if (memberCredentials) handleStart(data, memberCredentials, setCurrentStep); + if (memberCredentials) handleStart(data, memberCredentials); }; const handlePinCodeSubmit = (input: string) => { diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useCurrentStep.ts b/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useCurrentStep.ts new file mode 100644 index 000000000000..f06b9bd28015 --- /dev/null +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useCurrentStep.ts @@ -0,0 +1,21 @@ +import { useDispatch, useSelector } from "react-redux"; +import { activateDrawerStepSelector } from "~/reducers/walletSync"; +import { Steps } from "../types/Activation"; +import { setLedgerSyncActivateStep } from "~/actions/walletSync"; +import { useCallback } from "react"; + +export function useCurrentStep() { + const dispatch = useDispatch(); + const currentStep = useSelector(activateDrawerStepSelector); + const setCurrentStep = useCallback( + (step: Steps) => { + dispatch(setLedgerSyncActivateStep(step)); + }, + [dispatch], + ); + + return { + currentStep, + setCurrentStep, + }; +} diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useQRCodeHost.ts b/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useQRCodeHost.ts index 64475771ac4b..5f0cff1a9f9e 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useQRCodeHost.ts +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useQRCodeHost.ts @@ -21,16 +21,16 @@ import getWalletSyncEnvironmentParams from "@ledgerhq/live-common/walletSync/get import { useMutation, useQueryClient } from "@tanstack/react-query"; import { QueryKey } from "./type.hooks"; import { useInstanceName } from "./useInstanceName"; +import { useCurrentStep } from "./useCurrentStep"; const MIN_TIME_TO_REFRESH = 30_000; interface Props { - setCurrentStep: (step: Steps) => void; - currentStep: Steps; currentOption: Options; } -export function useQRCodeHost({ setCurrentStep, currentStep, currentOption }: Props) { +export function useQRCodeHost({ currentOption }: Props) { + const { currentStep, setCurrentStep } = useCurrentStep(); const queryClient = useQueryClient(); const trustchain = useSelector(trustchainSelector); const memberCredentials = useSelector(memberCredentialsSelector); diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useSyncWithQrCode.ts b/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useSyncWithQrCode.ts index b116cb0e6cda..08ed51acac13 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useSyncWithQrCode.ts +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/hooks/useSyncWithQrCode.ts @@ -14,8 +14,10 @@ import { Steps } from "../types/Activation"; import { NavigatorName, ScreenName } from "~/const"; import { useInstanceName } from "./useInstanceName"; import { useTrustchainSdk } from "./useTrustchainSdk"; +import { useCurrentStep } from "./useCurrentStep"; export const useSyncWithQrCode = () => { + const { setCurrentStep } = useCurrentStep(); const [nbDigits, setDigits] = useState(null); const [input, setInput] = useState(null); const instanceName = useInstanceName(); @@ -48,11 +50,7 @@ export const useSyncWithQrCode = () => { }, [navigation]); const handleStart = useCallback( - async ( - url: string, - memberCredentials: MemberCredentials, - setCurrentStep: (step: Steps) => void, - ) => { + async (url: string, memberCredentials: MemberCredentials) => { try { const newTrustchain = await createQRCodeCandidateInstance({ memberCredentials, @@ -94,7 +92,7 @@ export const useSyncWithQrCode = () => { throw e; } }, - [instanceName, onRequestQRCodeInput, trustchain, dispatch, onSyncFinished, sdk], + [instanceName, onRequestQRCodeInput, trustchain, onSyncFinished, sdk, dispatch, setCurrentStep], ); const handleSendDigits = useCallback( 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 index 91f405e4b8a4..4eb884cfe76f 100644 --- 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 @@ -17,7 +17,6 @@ type Props = { function View({ isOpen, - currentStep, hasCustomHeader, canGoBack, navigateToChooseSyncMethod, @@ -30,7 +29,6 @@ function View({ qrProcess, currentOption, setCurrentOption, - setCurrentStep, }: ViewProps) { const CustomDrawerHeader = () => ; @@ -46,14 +44,12 @@ function View({ > diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/ActivationSuccess.tsx b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/ActivationSuccess.tsx index b96142165867..44d8c3f684f9 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/ActivationSuccess.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/ActivationSuccess.tsx @@ -17,6 +17,9 @@ import { BaseNavigatorStackParamList } from "~/components/RootNavigator/types/Ba import { setFromLedgerSyncOnboarding } from "~/actions/settings"; import { AnalyticsButton, AnalyticsFlow, AnalyticsPage } from "../../hooks/useLedgerSyncAnalytics"; import { track } from "~/analytics"; +import { setLedgerSyncActivateDrawer } from "~/actions/walletSync"; +import { Steps } from "../../types/Activation"; +import { useCurrentStep } from "../../hooks/useCurrentStep"; type Props = BaseComposite< StackNavigatorProps @@ -30,6 +33,7 @@ export function ActivationSuccess({ navigation, route }: Props) { const desc = created ? "walletSync.success.activationDesc" : "walletSync.success.syncDesc"; const page = created ? AnalyticsPage.BackupCreationSuccess : AnalyticsPage.SyncSuccess; const dispatch = useDispatch(); + const { setCurrentStep } = useCurrentStep(); const navigationOnbarding = useNavigation>>(); @@ -40,7 +44,14 @@ export function ActivationSuccess({ navigation, route }: Props) { page, flow: AnalyticsFlow.LedgerSync, }); - navigation.navigate(ScreenName.WalletSyncActivationProcess); + if (isFromLedgerSyncOnboarding) { + dispatch(setFromLedgerSyncOnboarding(false)); + } + setCurrentStep(Steps.QrCodeMethod); + navigation.navigate(NavigatorName.Settings, { + screen: ScreenName.GeneralSettings, + }); + dispatch(setLedgerSyncActivateDrawer(true)); } function close(): void { diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/useActivationDrawerModel.ts b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/useActivationDrawerModel.ts index 635a6cdcb374..4ae33187ffd4 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/useActivationDrawerModel.ts +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/Activation/useActivationDrawerModel.ts @@ -1,4 +1,4 @@ -import { useCallback, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo, useState } from "react"; import { Steps } from "../../types/Activation"; import { AnalyticsButton, @@ -11,6 +11,7 @@ import { NavigatorName, ScreenName } from "~/const"; import { useNavigation } from "@react-navigation/native"; import { BaseComposite, StackNavigatorProps } from "~/components/RootNavigator/types/helpers"; import { WalletSyncNavigatorStackParamList } from "~/components/RootNavigator/types/WalletSyncNavigator"; +import { useCurrentStep } from "../../hooks/useCurrentStep"; type Props = { isOpen: boolean; @@ -24,7 +25,11 @@ type NavigationProps = BaseComposite< const useActivationDrawerModel = ({ isOpen, startingStep, handleClose }: Props) => { const { onClickTrack } = useLedgerSyncAnalytics(); - const [currentStep, setCurrentStep] = useState(startingStep); + const { currentStep, setCurrentStep } = useCurrentStep(); + + useEffect(() => { + setCurrentStep(startingStep); + }, [startingStep, setCurrentStep]); const [currentOption, setCurrentOption] = useState(Options.SCAN); const navigation = useNavigation(); const hasCustomHeader = useMemo(() => currentStep === Steps.QrCodeMethod, [currentStep]); @@ -76,14 +81,11 @@ const useActivationDrawerModel = ({ isOpen, startingStep, handleClose }: Props) }; const { url, error, isLoading, pinCode } = useQRCodeHost({ - setCurrentStep, - currentStep, currentOption, }); return { isOpen, - currentStep, hasCustomHeader, canGoBack, navigateToChooseSyncMethod, @@ -95,7 +97,6 @@ const useActivationDrawerModel = ({ isOpen, startingStep, handleClose }: Props) qrProcess: { url, error, isLoading, pinCode }, currentOption, setCurrentOption, - setCurrentStep, onCreateKey, }; }; diff --git a/apps/ledger-live-mobile/src/reducers/types.ts b/apps/ledger-live-mobile/src/reducers/types.ts index e5b9fa1af111..9df02fefbac0 100644 --- a/apps/ledger-live-mobile/src/reducers/types.ts +++ b/apps/ledger-live-mobile/src/reducers/types.ts @@ -29,6 +29,7 @@ import { ImageType } from "../components/CustomImage/types"; import { CLSSupportedDeviceModelId } from "@ledgerhq/live-common/device/use-cases/isCustomLockScreenSupported"; import { WalletState } from "@ledgerhq/live-wallet/store"; import { TrustchainStore } from "@ledgerhq/trustchain/store"; +import { Steps } from "LLM/features/WalletSync/types/Activation"; // === ACCOUNT STATE === @@ -347,6 +348,7 @@ export type MarketState = { export type WalletSyncState = { isManageKeyDrawerOpen: boolean; isActivateDrawerOpen: boolean; + activateDrawerStep: Steps; }; // === ROOT STATE === diff --git a/apps/ledger-live-mobile/src/reducers/walletSync.ts b/apps/ledger-live-mobile/src/reducers/walletSync.ts index 7253382342aa..8092bac10986 100644 --- a/apps/ledger-live-mobile/src/reducers/walletSync.ts +++ b/apps/ledger-live-mobile/src/reducers/walletSync.ts @@ -5,12 +5,15 @@ import { WalletSyncActionTypes, WalletSyncPayload, WalletSyncSetActivateDrawer, + WalletSyncSetActivateStep, WalletSyncSetManageKeyDrawerPayload, } from "../actions/types"; +import { Steps } from "LLM/features/WalletSync/types/Activation"; export const INITIAL_STATE: WalletSyncState = { isManageKeyDrawerOpen: false, isActivateDrawerOpen: false, + activateDrawerStep: Steps.Activation, }; const handlers: ReducerMap = { @@ -22,6 +25,10 @@ const handlers: ReducerMap = { ...state, isActivateDrawerOpen: (action as Action).payload, }), + [WalletSyncActionTypes.LEDGER_SYNC_SET_ACTIVATE_STEP]: (state, action) => ({ + ...state, + activateDrawerStep: (action as Action).payload, + }), }; export const storeSelector = (state: State): WalletSyncState => state.walletSync; @@ -29,5 +36,7 @@ export const manageKeyDrawerSelector = (state: State): boolean => state.walletSync.isManageKeyDrawerOpen; export const activateDrawerSelector = (state: State): boolean => state.walletSync.isActivateDrawerOpen; +export const activateDrawerStepSelector = (state: State): Steps => + state.walletSync.activateDrawerStep; export default handleActions(handlers, INITIAL_STATE); diff --git a/apps/ledger-live-mobile/src/screens/Settings/General/WalletSyncRow.tsx b/apps/ledger-live-mobile/src/screens/Settings/General/WalletSyncRow.tsx index d93c667bd6b1..82af7b53a5d8 100644 --- a/apps/ledger-live-mobile/src/screens/Settings/General/WalletSyncRow.tsx +++ b/apps/ledger-live-mobile/src/screens/Settings/General/WalletSyncRow.tsx @@ -14,6 +14,7 @@ import ActivationDrawer from "LLM/features/WalletSync/screens/Activation/Activat import { Steps } from "LLM/features/WalletSync/types/Activation"; import { activateDrawerSelector } from "~/reducers/walletSync"; import { setLedgerSyncActivateDrawer } from "~/actions/walletSync"; +import { useCurrentStep } from "LLM/features/WalletSync/hooks/useCurrentStep"; const WalletSyncRow = () => { const { t } = useTranslation(); @@ -22,10 +23,12 @@ const WalletSyncRow = () => { const isDrawerVisible = useSelector(activateDrawerSelector); const dispatch = useDispatch(); + const { setCurrentStep } = useCurrentStep(); const closeDrawer = useCallback(() => { dispatch(setLedgerSyncActivateDrawer(false)); - }, [dispatch]); + setCurrentStep(Steps.Activation); + }, [dispatch, setCurrentStep]); const trustchain = useSelector(trustchainSelector); const navigateToWalletSyncActivationScreen = useCallback(() => {