diff --git a/.changeset/hip-spies-develop.md b/.changeset/hip-spies-develop.md new file mode 100644 index 000000000000..67ba6c474475 --- /dev/null +++ b/.changeset/hip-spies-develop.md @@ -0,0 +1,5 @@ +--- +"live-mobile": patch +--- + +LLM - Added navigation to the manage key screen diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/manageInstances.integration.test.tsx b/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/manageInstances.integration.test.tsx index 3db0a22d70ea..7d8d014ae56f 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/manageInstances.integration.test.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/__integrations__/manageInstances.integration.test.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { screen } from "@testing-library/react-native"; +import { screen, waitFor } from "@testing-library/react-native"; import { render } from "@tests/test-renderer"; import { WalletSyncSettingsNavigator } from "./shared"; import { State } from "~/reducers/types"; @@ -120,4 +120,31 @@ describe("ManageInstances", () => { const myInstance = screen.getByTestId("walletSync-manage-instance-2"); expect(myInstance).toBeDefined(); }); + it("Should redirect to the Manage Key screen", async () => { + const { user } = render(, { + overrideInitialState: (state: State) => ({ + ...state, + settings: { + ...state.settings, + readOnlyModeEnabled: false, + overriddenFeatureFlags: { llmWalletSync: { enabled: true } }, + }, + trustchain: { + ...state.trustchain, + trustchain, + memberCredentials: { + privatekey: "privatekey", + pubkey: "currentInstance", + }, + }, + }), + }); + + await user.press(await screen.findByText(/ledger sync/i)); + await user.press(await screen.findByText(/Manage now/i)); + await user.press(screen.getAllByText("Remove")[0]); + expect(screen.getByText(/You can’t remove the current instance/i)).toBeDefined(); + await user.press(await screen.findByText(/Delete my encryption key/i)); + await waitFor(() => screen.findByText(/Manage your key/i)); + }); }); diff --git a/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/ManageInstances/ManageInstancesDrawer.tsx b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/ManageInstances/ManageInstancesDrawer.tsx index cfd8b8004be1..f0a56a925c3e 100644 --- a/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/ManageInstances/ManageInstancesDrawer.tsx +++ b/apps/ledger-live-mobile/src/newArch/features/WalletSync/screens/ManageInstances/ManageInstancesDrawer.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useCallback } from "react"; import QueuedDrawer from "LLM/components/QueuedDrawer"; import { TrackScreen } from "~/analytics"; @@ -8,6 +8,12 @@ import { ListInstances } from "../../components/ManageInstances/ListInstances"; import { DeletionError, ErrorReason } from "../../components/ManageInstances/DeletionError"; import { HookResult, Scene } from "./useManageInstanceDrawer"; +import { useManageKeyDrawer } from "../ManageKey/useManageKeyDrawer"; +import { + AnalyticsButton, + AnalyticsPage, + useLedgerSyncAnalytics, +} from "../../hooks/useLedgerSyncAnalytics"; const ManageInstancesDrawer = ({ isDrawerVisible, @@ -19,6 +25,14 @@ const ManageInstancesDrawer = ({ onClickInstance, }: HookResult) => { const { error, isError, isLoading, data } = memberHook; + const manageKeyHook = useManageKeyDrawer(); + const { onClickTrack } = useLedgerSyncAnalytics(); + + const goToManageBackup = useCallback(() => { + handleClose(); + manageKeyHook.openDrawer(); + onClickTrack({ button: AnalyticsButton.ManageKey, page: AnalyticsPage.AutoRemove }); + }, [manageKeyHook, onClickTrack, handleClose]); const getScene = () => { if (isError) { @@ -47,8 +61,7 @@ const ManageInstancesDrawer = ({ return ( console.log("gotoDelete")} + goToDelete={goToManageBackup} understood={() => changeScene(Scene.List)} /> );