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 Sep 26, 2024
2 parents 81f2986 + 03c3a22 commit ef8ddbc
Show file tree
Hide file tree
Showing 72 changed files with 423 additions and 322 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-snakes-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Always skip the analytics prompt in e2e tests
5 changes: 5 additions & 0 deletions .changeset/calm-pets-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

bump storyly version
8 changes: 8 additions & 0 deletions .changeset/clever-rocks-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"live-mobile": patch
---

fix(wallet-api): only call success and fail handlers when closing the flow on LLM

Allows to properly retry the sign message without sending an error through the wallet-api
We also only send the success when we actually close the last success screen
5 changes: 5 additions & 0 deletions .changeset/fresh-cobras-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Fix unstable integration test
9 changes: 9 additions & 0 deletions .changeset/slow-dingos-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"ledger-live-desktop": patch
"live-mobile": patch
"@ledgerhq/live-common": patch
---

fix(LLM): allow wallet-connect live-app to open a deep-link at any time

Refactor by sharing a single constant for wallet-connect live-app manifest id
7 changes: 7 additions & 0 deletions .changeset/sour-poets-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"live-mobile": patch
---

fix(LLM): wallet-connect deep-link from native app for a request would reload the page

Reloading the page would break the wallet-api flow shown when coming back to the app
5 changes: 5 additions & 0 deletions .changeset/strong-goats-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Always skip the analytics prompt in e2e tests
7 changes: 7 additions & 0 deletions .changeset/tough-terms-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"live-mobile": patch
---

fix(wallet-api): open any deep-link from the webview on LLM

Needed for wallet-connect-live-app deep-link back to mobile dApps
5 changes: 5 additions & 0 deletions .changeset/witty-bugs-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

storyly stories localization
5 changes: 5 additions & 0 deletions .changeset/witty-cows-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

Add protectBox to protect ordinals in discovery drawer
19 changes: 18 additions & 1 deletion .github/workflows/test-mobile-e2e-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ on:
description: "[iOS] Test Execution ticket ID. Ex: 'B2CQA-2461'"
required: false
type: string
speculos_tests:
description: Run Speculos tests
required: false
type: boolean
default: false

# Uncomment to have log-level: trace on detox run and build
# (cf: apps/ledger-live-mobile/detox.config.js)
Expand Down Expand Up @@ -173,6 +178,8 @@ jobs:
AVD_CORES: 4
AVD_RAM_SIZE: 4096M
AVD_OPTIONS: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
SPECULOS_IMAGE_TAG: ghcr.io/ledgerhq/speculos:0.9.5
COINAPPS: ${{ github.workspace }}/coin-apps
outputs:
status: ${{ steps.detox.outcome }}
steps:
Expand Down Expand Up @@ -255,12 +262,22 @@ jobs:
disable-linux-hw-accel: false
emulator-options: ${{ env.AVD_OPTIONS }}
script: ./tools/scripts/wait_emulator_idle.sh
- name: Setup Speculos image and Coin Apps
if: ${{ inputs.speculos_tests }}
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-speculos_image@develop
with:
coinapps_path: ${{ env.COINAPPS }}
speculos_tag: ${{ env.SPECULOS_IMAGE_TAG }}
bot_id: ${{ secrets.GH_BOT_APP_ID }}
bot_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- name: Run Android Tests
id: detox
run: pnpm mobile e2e:ci -p android -t
run: pnpm mobile e2e:ci -p android -t $([[ "$INPUT_SPECULOS" == "true" ]] && printf %s '--speculos')
timeout-minutes: 45
env:
DETOX_INSTALL_TIMEOUT: 120000
SEED: ${{ secrets.SEED_QAA_B2C }}
INPUT_SPECULOS: ${{ inputs.speculos_tests }}
- name: Generate single file Allure report
if: ${{ !cancelled() || steps.detox.outcome == 'cancelled' }}
run: pnpm dlx allure-commandline generate apps/ledger-live-mobile/artifacts --single-file
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-mobile-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ on:
description: "[iOS] Test Execution ticket ID. Ex: 'B2CQA-2461'"
required: false
type: string
speculos_tests:
description: Run Speculos tests
required: false
type: boolean
default: false

# Uncomment to have log-level: trace on detox run and build
# (cf: apps/ledger-live-mobile/detox.config.js)
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/test-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: "@Mobile • Test App"
run-name: "@Mobile • Test App triggered by ${{ inputs.login || github.actor }} ${{ format('on ref {0}', github.ref_name) }}"

on:
push:
branches:
- main
- develop
- release
- hotfix
workflow_dispatch:
inputs:
ref:
Expand Down
2 changes: 1 addition & 1 deletion .prototools
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node = "20.11.0"
npm = "10.3.0"
pnpm = "9.4.0"
pnpm = "9.11.0"
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"rxjs": "^7.8.1",
"secp256k1": "^4.0.3",
"semver": "^7.1.3",
"storyly-web": "^2.8.0",
"storyly-web": "^3.5.0",
"styled-components": "^5.3.3",
"styled-system": "^5.1.5",
"timemachine": "^0.3.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ const MainFooter = ({ setWantToManagePreferences, onShareAnalyticsChange }: Main
>
{t("analyticsOptInPrompt.variantA.refuse")}
</Button>
<Button variant={"main"} size={"large"} borderRadius={48} onClick={handleAcceptClick}>
<Button
data-testid="accept-analytics-button"
variant={"main"}
size={"large"}
borderRadius={48}
onClick={handleAcceptClick}
>
{t("analyticsOptInPrompt.variantA.accept")}
</Button>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const VariantBFooter = ({ clickOptions }: VariantBFooterProps) => {
{t("analyticsOptInPrompt.variantB.refuse")}
</Button>
<Button
data-testid="accept-analytics-button"
variant={"main"}
size={"large"}
borderRadius={48}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ const DiscoveryDrawerHeader: React.FC = () => (
<Flex
borderRadius="100%"
justifyContent="center"
backgroundColor={"#F7931A"}
padding={80}
style={{
height: 400,
width: 400,
position: "absolute",
top: 0,
left: "50%",
transform: "translateX(-50%) translateY(-50%)",
filter: "blur(120px)",
filter: "blur(17px)",
opacity: 0.2,
}}
>
<CryptoIcon name="BTC" circleIcon size={300} />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { useCallback } from "react";
import { Flex, Text } from "@ledgerhq/react-ui";
import Switch from "~/renderer/components/Switch";
import { hasProtectedOrdinalsAssetsSelector } from "~/renderer/reducers/settings";
import { setHasProtectedOrdinalsAssets } from "~/renderer/actions/settings";
import { useDispatch, useSelector } from "react-redux";
import { t } from "i18next";

const ProtectBox: React.FC = () => {
const dispatch = useDispatch();
const hasProtectedOrdinals = useSelector(hasProtectedOrdinalsAssetsSelector);

const onSwitchChange = useCallback(() => {
dispatch(setHasProtectedOrdinalsAssets(!hasProtectedOrdinals));
}, [dispatch, hasProtectedOrdinals]);

return (
<Flex bg="opacityDefault.c10" borderRadius={12} padding={12} flexDirection="column" rowGap={10}>
<Text variant="h4Inter" flex={1}>
{t("ordinals.inscriptions.discoveryDrawer.protectTitle")}
</Text>
<Flex alignItems="center" columnGap={20}>
<Text variant="bodyLineHeight" color="neutral.c70" flex={1} fontSize={14}>
{t("ordinals.inscriptions.discoveryDrawer.protectDescription")}
</Text>
<Flex>
<Switch isChecked={hasProtectedOrdinals} onChange={onSwitchChange} />
</Flex>
</Flex>
</Flex>
);
};

export default ProtectBox;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import DiscoveryDrawerHeader from "./Header";
import { Button, CryptoIcon, Flex, Link, Text } from "@ledgerhq/react-ui";
import ProtectBox from "./ProtectBox";
import { Button, CryptoIcon, Flex, Text } from "@ledgerhq/react-ui";
import { SideDrawer } from "~/renderer/components/SideDrawer";
import { Direction } from "@ledgerhq/react-ui/components/layout/Drawer/index";
import { space } from "@ledgerhq/react-ui/styles/theme";
Expand All @@ -17,7 +18,6 @@ const DiscoveryDrawer = ({ isOpen, onClose }: Props) => {
const { t } = useTranslation();
const learnMoreUrl = urls.whatAreOrdinals;
const onButtonClick = () => openURL(learnMoreUrl);
const onLinkClick = () => onClose();

return (
<SideDrawer
Expand Down Expand Up @@ -51,14 +51,12 @@ const DiscoveryDrawer = ({ isOpen, onClose }: Props) => {
>
{t("ordinals.inscriptions.discoveryDrawer.description")}
</Text>
<Button variant="main" mb={space[8]} onClick={onButtonClick}>
<Button variant="main" mb={space[14]} onClick={onButtonClick}>
<Text variant="bodyLineHeight" fontSize={16} color="neutral.c00" textAlign="center">
{t("ordinals.inscriptions.discoveryDrawer.learnMore")}
</Text>
</Button>
<Link mb={space[8]} size="large" onClick={onLinkClick}>
{t("ordinals.inscriptions.discoveryDrawer.viewCoinControl")}
</Link>
<ProtectBox />
</Flex>
</SideDrawer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ describe("displayNftCollection", () => {
});

await waitFor(() => expect(screen.getByText(/momentum/i)).toBeVisible());
await expect(screen.getByText(/receive nft/i)).toBeVisible();
await expect(screen.getByText(/see gallery/i)).toBeVisible();
await expect(screen.getByText(/see more collections/i)).toBeVisible();
expect(screen.getByText(/receive nft/i)).toBeVisible();
expect(screen.getByText(/see gallery/i)).toBeVisible();
expect(screen.getByText(/see more collections/i)).toBeVisible();
});

it("should open the NFTs gallery", async () => {
Expand All @@ -36,10 +36,10 @@ describe("displayNftCollection", () => {
});

await waitFor(() => expect(screen.getByText(/momentum/i)).toBeVisible());
await expect(screen.getByText(/receive nft/i)).toBeVisible();
await expect(screen.getByText(/see gallery/i)).toBeVisible();
expect(screen.getByText(/receive nft/i)).toBeVisible();
expect(screen.getByText(/see gallery/i)).toBeVisible();
await user.click(screen.getByText(/see gallery/i));
await expect(screen.getByText(/all nft/i)).toBeVisible();
expect(screen.getByText(/all nft/i)).toBeVisible();
});

it("should open the corresponding NFTs collection and the correct detail drawer", async () => {
Expand All @@ -65,10 +65,10 @@ describe("displayNftCollection", () => {

// Open external viewer
await user.click(screen.getByTestId("external-viewer-button"));
await expect(screen.getByText(/open in opensea.io/i)).toBeVisible();
expect(screen.getByText(/open in opensea.io/i)).toBeVisible();

// Close drawer
await waitFor(() => user.click(screen.getByTestId("drawer-close-button")));
await user.click(screen.getByTestId("drawer-close-button"));
await waitFor(() => expect(screen.queryByTestId("side-drawer-container")).toBeNull());
});

Expand All @@ -80,7 +80,7 @@ describe("displayNftCollection", () => {
initialRoute: `/`,
});

await expect(screen.getByText(/receive nft/i)).toBeVisible();
await expect(screen.getByText(/learn more/i)).toBeVisible();
expect(screen.getByText(/receive nft/i)).toBeVisible();
expect(screen.getByText(/learn more/i)).toBeVisible();
});
});
5 changes: 5 additions & 0 deletions apps/ledger-live-desktop/src/renderer/actions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,8 @@ export const setHasSeenOrdinalsDiscoveryDrawer = (payload: boolean) => ({
type: "SET_HAS_SEEN_ORDINALS_DISCOVERY_DRAWER",
payload,
});

export const setHasProtectedOrdinalsAssets = (payload: boolean) => ({
type: "SET_HAS_PROTECTED_ORDINALS_ASSETS",
payload,
});
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ function AccountRow(props: Props) {
color="palette.text.shade60"
/>
) : null}
{!isDisabled && !isReadonly && <CheckBox disabled isChecked={isChecked || !!isDisabled} />}
{!isDisabled && !isReadonly && (
<CheckBox
data-testid="accountRow-checkbox"
disabled
isChecked={isChecked || !!isDisabled}
/>
)}
</AccountRowContainer>
);
}
Expand Down
6 changes: 4 additions & 2 deletions apps/ledger-live-desktop/src/renderer/hooks/useDeeplinking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useStorylyContext } from "~/storyly/StorylyProvider";
import { useNavigateToPostOnboardingHubCallback } from "~/renderer/components/PostOnboardingHub/logic/useNavigateToPostOnboardingHubCallback";
import { usePostOnboardingDeeplinkHandler } from "@ledgerhq/live-common/postOnboarding/hooks/index";
import { setDrawerVisibility as setLedgerSyncDrawerVisibility } from "../actions/walletSync";
import { WC_ID } from "@ledgerhq/live-common/wallet-api/constants";

const getAccountsOrSubAccountsByCurrency = (
currency: CryptoOrTokenCurrency,
Expand Down Expand Up @@ -315,8 +316,9 @@ export function useDeepLinkHandler() {
}
break;
case "wc": {
const wcPathname = `/platform/${WC_ID}`;
// Only prevent requests if already on the wallet connect live-app
if (location.pathname === "/platform/ledger-wallet-connect") {
if (location.pathname === wcPathname) {
try {
// Prevent a request from updating the live-app url and reloading it
if (!query.uri || new URL(query.uri).searchParams.get("requestId")) {
Expand All @@ -327,7 +329,7 @@ export function useDeepLinkHandler() {
}
}
setTrackingSource("deeplink");
navigate("/platform/ledger-wallet-connect", query);
navigate(wcPathname, query);

break;
}
Expand Down
Loading

0 comments on commit ef8ddbc

Please sign in to comment.