Skip to content

Commit

Permalink
Merge pull request #7141 from LedgerHQ/feat/LIVE-12149
Browse files Browse the repository at this point in the history
⛓️feat(llm): add WS activation drawer from onboarding
  • Loading branch information
LucasWerey authored Jun 27, 2024
2 parents 84067bd + 0648604 commit 4499014
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-rings-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Add activation drawer from onboarding entry point
Original file line number Diff line number Diff line change
Expand Up @@ -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 boolean> = T extends true
? { isInsideDrawer: T; openSyncMethodDrawer: () => void }
: { isInsideDrawer?: T; openSyncMethodDrawer?: undefined };

const Activation: React.FC<Props<boolean>> = ({ isInsideDrawer, openSyncMethodDrawer }) => {
const { colors } = useTheme();
const { t } = useTranslation();

Expand All @@ -18,7 +22,7 @@ const Activation = () => {
};

const onPressHasAlreadyCreatedAKey = () => {
setIsDrawerOpen(true);
isInsideDrawer ? openSyncMethodDrawer() : setIsDrawerOpen(true);
};

const onPressCloseDrawer = () => {
Expand Down Expand Up @@ -48,7 +52,7 @@ const Activation = () => {
onPressHasAlreadyCreatedAKey={onPressHasAlreadyCreatedAKey}
onPressSyncAccounts={onPressSyncAccounts}
/>
<Drawer isOpen={isDrawerOpen} handleClose={onPressCloseDrawer} />
{!isInsideDrawer && <Drawer isOpen={isDrawerOpen} handleClose={onPressCloseDrawer} />}
</Flex>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<>
<TrackScreen />
<QueuedDrawer isRequestingToBeOpened={isOpen} onClose={handleClose}>
<Activation isInsideDrawer openSyncMethodDrawer={openSyncMethodDrawer} />
</QueuedDrawer>

<Drawer isOpen={isSyncMethodDrawerOpen} handleClose={onPressCloseDrawer} />
</>
);
};

export default ActivationDrawer;
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -54,6 +54,11 @@ function AccessExistingWallet() {
logDrawer("Wallet Sync Welcome back", "close");
}, []);

const reopenDrawer = useCallback(() => {
setIsDrawerVisible(true);
logDrawer("Wallet Sync Welcome back", "reopen");
}, []);

return (
<OnboardingView
title={t("onboarding.welcomeBackStep.title")}
Expand Down Expand Up @@ -104,7 +109,11 @@ function AccessExistingWallet() {
]),
]}
/>
<Drawer isOpen={isDrawerVisible} handleClose={closeDrawer} />
<ActivationDrawer
isOpen={isDrawerVisible}
handleClose={closeDrawer}
reopenDrawer={reopenDrawer}
/>
</OnboardingView>
);
}
Expand Down

2 comments on commit 4499014

@github-actions
Copy link

Choose a reason for hiding this comment

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

[Bot] Testing with 'Nitrogen' ($0.00) ⏲ 4.00ms

What is the bot and how does it work? Everything is documented here!

Details of the 0 mutations
Portfolio ($0.00) – Details of the 0 currencies
Spec (accounts) State Remaining Runs (est) funds?

Performance ⏲ 4.00ms

Time spent for each spec: (total across mutations)

Spec (accounts) preload scan re-sync tx status sign op broadcast test destination test
TOTAL N/A N/A N/A N/A N/A N/A N/A N/A

What is the bot and how does it work? Everything is documented here!

@github-actions
Copy link

Choose a reason for hiding this comment

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

[Bot] Testing with 'Nitrogen' ($0.00) ⏲ 5ms

What is the bot and how does it work? Everything is documented here!

Details of the 0 mutations
Portfolio ($0.00) – Details of the 0 currencies
Spec (accounts) State Remaining Runs (est) funds?

Performance ⏲ 5ms

Time spent for each spec: (total across mutations)

Spec (accounts) preload scan re-sync tx status sign op broadcast test destination test
TOTAL N/A N/A N/A N/A N/A N/A N/A N/A

What is the bot and how does it work? Everything is documented here!

Please sign in to comment.