Skip to content

Commit

Permalink
Merge branch 'LedgerHQ:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-meilan authored Nov 11, 2024
2 parents 1899c75 + b1b193c commit 343cf74
Show file tree
Hide file tree
Showing 73 changed files with 1,722 additions and 589 deletions.
6 changes: 6 additions & 0 deletions .changeset/light-oranges-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"live-mobile": patch
"@ledgerhq/live-common": patch
---

feat: handle cacheBusting params in manifests to force cache clearing in liveApps
6 changes: 6 additions & 0 deletions .changeset/mean-pugs-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": patch
"live-mobile": patch
---

Add discreetMode param for buy/sell
8 changes: 8 additions & 0 deletions .changeset/plenty-dolphins-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"ledger-live-desktop": patch
---

Flex & Stax onboarding:

- hide Backup section during onboarding on Flex and Stax
- add Ledger Recover upsell between onboarding and post onboarding
6 changes: 6 additions & 0 deletions .changeset/shaggy-shoes-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": patch
"@ledgerhq/live-common": patch
---

Add translation for troubleshooting network
5 changes: 5 additions & 0 deletions .changeset/slow-lions-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

add drawer change device
6 changes: 6 additions & 0 deletions .changeset/smart-items-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"live-mobile": patch
"@ledgerhq/live-common": patch
---

fix: better logic and guard against accessing null db
5 changes: 5 additions & 0 deletions .changeset/sweet-needles-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Redirect users to Recover Login if they have an account as they may be logged out
5 changes: 5 additions & 0 deletions .changeset/two-seas-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": minor
---

Track users creating, joining, and leaving Ledger keyrings on LLM
3 changes: 2 additions & 1 deletion .github/workflows/turbo-affected-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
steps:
- name: Checkout feature branch
uses: actions/checkout@v4

with:
fetch-depth: 0
- name: Fetch develop branch
run: |
git fetch origin develop:develop --depth=1
Expand Down
9 changes: 1 addition & 8 deletions apps/ledger-live-desktop/src/renderer/actions/devices.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { Device } from "@ledgerhq/live-common/hw/actions/types";
export type SetCurrentDevice = (a: Device | null) => {
type: string;
payload: Device | null;
};
export const setCurrentDevice: SetCurrentDevice = payload => ({
type: "SET_CURRENT_DEVICE",
payload,
});

type AddDevice = (a: Device) => {
type: string;
payload: Device;
Expand Down
20 changes: 20 additions & 0 deletions apps/ledger-live-desktop/src/renderer/actions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,23 @@ export const setHasProtectedOrdinalsAssets = (payload: boolean) => ({
type: "SET_HAS_PROTECTED_ORDINALS_ASSETS",
payload,
});

export const setHasBeenUpsoldRecover = (payload: boolean) => ({
type: "SET_HAS_BEEN_UPSOLD_RECOVER",
payload,
});

export const setOnboardingUseCase = (payload: Settings["onboardingUseCase"]) => ({
type: "SET_ONBOARDING_USE_CASE",
payload,
});

export const setHasRedirectedToPostOnboarding = (payload: boolean) => ({
type: "SET_HAS_REDIRECTED_TO_POST_ONBOARDING",
payload,
});

export const setLastOnboardedDevice = (payload: Device | null) => ({
type: "SET_LAST_ONBOARDED_DEVICE",
payload,
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
renderAllowOpeningApp,
renderBootloaderStep,
renderConnectYourDevice,
renderHardwareUpdate,
renderError,
renderInWrongAppForAccount,
renderLoading,
Expand Down Expand Up @@ -82,6 +83,14 @@ import { walletSelector } from "~/renderer/reducers/wallet";

type LedgerError = InstanceType<LedgerErrorConstructor<{ [key: string]: unknown }>>;

type SwapRequest = {
transaction: Transaction;
exchange: ExchangeSwap;
provider: string;
rate: number;
amountExpectedTo: number;
};

type PartialNullable<T> = {
[P in keyof T]?: T[P] | null;
};
Expand Down Expand Up @@ -331,6 +340,10 @@ export const DeviceActionDefaultRendering = <R, H extends States, P>({
}
}

if (device?.modelId === "nanoS" && (request as SwapRequest)?.provider === "thorswap") {
return renderHardwareUpdate();
}

if (listingApps) {
return renderListingApps();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ import { currencySettingsLocaleSelector, SettingsState } from "~/renderer/reduce
import { accountNameSelector, WalletState } from "@ledgerhq/live-wallet/store";
import { isSyncOnboardingSupported } from "@ledgerhq/live-common/device/use-cases/screenSpecs";
import NoSuchAppOnProviderErrorComponent from "./NoSuchAppOnProviderErrorComponent";
import Image from "~/renderer/components/Image";
import Nano from "~/renderer/images/nanoS.v4.svg";

export const AnimationWrapper = styled.div`
width: 600px;
Expand Down Expand Up @@ -249,6 +251,11 @@ const EllipsesTextStyled = styled(Text)`
max-width: 100%;
`;

const ButtonFooter = styled(Footer)`
width: 100%;
margin-top: 46px;
`;

// these are not components because we want reconciliation to not remount the sub elements

export const renderRequestQuitApp = ({
Expand Down Expand Up @@ -922,6 +929,66 @@ export const renderConnectYourDevice = ({
</Wrapper>
);

const OpenSwapBtn = () => {
const { setDrawer } = useContext(context);
const dispatch = useDispatch();

const onClick = () => {
setTrackingSource("device action open swap button");
dispatch(closePlatformAppDrawer());
setDrawer(undefined);
};

return (
<ButtonV3
variant="main"
outline
size="large"
width="calc(100% - 80px)"
ml="40px"
mr="40px"
onClick={onClick}
>
<Trans i18nKey={"swap.wrongDevice.changeProvider"} />
</ButtonV3>
);
};

export const renderHardwareUpdate = () => (
<Wrapper>
<Header>
<Image resource={Nano} alt="NanoS" mb="40px"></Image>
</Header>
<Flex alignItems="center" flexDirection="column" rowGap="16px" mr="40px" ml="40px">
<Title variant="body" color="palette.text.shade100">
<Trans i18nKey="swap.wrongDevice.title" />
</Title>
<Text variant="body" color="palette.text.shade60" textAlign="center">
<Trans i18nKey="swap.wrongDevice.description" />
</Text>
</Flex>
<ButtonFooter>
<ButtonContainer width="100%">
<ButtonV3
variant="main"
size="large"
width="calc(100% - 80px)"
ml="40px"
mr="40px"
onClick={() => {
openURL("https://shop.ledger.com/pages/hardware-wallet");
}}
>
<Trans i18nKey={"swap.wrongDevice.cta"} />
</ButtonV3>
</ButtonContainer>
<ButtonContainer width="100%">
<OpenSwapBtn />
</ButtonContainer>
</ButtonFooter>
</Wrapper>
);

const renderFirmwareUpdatingBase = ({
modelId,
type,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum OnboardingUseCase {
setupDevice = "setup-device",
connectDevice = "connect-device",
recoveryPhrase = "recovery-phrase",
recover = "recover",
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { registerAssets } from "~/renderer/components/Onboarding/preloadAssets";
import OnboardingNavHeader from "../../OnboardingNavHeader";
import { track } from "~/renderer/analytics/segment";
import { ScreenId } from "../Tutorial";
import { OnboardingContext, UseCase } from "../../index";
import { OnboardingContext } from "../../index";
import { OnboardingUseCase } from "../../OnboardingUseCase";
import connectNanoLight from "./assets/connectNanoLight.png";
import restorePhraseLight from "./assets/restorePhraseLight.png";
import setupNanoLight from "./assets/setupNanoLight.png";
Expand Down Expand Up @@ -79,7 +80,7 @@ const RightColumn = styled(Flex).attrs({
`;

type Props = {
setUseCase: (useCase: UseCase) => void;
setUseCase: (useCase: OnboardingUseCase) => void;
setOpenedPedagogyModal: (isOpened: boolean) => void;
};

Expand Down Expand Up @@ -123,9 +124,11 @@ export function SelectUseCase({ setUseCase, setOpenedPedagogyModal }: Props) {
}
onClick={() => {
track("Onboarding - Setup new");
setUseCase(UseCase.setupDevice);
setUseCase(OnboardingUseCase.setupDevice);
setOpenedPedagogyModal(true);
history.push(`/onboarding/${UseCase.setupDevice}/${ScreenId.howToGetStarted}`);
history.push(
`/onboarding/${OnboardingUseCase.setupDevice}/${ScreenId.howToGetStarted}`,
);
}}
/>
</RightColumn>
Expand Down Expand Up @@ -157,8 +160,10 @@ export function SelectUseCase({ setUseCase, setOpenedPedagogyModal }: Props) {
}
onClick={() => {
track("Onboarding - Connect");
setUseCase(UseCase.connectDevice);
history.push(`/onboarding/${UseCase.connectDevice}/${ScreenId.pairMyNano}`);
setUseCase(OnboardingUseCase.connectDevice);
history.push(
`/onboarding/${OnboardingUseCase.connectDevice}/${ScreenId.pairMyNano}`,
);
}}
/>
<UseCaseOption
Expand All @@ -182,9 +187,9 @@ export function SelectUseCase({ setUseCase, setOpenedPedagogyModal }: Props) {
}
onClick={() => {
track("Onboarding - Restore");
setUseCase(UseCase.recoveryPhrase);
setUseCase(OnboardingUseCase.recoveryPhrase);
history.push(
`/onboarding/${UseCase.recoveryPhrase}/${ScreenId.importYourRecoveryPhrase}`,
`/onboarding/${OnboardingUseCase.recoveryPhrase}/${ScreenId.importYourRecoveryPhrase}`,
);
}}
/>
Expand All @@ -209,8 +214,10 @@ export function SelectUseCase({ setUseCase, setOpenedPedagogyModal }: Props) {
if (deviceModelId === DeviceModelId.nanoS) {
dispatch(openModal("MODAL_PROTECT_DISCOVER", undefined));
} else {
setUseCase(UseCase.recover);
history.push(`/onboarding/${UseCase.recover}/${ScreenId.recoverHowTo}`);
setUseCase(OnboardingUseCase.recover);
history.push(
`/onboarding/${OnboardingUseCase.recover}/${ScreenId.recoverHowTo}`,
);
}
}}
/>
Expand Down
Loading

0 comments on commit 343cf74

Please sign in to comment.