Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions src/pages/settings/Troubleshoot/TroubleshootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,32 @@ function TroubleshootPage() {
});
}, [shouldMaskOnyxState]);

const classicRedirectMenuItem: BaseMenuItem | null = useMemo(() => {
if (tryNewDot?.classicRedirect?.isLockedToNewDot) {
return null;
}

return {
translationKey: 'exitSurvey.goToExpensifyClassic',
icon: Expensicons.ExpensifyLogoNew,
...(CONFIG.IS_HYBRID_APP
? {
action: () => closeReactNativeApp({shouldSetNVP: true}),
}
: {
action() {
resetExitSurveyForm(() => {
if (shouldOpenSurveyReasonPage) {
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON.route);
return;
}
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_CONFIRM.route);
});
},
}),
};
}, [tryNewDot?.classicRedirect?.isLockedToNewDot, shouldOpenSurveyReasonPage]);

const menuItems = useMemo(() => {
const debugConsoleItem: BaseMenuItem = {
translationKey: 'initialSettingsPage.troubleshoot.viewConsole',
Expand All @@ -71,25 +97,6 @@ function TroubleshootPage() {
};

const baseMenuItems: BaseMenuItem[] = [
{
translationKey: 'exitSurvey.goToExpensifyClassic',
icon: Expensicons.ExpensifyLogoNew,
...(CONFIG.IS_HYBRID_APP
? {
action: () => closeReactNativeApp({shouldSetNVP: true}),
}
: {
action() {
resetExitSurveyForm(() => {
if (shouldOpenSurveyReasonPage) {
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON.route);
return;
}
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_CONFIRM.route);
});
},
}),
},
{
translationKey: 'initialSettingsPage.troubleshoot.clearCacheAndRestart',
icon: Expensicons.RotateLeft,
Expand All @@ -106,7 +113,9 @@ function TroubleshootPage() {
baseMenuItems.push(debugConsoleItem);
}

return baseMenuItems
const finalMenuItems = classicRedirectMenuItem ? [classicRedirectMenuItem, ...baseMenuItems] : baseMenuItems;

return finalMenuItems
Comment thread
Eskalifer1 marked this conversation as resolved.
.map((item) => ({
key: item.translationKey,
title: translate(item.translationKey),
Expand All @@ -115,7 +124,7 @@ function TroubleshootPage() {
wrapperStyle: [styles.sectionMenuItemTopDescription],
}))
.reverse();
}, [waitForNavigate, exportOnyxState, shouldStoreLogs, translate, styles.sectionMenuItemTopDescription, shouldOpenSurveyReasonPage]);
}, [waitForNavigate, exportOnyxState, shouldStoreLogs, translate, styles.sectionMenuItemTopDescription, classicRedirectMenuItem]);

return (
<ScreenWrapper
Expand Down
7 changes: 6 additions & 1 deletion src/types/onyx/TryNewDot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
type TryNewDot = {
/**
* This key is mostly used on OldDot. In NewDot, we only use `completedHybridAppOnboarding`.
* This key is mostly used on OldDot. In NewDot, we only use `completedHybridAppOnboarding` and `isLockedToNewDot`.
*/
classicRedirect?: {
/**
Expand All @@ -19,6 +19,11 @@ type TryNewDot = {
* Indicates if explanation modal on NewDot was dismissed.
*/
completedHybridAppOnboarding: boolean;

/**
* Indicates whether the user has access to the OldDot transition.
*/
isLockedToNewDot?: boolean;
};
/**
* This key is added when user is migrated from OldDot to NewDot with nudge migration as part of a cohort.
Expand Down
Loading