Skip to content

Commit 2d02167

Browse files
committed
Move "Switch to Expensify Classic" to "Troubleshooting" to make it less prominent to users.
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
1 parent 9874e84 commit 2d02167

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 [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
@@ -122,8 +118,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
122118

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

125-
const shouldOpenSurveyReasonPage = tryNewDot?.classicRedirect?.dismissed === false;
126-
127121
useEffect(() => {
128122
openInitialSettingsPage();
129123
confirmReadyToOpenApp();
@@ -246,25 +240,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
246240
openExternalLink(CONST.WHATS_NEW_URL);
247241
},
248242
},
249-
{
250-
translationKey: 'exitSurvey.goToExpensifyClassic',
251-
icon: Expensicons.ExpensifyLogoNew,
252-
...(CONFIG.IS_HYBRID_APP
253-
? {
254-
action: () => closeReactNativeApp({shouldSignOut: false, shouldSetNVP: true}),
255-
}
256-
: {
257-
action() {
258-
resetExitSurveyForm(() => {
259-
if (shouldOpenSurveyReasonPage) {
260-
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON.route);
261-
return;
262-
}
263-
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_CONFIRM.route);
264-
});
265-
},
266-
}),
267-
},
268243
{
269244
translationKey: 'initialSettingsPage.about',
270245
icon: Expensicons.Info,
@@ -292,7 +267,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
292267
},
293268
],
294269
};
295-
}, [styles.pt4, shouldOpenSurveyReasonPage, signOut]);
270+
}, [styles.pt4, signOut]);
296271

297272
/**
298273
* 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
@@ -24,10 +24,13 @@ import useOnyx from '@hooks/useOnyx';
2424
import useResponsiveLayout from '@hooks/useResponsiveLayout';
2525
import useThemeStyles from '@hooks/useThemeStyles';
2626
import useWaitForNavigation from '@hooks/useWaitForNavigation';
27+
import {resetExitSurveyForm} from '@libs/actions/ExitSurvey';
28+
import closeReactNativeApp from '@libs/actions/HybridApp';
2729
import {setShouldMaskOnyxState} from '@libs/actions/MaskOnyx';
2830
import ExportOnyxState from '@libs/ExportOnyxState';
2931
import Navigation from '@libs/Navigation/Navigation';
3032
import {clearOnyxAndResetApp} from '@userActions/App';
33+
import CONFIG from '@src/CONFIG';
3134
import type {TranslationPaths} from '@src/languages/types';
3235
import ONYXKEYS from '@src/ONYXKEYS';
3336
import ROUTES from '@src/ROUTES';
@@ -51,6 +54,8 @@ function TroubleshootPage() {
5154
const [shouldStoreLogs] = useOnyx(ONYXKEYS.SHOULD_STORE_LOGS, {canBeMissing: true});
5255
const [shouldMaskOnyxState = true] = useOnyx(ONYXKEYS.SHOULD_MASK_ONYX_STATE, {canBeMissing: true});
5356
const {resetOptions} = useOptionsList({shouldInitialize: false});
57+
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true});
58+
const shouldOpenSurveyReasonPage = tryNewDot?.classicRedirect?.dismissed === false;
5459

5560
const exportOnyxState = useCallback(() => {
5661
ExportOnyxState.readFromOnyxDatabase().then((value: Record<string, unknown>) => {
@@ -67,6 +72,25 @@ function TroubleshootPage() {
6772
};
6873

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

97121
return (
98122
<ScreenWrapper

0 commit comments

Comments
 (0)