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

✨ (llm) [LIVE-14839]: As a user when I start the onboarding I want to get a generic pairing message #8541

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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/brave-icons-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Remove default nanoX pairing desc screen
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default class OnboardingStepsPage {
buyLedgerButton = () => getElementById("onboarding-noLedgerYetModal-buy");
exploreWithoutDeviceButton = () => getElementById(this.exploreWithoutDeviceButtonId);
connectLedgerButton = () => getElementById("Existing Wallet | Connect");
pairNanoButton = () => getElementById("Onboarding-PairNewNano");
maybeLaterButton = () => getElementById("notifications-prompt-later");

setupLedger = "onboarding-setupLedger";
Expand Down Expand Up @@ -157,10 +156,6 @@ export default class OnboardingStepsPage {
await tapById(this.quizzFinalCta);
}

async selectPairMyNano() {
await tapByElement(this.pairNanoButton());
}

async declineNotifications() {
await tapByElement(this.maybeLaterButton());
}
Expand Down
4 changes: 0 additions & 4 deletions apps/ledger-live-mobile/e2e/specs/onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe("Onboarding", () => {
await app.onboarding.startOnboarding();
await app.onboarding.chooseToAccessYourWallet();
await app.onboarding.chooseToConnectYourLedger();
await app.onboarding.selectPairMyNano();
await app.common.selectAddDevice();
await app.common.addDeviceViaBluetooth();
await app.portfolio.waitForPortfolioPageToLoad();
Expand All @@ -33,7 +32,6 @@ describe("Onboarding", () => {
await app.onboarding.chooseSetupLedger();
await app.onboarding.chooseDevice("nanoX");
await app.onboarding.goesThroughRestorePhrase();
await app.onboarding.selectPairMyNano();
await app.common.selectAddDevice();
await app.common.addDeviceViaBluetooth();
await app.portfolio.waitForPortfolioPageToLoad();
Expand All @@ -52,7 +50,6 @@ describe("Onboarding", () => {
await app.onboarding.checkDeviceNotCompatible();
} else {
await app.onboarding.goesThroughRestorePhrase();
await app.onboarding.selectPairMyNano();
await app.common.addDeviceViaUSB("nanoSP");
await app.portfolio.waitForPortfolioPageToLoad();
}
Expand All @@ -64,7 +61,6 @@ describe("Onboarding", () => {
await app.onboarding.chooseSetupLedger();
await app.onboarding.chooseDevice("nanoX");
await app.onboarding.goesThroughCreateWallet();
await app.onboarding.selectPairMyNano();
await app.common.selectAddDevice();
await app.common.addDeviceViaBluetooth();
await app.portfolio.waitForPortfolioPageToLoad();
Expand Down
119 changes: 50 additions & 69 deletions apps/ledger-live-mobile/src/screens/Onboarding/steps/pairNew.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useCallback, useMemo, memo } from "react";
import React, { useCallback, memo } from "react";
import { useNavigation, useRoute } from "@react-navigation/native";
import { Flex, IconsLegacy } from "@ledgerhq/native-ui";
import { useDispatch } from "react-redux";
import { NavigatorName, ScreenName } from "~/const";
import BaseStepperView, { PairNew, ConnectNano } from "./setupDevice/scenes";
import { ConnectDevice } from "./setupDevice/scenes";
import { TrackScreen } from "~/analytics";
import SeedWarning from "../shared/SeedWarning";
import Illustration from "~/images/illustration/Illustration";
import {
completeOnboarding,
setHasBeenRedirectedToPostOnboarding,
Expand All @@ -20,28 +20,49 @@ import {
} from "~/components/RootNavigator/types/helpers";
import { OnboardingNavigatorParamList } from "~/components/RootNavigator/types/OnboardingNavigator";
import { BaseOnboardingNavigatorParamList } from "~/components/RootNavigator/types/BaseOnboardingNavigator";
import { Step } from "./setupDevice/scenes/BaseStepperView";
import styled from "styled-components/native";
import { SafeAreaView } from "react-native-safe-area-context";
import Button from "~/components/PreventDoubleClickButton";

const images = {
light: {
Intro: require("~/images/illustration/Light/_076.png"),
},
dark: {
Intro: require("~/images/illustration/Dark/_076.png"),
},
};

type Metadata = {
id: string;
illustration: JSX.Element | null;
drawer: null | { route: string; screen: string };
};
const StyledContainerView = styled(Flex)`
padding-left: 16px;
padding-right: 16px;
padding-top: 32px;
flex: 1;
`;

type NavigationProps = RootComposite<
StackNavigatorProps<OnboardingNavigatorParamList, ScreenName.OnboardingPairNew>
>;

const scenes = [PairNew, ConnectNano] as Step[];
const StyledSafeAreaView = styled(SafeAreaView)`
flex: 1;
background-color: ${p => p.theme.colors.background.main};
`;

const ImageHeader = () => {
const navigation = useNavigation<NavigationProps["navigation"]>();
return (
<Flex
flexDirection="row"
justifyContent="space-between"
alignItems="center"
width="100%"
height={48}
>
<Button
Icon={() => <IconsLegacy.ArrowLeftMedium size={24} />}
onPress={() => navigation.goBack()}
/>
<Flex width={48}>
<Button
Icon={IconsLegacy.InfoMedium}
onPress={() => navigation.navigate(ScreenName.OnboardingBluetoothInformation)}
/>
</Flex>
</Flex>
);
};

export default memo(function () {
const navigation = useNavigation<NavigationProps["navigation"]>();
Expand All @@ -51,46 +72,12 @@ export default memo(function () {
const { triggerJustFinishedOnboardingNewDevicePushNotificationModal } = useNotifications();
const { resetCurrentStep } = useNavigationInterceptor();

const { deviceModelId, showSeedWarning, next, isProtectFlow, fromAccessExistingWallet } =
route.params;

const metadata: Array<Metadata> = useMemo(
() => [
{
id: PairNew.id,
illustration: (
<Illustration
size={150}
darkSource={images.dark.Intro}
lightSource={images.light.Intro}
/>
),
drawer: {
route: ScreenName.OnboardingBluetoothInformation,
screen: ScreenName.OnboardingBluetoothInformation,
},
},
{
id: ConnectNano.id,
illustration: null,
drawer: isProtectFlow
? {
route: ScreenName.OnboardingProtectionConnectionInformation,
screen: ScreenName.OnboardingProtectionConnectionInformation,
}
: {
route: ScreenName.OnboardingBluetoothInformation,
screen: ScreenName.OnboardingBluetoothInformation,
},
},
],
[isProtectFlow],
);
const { deviceModelId, showSeedWarning, isProtectFlow, fromAccessExistingWallet } = route.params;

const onFinish = useCallback(() => {
if (next && deviceModelId) {
if (isProtectFlow && deviceModelId) {
// only used for protect for now
navigation.navigate(next, {
navigation.navigate(ScreenName.OnboardingProtectFlow, {
deviceModelId,
});
return;
Expand All @@ -117,7 +104,7 @@ export default memo(function () {

triggerJustFinishedOnboardingNewDevicePushNotificationModal();
}, [
next,
isProtectFlow,
deviceModelId,
dispatch,
resetCurrentStep,
Expand All @@ -126,20 +113,14 @@ export default memo(function () {
triggerJustFinishedOnboardingNewDevicePushNotificationModal,
]);

const nextPage = useCallback(() => {
onFinish();
}, [onFinish]);

return (
<>
<StyledSafeAreaView>
<TrackScreen category="Onboarding" name="PairNew" />
<BaseStepperView
onNext={nextPage}
steps={scenes}
metadata={metadata}
deviceModelId={deviceModelId}
/>
<ImageHeader />
<StyledContainerView>
<ConnectDevice onSuccess={onFinish} />
</StyledContainerView>
{showSeedWarning && deviceModelId ? <SeedWarning deviceModelId={deviceModelId} /> : null}
</>
</StyledSafeAreaView>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Device } from "@ledgerhq/live-common/hw/actions/types";
import { Result } from "@ledgerhq/live-common/hw/actions/manager";
import DeviceActionModal from "~/components/DeviceActionModal";
import SelectDevice2 from "~/components/SelectDevice2";
import { TrackScreen } from "~/analytics";
import Button from "~/components/PreventDoubleClickButton";

import {
Expand All @@ -17,7 +16,7 @@ import {
} from "~/actions/settings";
import { useManagerDeviceAction } from "~/hooks/deviceActions";

const ConnectNanoScene = ({ onNext }: { onNext: () => void }) => {
const ConnectDevice = ({ onSuccess }: { onSuccess: () => void }) => {
const action = useManagerDeviceAction();
const dispatch = useDispatch();
const [device, setDevice] = useState<Device | undefined>();
Expand Down Expand Up @@ -52,15 +51,14 @@ const ConnectNanoScene = ({ onNext }: { onNext: () => void }) => {
setDevice(undefined);
dispatch(setReadOnlyMode(false));
dispatch(setHasOrderedNano(false));
onNext();
onSuccess();
}
},
[dispatch, onNext],
[dispatch, onSuccess],
);

return (
<>
<TrackScreen category="Onboarding" name="PairNew" />
<Flex flex={1}>
<SelectDevice2
onSelect={onSelectDevice}
Expand All @@ -77,32 +75,22 @@ const ConnectNanoScene = ({ onNext }: { onNext: () => void }) => {
action={action}
request={null}
/>
{__DEV__ ? (
<Button
mt={7}
type="color"
outline
onPress={() => {
dispatch(setReadOnlyMode(false));
dispatch(setHasOrderedNano(false));
onSuccess();
}}
>
(DEV) SKIP THIS STEP
</Button>
) : null}
</>
);
};

ConnectNanoScene.id = "ConnectNanoScene";
ConnectNanoScene.contentContainerStyle = { padding: 16, flex: 1 };

const Next = ({ onNext }: { onNext: () => void }) => {
const dispatch = useDispatch();

return __DEV__ ? (
<Button
mt={7}
type="color"
outline
onPress={() => {
dispatch(setReadOnlyMode(false));
dispatch(setHasOrderedNano(false));
onNext();
}}
>
(DEV) SKIP THIS STEP
</Button>
) : null;
};

ConnectNanoScene.Next = Next;

export default ConnectNanoScene;
export default ConnectDevice;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export { default as RecoveryPhrase } from "./RecoveryPhrase";
export { default as RecoveryPhraseInstructions } from "./RecoveryPhraseInstructions";
export { default as RecoveryPhraseSetup } from "./RecoveryPhraseSetup";
export { default as HideRecoveryPhrase } from "./HideRecoveryPhrase";
export { default as PairNew } from "./PairNew";
export { default as ConnectNano } from "./ConnectNano";
export { default as ConnectDevice } from "./ConnectDevice";
export { default as QuizzFinal } from "./QuizzFinal";
export { default as SyncDesktop } from "./SyncDesktop";

Expand Down
Loading