Skip to content

Commit

Permalink
feat(llm): use new recover upsell redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyuzhuang authored and ofreyssinet-ledger committed Oct 29, 2024
1 parent c8e1e81 commit 1befa69
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-rice-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Hide Backup section during onboarding on Flex and Stax
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = (
const { t } = useTranslation();
const dispatchRedux = useDispatch();
const deviceInitialApps = useFeature("deviceInitialApps");
const recoverUpsellRedirection = useFeature("recoverUpsellRedirection");

const productName = getDeviceModel(device.modelId).productName || device.modelId;
const deviceName = device.deviceName || productName;
Expand Down Expand Up @@ -369,17 +370,22 @@ export const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = (
if (deviceOnboardingState?.isOnboarded && !seededDeviceHandled.current) {
if (deviceOnboardingState?.currentOnboardingStep === DeviceOnboardingStep.Ready) {
// device was just seeded
setCompanionStepKey(CompanionStepKey.Backup);
setCompanionStepKey(
recoverUpsellRedirection?.enabled ? CompanionStepKey.Apps : CompanionStepKey.Backup,
);
seededDeviceHandled.current = true;
return;
} else if (
deviceOnboardingState?.currentOnboardingStep === DeviceOnboardingStep.WelcomeScreen1
) {
// switch to the apps step
__DEV__
? setCompanionStepKey(CompanionStepKey.Backup) // for ease of testing in dev mode without having to reset the device
: setCompanionStepKey(CompanionStepKey.Apps);

if (recoverUpsellRedirection?.enabled) {
// switch to the apps step
__DEV__
? setCompanionStepKey(CompanionStepKey.Backup) // for ease of testing in dev mode without having to reset the device
: setCompanionStepKey(CompanionStepKey.Apps);
} else {
setCompanionStepKey(CompanionStepKey.Apps);
}
seededDeviceHandled.current = true;
return;
}
Expand Down Expand Up @@ -433,7 +439,12 @@ export const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = (
default:
break;
}
}, [deviceOnboardingState, notifyEarlySecurityCheckShouldReset, shouldRestoreApps]);
}, [
deviceOnboardingState,
notifyEarlySecurityCheckShouldReset,
recoverUpsellRedirection,
shouldRestoreApps,
]);

// 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 Expand Up @@ -638,17 +649,21 @@ export const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = (
</Flex>
),
},
{
key: CompanionStepKey.Backup,
title: t("syncOnboarding.backup.title"),
doneTitle: t("syncOnboarding.backup.title"),
renderBody: () => (
<BackupStep
device={device}
onPressKeepManualBackup={() => setCompanionStepKey(CompanionStepKey.Apps)}
/>
),
},
...(recoverUpsellRedirection?.enabled
? []
: [
{
key: CompanionStepKey.Backup,
title: t("syncOnboarding.backup.title"),
doneTitle: t("syncOnboarding.backup.title"),
renderBody: () => (
<BackupStep
device={device}
onPressKeepManualBackup={() => setCompanionStepKey(CompanionStepKey.Apps)}
/>
),
},
]),
...(deviceInitialApps?.enabled
? [
{
Expand Down Expand Up @@ -682,13 +697,14 @@ export const SyncOnboardingCompanion: React.FC<SyncOnboardingCompanionProps> = (
[
t,
productName,
seedPathStatus,
recoverUpsellRedirection?.enabled,
deviceInitialApps?.enabled,
device,
seedPathStatus,
shouldRestoreApps,
handleInstallAppsComplete,
initialAppsToInstall,
companionStepKey,
shouldRestoreApps,
],
);

Expand Down

0 comments on commit 1befa69

Please sign in to comment.