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

[FIX]: Fix navigation on Drawer when AlreadySecuredOtherSeed error #7754

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/gorgeous-ways-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Fix navigation on Drawer when AlreadySecuredOtherSeed error
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useDestroyTrustchain } from "./useDestroyTrustchain";
export enum SceneKind {
DeviceInstructions,
Loader,
WrongSeedError,
ConfirmDeleteWrongSeedError,
KeyError,
UnbackedError,
GenericError,
Expand All @@ -19,7 +19,7 @@ export enum SceneKind {
type Scene =
| { kind: SceneKind.DeviceInstructions; device: Device }
| { kind: SceneKind.Loader }
| { kind: SceneKind.WrongSeedError }
| { kind: SceneKind.ConfirmDeleteWrongSeedError }
| { kind: SceneKind.KeyError }
| { kind: SceneKind.AlreadySecuredSameSeed }
| { kind: SceneKind.AlreadySecuredOtherSeed }
Expand All @@ -30,7 +30,7 @@ export type DrawerProps = {
scene: Scene;
retry: () => void;
goToDelete: () => void;
backToKeyError: () => void;
backToWrongSeedError: () => void;
confirmDeleteKey: () => void;
};

Expand All @@ -49,11 +49,11 @@ export function useFollowInstructionDrawer(
}, []); // eslint-disable-line react-hooks/exhaustive-deps

const goToDelete = useCallback(() => {
setScene({ kind: SceneKind.WrongSeedError });
setScene({ kind: SceneKind.ConfirmDeleteWrongSeedError });
}, []);

const backToKeyError = useCallback(() => {
setScene({ kind: SceneKind.KeyError });
const backToWrongSeedError = useCallback(() => {
setScene({ kind: SceneKind.AlreadySecuredOtherSeed });
}, []);

const confirmDeleteKey = useCallback(async () => {
Expand All @@ -65,5 +65,5 @@ export function useFollowInstructionDrawer(
run(setScene);
}, deps); // eslint-disable-line react-hooks/exhaustive-deps

return { scene, retry, goToDelete, backToKeyError, confirmDeleteKey };
return { scene, retry, goToDelete, backToWrongSeedError, confirmDeleteKey };
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const GenericFollowInstructionsDrawer = ({
handleClose,
scene,
goToDelete,
backToKeyError,
backToWrongSeedError,
confirmDeleteKey,
retry,
}: Props) => {
Expand All @@ -47,8 +47,10 @@ const GenericFollowInstructionsDrawer = ({
</Flex>
);

case SceneKind.WrongSeedError:
return <ConfirmManageKey onClickConfirm={confirmDeleteKey} onCancel={backToKeyError} />;
case SceneKind.ConfirmDeleteWrongSeedError:
return (
<ConfirmManageKey onClickConfirm={confirmDeleteKey} onCancel={backToWrongSeedError} />
);

case SceneKind.KeyError:
return (
Expand Down
Loading