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
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ const SETTINGS_TO_RHP: Partial<Record<keyof SettingsSplitNavigatorParamList, str
SCREENS.SETTINGS.PROFILE.ADDRESS,
SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY,
SCREENS.SETTINGS.SHARE_CODE,
SCREENS.SETTINGS.EXIT_SURVEY.REASON,
SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE,
SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM,
],
[SCREENS.SETTINGS.PREFERENCES.ROOT]: [
SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE,
Expand Down Expand Up @@ -63,7 +60,7 @@ const SETTINGS_TO_RHP: Partial<Record<keyof SettingsSplitNavigatorParamList, str
],
[SCREENS.SETTINGS.ABOUT]: [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS],
[SCREENS.SETTINGS.SAVE_THE_WORLD]: [SCREENS.I_KNOW_A_TEACHER, SCREENS.INTRO_SCHOOL_PRINCIPAL, SCREENS.I_AM_A_TEACHER],
[SCREENS.SETTINGS.TROUBLESHOOT]: [SCREENS.SETTINGS.CONSOLE],
[SCREENS.SETTINGS.TROUBLESHOOT]: [SCREENS.SETTINGS.CONSOLE, SCREENS.SETTINGS.EXIT_SURVEY.REASON, SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE, SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM],
[SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: [
SCREENS.SETTINGS.SUBSCRIPTION.ADD_PAYMENT_CARD,
SCREENS.SETTINGS.SUBSCRIPTION.SIZE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@ import SCREENS from '@src/SCREENS';
* 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.
*/
const SIDEBAR_TO_RHP: Partial<Record<SplitNavigatorSidebarScreen, string[]>> = {
[SCREENS.SETTINGS.ROOT]: [
SCREENS.SETTINGS.SHARE_CODE,
SCREENS.SETTINGS.PROFILE.STATUS,
SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE,
SCREENS.SETTINGS.EXIT_SURVEY.REASON,
SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE,
SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM,
],
[SCREENS.SETTINGS.ROOT]: [SCREENS.SETTINGS.SHARE_CODE, SCREENS.SETTINGS.PROFILE.STATUS, SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE],
};

export default SIDEBAR_TO_RHP;
27 changes: 1 addition & 26 deletions src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import useSingleExecution from '@hooks/useSingleExecution';
import useSubscriptionPlan from '@hooks/useSubscriptionPlan';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {resetExitSurveyForm} from '@libs/actions/ExitSurvey';
import {checkIfFeedConnectionIsBroken} from '@libs/CardUtils';
import {convertToDisplayString} from '@libs/CurrencyUtils';
import useIsSidebarRouteActive from '@libs/Navigation/helpers/useIsSidebarRouteActive';
Expand All @@ -40,12 +39,10 @@ import type SETTINGS_TO_RHP from '@navigation/linkingConfig/RELATIONS/SETTINGS_T
import {showContextMenu} from '@pages/home/report/ContextMenu/ReportActionContextMenu';
import variables from '@styles/variables';
import {confirmReadyToOpenApp} from '@userActions/App';
import closeReactNativeApp from '@userActions/HybridApp';
import {openExternalLink} from '@userActions/Link';
import {hasPaymentMethodError} from '@userActions/PaymentMethods';
import {isSupportAuthToken, signOutAndRedirectToSignIn} from '@userActions/Session';
import {openInitialSettingsPage} from '@userActions/Wallet';
import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import NAVIGATORS from '@src/NAVIGATORS';
Expand Down Expand Up @@ -90,7 +87,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST, {canBeMissing: true});
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS, {canBeMissing: true});
const [vacationDelegate] = useOnyx(ONYXKEYS.NVP_PRIVATE_VACATION_DELEGATE, {canBeMissing: true});
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true});
const [allCards] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
Expand Down Expand Up @@ -122,8 +118,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr

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

const shouldOpenSurveyReasonPage = tryNewDot?.classicRedirect?.dismissed === false;

useEffect(() => {
openInitialSettingsPage();
confirmReadyToOpenApp();
Expand Down Expand Up @@ -246,25 +240,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
openExternalLink(CONST.WHATS_NEW_URL);
},
},
{
translationKey: 'exitSurvey.goToExpensifyClassic',
icon: Expensicons.ExpensifyLogoNew,
...(CONFIG.IS_HYBRID_APP
? {
action: () => closeReactNativeApp({shouldSignOut: false, 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.about',
icon: Expensicons.Info,
Expand Down Expand Up @@ -292,7 +267,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
},
],
};
}, [styles.pt4, shouldOpenSurveyReasonPage, signOut]);
}, [styles.pt4, signOut]);

/**
* Return JSX.Element with menu items
Expand Down
26 changes: 25 additions & 1 deletion src/pages/settings/Troubleshoot/TroubleshootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
import {resetExitSurveyForm} from '@libs/actions/ExitSurvey';
import closeReactNativeApp from '@libs/actions/HybridApp';
import {setShouldMaskOnyxState} from '@libs/actions/MaskOnyx';
import ExportOnyxState from '@libs/ExportOnyxState';
import Navigation from '@libs/Navigation/Navigation';
import {clearOnyxAndResetApp} from '@userActions/App';
import CONFIG from '@src/CONFIG';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand All @@ -52,6 +55,8 @@ function TroubleshootPage() {
const [shouldStoreLogs] = useOnyx(ONYXKEYS.SHOULD_STORE_LOGS, {canBeMissing: true});
const [shouldMaskOnyxState = true] = useOnyx(ONYXKEYS.SHOULD_MASK_ONYX_STATE, {canBeMissing: true});
const {resetOptions} = useOptionsList({shouldInitialize: false});
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true});
const shouldOpenSurveyReasonPage = tryNewDot?.classicRedirect?.dismissed === false;
const {setShouldResetSearchQuery} = useSearchContext();
const exportOnyxState = useCallback(() => {
ExportOnyxState.readFromOnyxDatabase().then((value: Record<string, unknown>) => {
Expand All @@ -68,6 +73,25 @@ function TroubleshootPage() {
};

const baseMenuItems: BaseMenuItem[] = [
{
translationKey: 'exitSurvey.goToExpensifyClassic',
icon: Expensicons.ExpensifyLogoNew,
...(CONFIG.IS_HYBRID_APP
? {
action: () => closeReactNativeApp({shouldSignOut: false, 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 @@ -93,7 +117,7 @@ function TroubleshootPage() {
wrapperStyle: [styles.sectionMenuItemTopDescription],
}))
.reverse();
}, [waitForNavigate, exportOnyxState, shouldStoreLogs, translate, styles.sectionMenuItemTopDescription]);
}, [waitForNavigate, exportOnyxState, shouldStoreLogs, translate, styles.sectionMenuItemTopDescription, shouldOpenSurveyReasonPage]);

return (
<ScreenWrapper
Expand Down
Loading