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

feat(llm): add wallet sync entry point during onboarding #7055

Merged
merged 1 commit into from
Jun 11, 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/thin-books-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Add onboarding entry point for wallet sync
3 changes: 2 additions & 1 deletion apps/ledger-live-mobile/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,8 @@
"title": "Welcome back",
"subtitle": "Select how you’d like to access your wallet:",
"connect": "Connect your Ledger",
"sync": "Sync with Ledger Live desktop"
"sync": "Sync with Ledger Live desktop",
"walletSync": "Sync with another Ledger Live"
},
"discoverLive": {
"exploreWithoutADevice": "Explore without a device",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import { Text } from "@ledgerhq/native-ui";
import QueuedDrawer from "LLM/components/QueuedDrawer";

type Props = {
isOpen: boolean;
handleClose: () => void;
};

const DummyDrawer = ({ isOpen, handleClose }: Props) => {
return (
<QueuedDrawer isRequestingToBeOpened={isOpen} onClose={handleClose}>
<Text>{"Dummy Drawer"}</Text>
</QueuedDrawer>
);
};

export default DummyDrawer;
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const SelectionCard = ({
<Touchable onPress={pressAndTrack} testID={testID}>
<Flex
flexDirection="row"
alignItems={"center"}
bg={colors.opacityDefault.c05}
py={space[7]}
pr={space[7]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Icons } from "@ledgerhq/native-ui";
import { useNavigation } from "@react-navigation/native";
import React, { useCallback } from "react";
import React, { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { useTheme } from "styled-components/native";
Expand All @@ -12,6 +12,9 @@ import { ScreenName } from "~/const/navigation";
import { OnboardingType } from "~/reducers/types";
import { SelectionCards } from "./Cards/SelectionCard";
import OnboardingView from "./OnboardingView";
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import DummyDrawer from "LLM/features/WalletSync/drawers/DummyDrawer";
import { logDrawer } from "LLM/components/QueuedDrawer/utils/logDrawer";

type NavigationProps = StackNavigatorProps<
OnboardingNavigatorParamList & BaseNavigatorStackParamList,
Expand All @@ -23,6 +26,10 @@ function AccessExistingWallet() {
const { colors } = useTheme();
const dispatch = useDispatch();
const navigation = useNavigation<NavigationProps["navigation"]>();
const walletSyncFeatureFlag = useFeature("llmWalletSync");

const isWalletSyncEnabled = walletSyncFeatureFlag?.enabled;
const [isDrawerVisible, setIsDrawerVisible] = useState(false);

const connect = useCallback(() => {
dispatch(setOnboardingType(OnboardingType.connect));
Expand All @@ -37,6 +44,16 @@ function AccessExistingWallet() {
navigation.navigate(ScreenName.OnboardingImportAccounts);
}, [navigation]);

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

const closeDrawer = useCallback(() => {
setIsDrawerVisible(false);
logDrawer("Wallet Sync Welcome back", "close");
}, []);

return (
<OnboardingView
title={t("onboarding.welcomeBackStep.title")}
Expand All @@ -60,18 +77,34 @@ function AccessExistingWallet() {
onPress: connect,
icon: <Icons.Bluetooth color={colors.primary.c80} />,
},
{
title: t("onboarding.welcomeBackStep.sync"),
event: "button_clicked",
eventProperties: {
button: "Sync with Desktop",
},
testID: "Existing Wallet | Sync",
onPress: sync,
icon: <Icons.QrCodeScanner color={colors.primary.c80} />,
},
...(isWalletSyncEnabled
? [
{
title: t("onboarding.welcomeBackStep.walletSync"),
event: "button_clicked",
eventProperties: {
button: "Sync with WalletSync",
},
testID: "Existing Wallet | Wallet Sync",
onPress: openDrawer,
icon: <Icons.QrCode color={colors.primary.c80} />,
},
]
: [
{
title: t("onboarding.welcomeBackStep.sync"),
event: "button_clicked",
eventProperties: {
button: "Sync with Desktop",
},
testID: "Existing Wallet | Sync",
onPress: sync,
icon: <Icons.QrCodeScanner color={colors.primary.c80} />,
},
]),
]}
/>
<DummyDrawer isOpen={isDrawerVisible} handleClose={closeDrawer} />
</OnboardingView>
);
}
Expand Down
Loading