Skip to content

Commit 8e2ad54

Browse files
authored
Merge pull request Expensify#68468 from Krishna2323/krishna2323/issue/68432
Move "Switch to Expensify Classic" to "Troubleshooting" to make it less prominent to users.
2 parents 32549a3 + 18f47ac commit 8e2ad54

4 files changed

Lines changed: 28 additions & 39 deletions

File tree

src/libs/Navigation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ const SETTINGS_TO_RHP: Partial<Record<keyof SettingsSplitNavigatorParamList, str
2222
SCREENS.SETTINGS.PROFILE.ADDRESS,
2323
SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY,
2424
SCREENS.SETTINGS.SHARE_CODE,
25-
SCREENS.SETTINGS.EXIT_SURVEY.REASON,
26-
SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE,
27-
SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM,
2825
],
2926
[SCREENS.SETTINGS.PREFERENCES.ROOT]: [
3027
SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE,
@@ -63,7 +60,7 @@ const SETTINGS_TO_RHP: Partial<Record<keyof SettingsSplitNavigatorParamList, str
6360
],
6461
[SCREENS.SETTINGS.ABOUT]: [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS],
6562
[SCREENS.SETTINGS.SAVE_THE_WORLD]: [SCREENS.I_KNOW_A_TEACHER, SCREENS.INTRO_SCHOOL_PRINCIPAL, SCREENS.I_AM_A_TEACHER],
66-
[SCREENS.SETTINGS.TROUBLESHOOT]: [SCREENS.SETTINGS.CONSOLE],
63+
[SCREENS.SETTINGS.TROUBLESHOOT]: [SCREENS.SETTINGS.CONSOLE, SCREENS.SETTINGS.EXIT_SURVEY.REASON, SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE, SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM],
6764
[SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: [
6865
SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD,
6966
SCREENS.SETTINGS.SUBSCRIPTION.SIZE,

src/libs/Navigation/linkingConfig/RELATIONS/SIDEBAR_TO_RHP.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ import SCREENS from '@src/SCREENS';
66
* This means that going back from RHP will take the user directly to the sidebar. On wide layout the default central screen will be used to fill the space.
77
*/
88
const SIDEBAR_TO_RHP: Partial<Record<SplitNavigatorSidebarScreen, string[]>> = {
9-
[SCREENS.SETTINGS.ROOT]: [
10-
SCREENS.SETTINGS.SHARE_CODE,
11-
SCREENS.SETTINGS.PROFILE.STATUS,
12-
SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE,
13-
SCREENS.SETTINGS.EXIT_SURVEY.REASON,
14-
SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE,
15-
SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM,
16-
],
9+
[SCREENS.SETTINGS.ROOT]: [SCREENS.SETTINGS.SHARE_CODE, SCREENS.SETTINGS.PROFILE.STATUS, SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE],
1710
};
1811

1912
export default SIDEBAR_TO_RHP;

src/pages/settings/InitialSettingsPage.tsx

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import useSingleExecution from '@hooks/useSingleExecution';
2929
import useSubscriptionPlan from '@hooks/useSubscriptionPlan';
3030
import useTheme from '@hooks/useTheme';
3131
import useThemeStyles from '@hooks/useThemeStyles';
32-
import {resetExitSurveyForm} from '@libs/actions/ExitSurvey';
3332
import {checkIfFeedConnectionIsBroken} from '@libs/CardUtils';
3433
import {convertToDisplayString} from '@libs/CurrencyUtils';
3534
import useIsSidebarRouteActive from '@libs/Navigation/helpers/useIsSidebarRouteActive';
@@ -40,12 +39,10 @@ import type SETTINGS_TO_RHP from '@navigation/linkingConfig/RELATIONS/SETTINGS_T
4039
import {showContextMenu} from '@pages/home/report/ContextMenu/ReportActionContextMenu';
4140
import variables from '@styles/variables';
4241
import {confirmReadyToOpenApp} from '@userActions/App';
43-
import closeReactNativeApp from '@userActions/HybridApp';
4442
import {openExternalLink} from '@userActions/Link';
4543
import {hasPaymentMethodError} from '@userActions/PaymentMethods';
4644
import {isSupportAuthToken, signOutAndRedirectToSignIn} from '@userActions/Session';
4745
import {openInitialSettingsPage} from '@userActions/Wallet';
48-
import CONFIG from '@src/CONFIG';
4946
import CONST from '@src/CONST';
5047
import type {TranslationPaths} from '@src/languages/types';
5148
import NAVIGATORS from '@src/NAVIGATORS';
@@ -90,7 +87,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
9087
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST, {canBeMissing: true});
9188
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS, {canBeMissing: true});
9289
const [vacationDelegate] = useOnyx(ONYXKEYS.NVP_PRIVATE_VACATION_DELEGATE, {canBeMissing: true});
93-
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true});
9490
const [allCards] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
9591
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
9692
const [stripeCustomerId] = useOnyx(ONYXKEYS.NVP_PRIVATE_STRIPE_CUSTOMER_ID, {canBeMissing: true});
@@ -123,8 +119,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
123119

124120
const [shouldShowSignoutConfirmModal, setShouldShowSignoutConfirmModal] = useState(false);
125121

126-
const shouldOpenSurveyReasonPage = tryNewDot?.classicRedirect?.dismissed === false;
127-
128122
useEffect(() => {
129123
openInitialSettingsPage();
130124
confirmReadyToOpenApp();
@@ -247,25 +241,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
247241
openExternalLink(CONST.WHATS_NEW_URL);
248242
},
249243
},
250-
{
251-
translationKey: 'exitSurvey.goToExpensifyClassic',
252-
icon: Expensicons.ExpensifyLogoNew,
253-
...(CONFIG.IS_HYBRID_APP
254-
? {
255-
action: () => closeReactNativeApp({shouldSignOut: false, shouldSetNVP: true}),
256-
}
257-
: {
258-
action() {
259-
resetExitSurveyForm(() => {
260-
if (shouldOpenSurveyReasonPage) {
261-
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON.route);
262-
return;
263-
}
264-
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_CONFIRM.route);
265-
});
266-
},
267-
}),
268-
},
269244
{
270245
translationKey: 'initialSettingsPage.about',
271246
icon: Expensicons.Info,
@@ -293,7 +268,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
293268
},
294269
],
295270
};
296-
}, [styles.pt4, shouldOpenSurveyReasonPage, signOut]);
271+
}, [styles.pt4, signOut]);
297272

298273
/**
299274
* Return JSX.Element with menu items

src/pages/settings/Troubleshoot/TroubleshootPage.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ import useOnyx from '@hooks/useOnyx';
2525
import useResponsiveLayout from '@hooks/useResponsiveLayout';
2626
import useThemeStyles from '@hooks/useThemeStyles';
2727
import useWaitForNavigation from '@hooks/useWaitForNavigation';
28+
import {resetExitSurveyForm} from '@libs/actions/ExitSurvey';
29+
import closeReactNativeApp from '@libs/actions/HybridApp';
2830
import {setShouldMaskOnyxState} from '@libs/actions/MaskOnyx';
2931
import ExportOnyxState from '@libs/ExportOnyxState';
3032
import Navigation from '@libs/Navigation/Navigation';
3133
import {clearOnyxAndResetApp} from '@userActions/App';
34+
import CONFIG from '@src/CONFIG';
3235
import type {TranslationPaths} from '@src/languages/types';
3336
import ONYXKEYS from '@src/ONYXKEYS';
3437
import ROUTES from '@src/ROUTES';
@@ -50,6 +53,8 @@ function TroubleshootPage() {
5053
const [shouldStoreLogs] = useOnyx(ONYXKEYS.SHOULD_STORE_LOGS, {canBeMissing: true});
5154
const [shouldMaskOnyxState = true] = useOnyx(ONYXKEYS.SHOULD_MASK_ONYX_STATE, {canBeMissing: true});
5255
const {resetOptions} = useOptionsList({shouldInitialize: false});
56+
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true});
57+
const shouldOpenSurveyReasonPage = tryNewDot?.classicRedirect?.dismissed === false;
5358
const {setShouldResetSearchQuery} = useSearchContext();
5459
const exportOnyxState = useCallback(() => {
5560
ExportOnyxState.readFromOnyxDatabase().then((value: Record<string, unknown>) => {
@@ -66,6 +71,25 @@ function TroubleshootPage() {
6671
};
6772

6873
const baseMenuItems: BaseMenuItem[] = [
74+
{
75+
translationKey: 'exitSurvey.goToExpensifyClassic',
76+
icon: Expensicons.ExpensifyLogoNew,
77+
...(CONFIG.IS_HYBRID_APP
78+
? {
79+
action: () => closeReactNativeApp({shouldSignOut: false, shouldSetNVP: true}),
80+
}
81+
: {
82+
action() {
83+
resetExitSurveyForm(() => {
84+
if (shouldOpenSurveyReasonPage) {
85+
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON.route);
86+
return;
87+
}
88+
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_CONFIRM.route);
89+
});
90+
},
91+
}),
92+
},
6993
{
7094
translationKey: 'initialSettingsPage.troubleshoot.clearCacheAndRestart',
7195
icon: Expensicons.RotateLeft,
@@ -91,7 +115,7 @@ function TroubleshootPage() {
91115
wrapperStyle: [styles.sectionMenuItemTopDescription],
92116
}))
93117
.reverse();
94-
}, [waitForNavigate, exportOnyxState, shouldStoreLogs, translate, styles.sectionMenuItemTopDescription]);
118+
}, [waitForNavigate, exportOnyxState, shouldStoreLogs, translate, styles.sectionMenuItemTopDescription, shouldOpenSurveyReasonPage]);
95119

96120
return (
97121
<ScreenWrapper

0 commit comments

Comments
 (0)