Skip to content

Commit

Permalink
feat(PROTECT-3040): capture device model id in recover (#6760)
Browse files Browse the repository at this point in the history
  • Loading branch information
cksanders committed Apr 26, 2024
1 parent 966e718 commit 987feb2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/wet-wombats-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": patch
"ledger-live-mobile": patch
---

Ensure we send the device model id to recover webview
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ const BackupBody: React.FC<ChoiceBodyProps> = ({ isOpened }) => {

const servicesConfig = useFeature("protectServicesDesktop");

const recoverActivatePath =
useCustomPath(servicesConfig, "activate", "lld-stax-onboarding") || "";
const recoverActivatePath = useCustomPath(servicesConfig, "activate", "lld-onboarding-24") || "";

const navigateToRecover = useCallback(() => {
console.log("recoverActivatePath", recoverActivatePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { saveSettings } from "~/renderer/actions/settings";
import { useDispatch, useSelector } from "react-redux";
import { useLocation } from "react-router-dom";
import { hasCompletedOnboardingSelector } from "~/renderer/reducers/settings";
import { useCustomPath } from "@ledgerhq/live-common/hooks/recoverFeatureFlag";

const ONBOARDED_VIA_RECOVER_RESTORE_USER_PREFIX = "ONBOARDED_VIA_RECOVER_RESTORE_USER_";

Expand All @@ -16,8 +15,6 @@ export const useRecoverRestoreOnboarding = (seedPathStatus?: string) => {
const recoverServices = useFeature("protectServicesDesktop");
const recoverStoreId = recoverServices?.params?.protectId ?? "";
const hasCompletedOnboarding = useSelector(hasCompletedOnboardingSelector);
const recoverRestoreStaxPath = useCustomPath(recoverServices, "restore", "lld-onboarding-24");

const [onboardedViaRecoverRestore, setOnboardedViaRecoverRestore] = useState<boolean>();

const confirmRecoverOnboardingStatus = useCallback(async () => {
Expand All @@ -41,8 +38,7 @@ export const useRecoverRestoreOnboarding = (seedPathStatus?: string) => {
const userIsOnboardingOrSettingUp =
pathname.includes("onboarding") || pathname.includes("settings");

const syncOnboardingFromRestoreStax =
seedPathStatus === "recover_seed" && recoverRestoreStaxPath;
const syncOnboardingFromRestoreStax = seedPathStatus === "recover_seed";

if (
(!userIsOnboardingOrSettingUp || syncOnboardingFromRestoreStax) &&
Expand Down
12 changes: 11 additions & 1 deletion apps/ledger-live-desktop/src/renderer/screens/recover/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,21 @@ export default function RecoverPlayer({
lang: locale,
availableOnDesktop,
deviceId: state?.deviceId,
deviceModelId: device?.modelId,
currency,
...params,
...queryParams,
}),
[availableOnDesktop, locale, params, queryParams, state?.deviceId, currency, theme],
[
theme,
locale,
availableOnDesktop,
device?.modelId,
state?.deviceId,
currency,
params,
queryParams,
],
);

return manifest ? (
Expand Down
1 change: 1 addition & 0 deletions apps/ledger-live-mobile/src/screens/Protect/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function RecoverPlayer({ navigation, route }: Props) {
lang: locale,
currency,
deviceId: device?.deviceId,
deviceModelId: device?.modelId,
...params,
}}
/>
Expand Down

0 comments on commit 987feb2

Please sign in to comment.