Skip to content

Commit

Permalink
Merge pull request #8503 from LedgerHQ/feat/protect-3455-remove-ff
Browse files Browse the repository at this point in the history
[PROTECT-3455] Remove feature_recover_upsell_redirection feature flag from codebase
  • Loading branch information
jiyuzhuang authored Nov 29, 2024
2 parents 90b2950 + 322fd58 commit f15fdd3
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 646 deletions.
8 changes: 8 additions & 0 deletions .changeset/shaggy-days-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@ledgerhq/types-live": patch
"ledger-live-desktop": patch
"live-mobile": patch
"@ledgerhq/live-common": patch
---

Remove `feature_recover_upsell_redirection` feature flag and unused components

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { setDrawer } from "~/renderer/drawers/Provider";
import LockedDeviceDrawer from "./LockedDeviceDrawer";
import { LockedDeviceError } from "@ledgerhq/errors";
import { useRecoverRestoreOnboarding } from "~/renderer/hooks/useRecoverRestoreOnboarding";
import BackupStep from "./BackupStep";

const READY_REDIRECT_DELAY_MS = 2000;
const POLLING_PERIOD_MS = 1000;
Expand Down Expand Up @@ -117,8 +116,6 @@ const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = ({
const [seedPathStatus, setSeedPathStatus] = useState<SeedPathStatus>("choice_new_or_restore");

const servicesConfig = useFeature("protectServicesDesktop");
const recoverUpsellRedirection = useFeature("recoverUpsellRedirection");
const hasBackupStep = !recoverUpsellRedirection?.enabled;

const recoverRestoreStaxPath = useCustomPath(servicesConfig, "restore", "lld-onboarding-24");

Expand Down Expand Up @@ -192,22 +189,6 @@ const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = ({
</>
),
},
...(hasBackupStep
? [
{
key: StepKey.Backup,
status: "inactive" as StepStatus,
title: t("syncOnboarding.manual.backup.title"),
titleCompleted: t("syncOnboarding.manual.backup.title"),
renderBody: () => (
<BackupStep
device={device}
onPressKeepManualBackup={() => setStepKey(StepKey.Apps)}
/>
),
},
]
: []),
{
key: StepKey.Apps,
status: "inactive",
Expand Down Expand Up @@ -237,7 +218,6 @@ const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = ({
[
t,
deviceName,
hasBackupStep,
hasAppLoader,
productName,
device,
Expand Down Expand Up @@ -359,24 +339,16 @@ const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = ({
// When the device is seeded, there are 2 cases before triggering the application install step:
// - the user came to the sync onboarding with an non-seeded device and did a full onboarding: onboarding flag `Ready`
// - the user came to the sync onboarding with an already seeded device: onboarding flag `WelcomeScreen1`
if (deviceOnboardingState?.isOnboarded && !seededDeviceHandled.current) {
if (deviceOnboardingState?.currentOnboardingStep === DeviceOnboardingStep.Ready) {
// device was just seeded
setStepKey(hasBackupStep ? StepKey.Backup : StepKey.Apps);
seededDeviceHandled.current = true;
return;
} else if (
deviceOnboardingState?.currentOnboardingStep === DeviceOnboardingStep.WelcomeScreen1
) {
// device was already seeded, switch to the apps step
if (hasBackupStep) {
__DEV__ ? setStepKey(StepKey.Backup) : setStepKey(StepKey.Apps); // for ease of testing in dev mode without having to reset the device
} else {
setStepKey(StepKey.Apps);
}
seededDeviceHandled.current = true;
return;
}
if (
deviceOnboardingState?.isOnboarded &&
!seededDeviceHandled.current &&
[DeviceOnboardingStep.Ready, DeviceOnboardingStep.WelcomeScreen1].includes(
deviceOnboardingState.currentOnboardingStep,
)
) {
setStepKey(StepKey.Apps);
seededDeviceHandled.current = true;
return;
}

// case DeviceOnboardingStep.SafetyWarning not handled so the previous step (new seed, restore, recover) is kept
Expand Down Expand Up @@ -427,7 +399,7 @@ const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = ({
default:
break;
}
}, [deviceOnboardingState, hasBackupStep, notifySyncOnboardingShouldReset]);
}, [deviceOnboardingState, notifySyncOnboardingShouldReset]);

// When the user gets close to the seed generation step, sets the lost synchronization delay
// and timers to a higher value. It avoids having a warning message while the connection is lost
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import { useSelector } from "react-redux";
import { shouldRedirectToPostOnboardingOrRecoverUpsell } from "@ledgerhq/live-common/postOnboarding/logic/shouldRedirectToPostOnboardingOrRecoverUpsell";
import { DeviceModelId } from "@ledgerhq/types-devices";
Expand All @@ -17,12 +16,10 @@ export function useShouldRedirect(): {
} {
const hasBeenUpsoldRecover = useSelector(hasBeenUpsoldRecoverSelector);
const hasRedirectedToPostOnboarding = useSelector(hasBeenRedirectedToPostOnboardingSelector);
const recoverUpsellRedirection = useFeature("recoverUpsellRedirection");
const lastOnboardedDevice = useSelector(lastOnboardedDeviceSelector);
return shouldRedirectToPostOnboardingOrRecoverUpsell({
hasBeenUpsoldRecover,
hasRedirectedToPostOnboarding,
upsellForTouchScreenDevices: Boolean(recoverUpsellRedirection?.enabled),
lastConnectedDevice: lastOnboardedDevice,
supportedDeviceModels: [
DeviceModelId.nanoSP,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFeature } from "@ledgerhq/live-common/featureFlags/index";
import { useSelector } from "react-redux";
import {
hasBeenRedirectedToPostOnboardingSelector,
Expand All @@ -17,12 +16,10 @@ export function useShouldRedirect(): {
} {
const hasBeenUpsoldRecover = useSelector(hasBeenUpsoldProtectSelector);
const hasRedirectedToPostOnboarding = useSelector(hasBeenRedirectedToPostOnboardingSelector);
const recoverUpsellRedirection = useFeature("recoverUpsellRedirection");
const lastConnectedDevice = useSelector(lastConnectedDeviceSelector);
return shouldRedirectToPostOnboardingOrRecoverUpsell({
hasBeenUpsoldRecover,
hasRedirectedToPostOnboarding,
upsellForTouchScreenDevices: Boolean(recoverUpsellRedirection?.enabled),
lastConnectedDevice,
supportedDeviceModels: [DeviceModelId.nanoX, DeviceModelId.stax, DeviceModelId.europa],
});
Expand Down
Loading

0 comments on commit f15fdd3

Please sign in to comment.