Skip to content

Commit 415d5ae

Browse files
authored
Merge pull request Expensify#87741 from huult/83848-migrate-CHANGE_POLICY_EDUCATIONAL
2 parents 0f9bba8 + 2543694 commit 415d5ae

6 files changed

Lines changed: 23 additions & 17 deletions

File tree

src/ROUTES.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ const DYNAMIC_ROUTES = {
111111
path: 'visibility',
112112
entryScreens: [SCREENS.REPORT_SETTINGS.ROOT],
113113
},
114+
CHANGE_POLICY_EDUCATIONAL: {
115+
path: 'change-workspace-educational',
116+
entryScreens: [
117+
SCREENS.REPORT,
118+
SCREENS.RIGHT_MODAL.SEARCH_REPORT,
119+
SCREENS.RIGHT_MODAL.EXPENSE_REPORT,
120+
SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT,
121+
SCREENS.REPORT_DETAILS.ROOT,
122+
SCREENS.REPORT_CHANGE_WORKSPACE.ROOT,
123+
],
124+
},
114125
NETSUITE_AUTO_SYNC: {
115126
path: 'netsuite-autosync',
116127
entryScreens: [SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_ADVANCED, SCREENS.WORKSPACE.ACCOUNTING.CARD_RECONCILIATION],
@@ -3160,12 +3171,6 @@ const ROUTES = {
31603171
route: 'share/submit-details/:reportOrAccountID',
31613172
getRoute: (reportOrAccountID: string) => `share/submit-details/${reportOrAccountID}` as const,
31623173
},
3163-
CHANGE_POLICY_EDUCATIONAL: {
3164-
route: 'change-workspace-educational',
3165-
3166-
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
3167-
getRoute: (backTo?: string) => getUrlWithBackToParam('change-workspace-educational', backTo),
3168-
},
31693174
TRAVEL_MY_TRIPS: {
31703175
route: 'travel',
31713176
getRoute: (policyID?: string) => `travel?${policyID ? `policyID=${policyID}` : ''}` as const,

src/SCREENS.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ const SCREENS = {
927927
DETAILS_ROOT: 'Details_Root',
928928
PROFILE_ROOT: 'Profile_Root',
929929
AUTO_SUBMIT_ROOT: 'AutoSubmit_Modal_Root',
930-
CHANGE_POLICY_EDUCATIONAL_ROOT: 'ChangePolicyEducational_Root',
930+
DYNAMIC_CHANGE_POLICY_EDUCATIONAL_ROOT: 'DynamicChangePolicyEducational_Root',
931931
REPORT_DESCRIPTION_ROOT: 'Report_Description_Root',
932932
CHRONOS_SCHEDULE_OOO_ROOT: 'Chronos_Schedule_OOO_Root',
933933
REPORT_PARTICIPANTS: {

src/libs/Navigation/AppNavigator/Navigators/FeatureTrainingModalNavigator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function FeatureTrainingModalNavigator() {
2121
component={TrackTrainingPage}
2222
/>
2323
<Stack.Screen
24-
name={SCREENS.CHANGE_POLICY_EDUCATIONAL_ROOT}
24+
name={SCREENS.DYNAMIC_CHANGE_POLICY_EDUCATIONAL_ROOT}
2525
component={ChangePolicyEducationalModal}
2626
/>
2727
<Stack.Screen

src/libs/Navigation/linkingConfig/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
4545
exact: true,
4646
},
4747
[SCREENS.AUTO_SUBMIT_ROOT]: ROUTES.AUTO_SUBMIT_MODAL_ROOT,
48-
[SCREENS.CHANGE_POLICY_EDUCATIONAL_ROOT]: ROUTES.CHANGE_POLICY_EDUCATIONAL.route,
48+
[SCREENS.DYNAMIC_CHANGE_POLICY_EDUCATIONAL_ROOT]: DYNAMIC_ROUTES.CHANGE_POLICY_EDUCATIONAL.path,
4949
},
5050
},
5151
[NAVIGATORS.EXPLANATION_MODAL_NAVIGATOR]: {

src/libs/Navigation/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2368,7 +2368,7 @@ type SignInNavigatorParamList = {
23682368
type FeatureTrainingNavigatorParamList = {
23692369
[SCREENS.FEATURE_TRAINING_ROOT]: undefined;
23702370
[SCREENS.AUTO_SUBMIT_ROOT]: undefined;
2371-
[SCREENS.CHANGE_POLICY_EDUCATIONAL_ROOT]: undefined;
2371+
[SCREENS.DYNAMIC_CHANGE_POLICY_EDUCATIONAL_ROOT]: undefined;
23722372
};
23732373

23742374
type ReferralDetailsNavigatorParamList = {

src/libs/actions/Report/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import HttpUtils from '@libs/HttpUtils';
7777
import Log from '@libs/Log';
7878
import {isEmailPublicDomain} from '@libs/LoginUtils';
7979
import {getMovedReportID} from '@libs/ModifiedExpenseMessage';
80+
import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute';
8081
import type {LinkToOptions} from '@libs/Navigation/helpers/linkTo/types';
8182
import Navigation from '@libs/Navigation/Navigation';
8283
import enhanceParameters from '@libs/Network/enhanceParameters';
@@ -193,7 +194,7 @@ import CONFIG from '@src/CONFIG';
193194
import type {OnboardingAccounting} from '@src/CONST';
194195
import CONST from '@src/CONST';
195196
import ONYXKEYS from '@src/ONYXKEYS';
196-
import ROUTES from '@src/ROUTES';
197+
import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES';
197198
import INPUT_IDS from '@src/types/form/NewRoomForm';
198199
import type {
199200
AnyRequest,
@@ -6647,14 +6648,14 @@ function updatePolicyIdForReportAndThreads(
66476648
}
66486649
}
66496650

6650-
function navigateToTrainingModal(isChangePolicyTrainingModalDismissed: boolean, reportID: string) {
6651+
function navigateToTrainingModal(isChangePolicyTrainingModalDismissed: boolean) {
66516652
if (isChangePolicyTrainingModalDismissed) {
66526653
return;
66536654
}
66546655

66556656
// eslint-disable-next-line @typescript-eslint/no-deprecated
66566657
InteractionManager.runAfterInteractions(() => {
6657-
Navigation.navigate(ROUTES.CHANGE_POLICY_EDUCATIONAL.getRoute(ROUTES.REPORT_WITH_ID.getRoute(reportID)));
6658+
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.CHANGE_POLICY_EDUCATIONAL.path));
66586659
});
66596660
}
66606661

@@ -7177,8 +7178,8 @@ function changeReportPolicy(
71777178
API.write(WRITE_COMMANDS.CHANGE_REPORT_POLICY, params, {optimisticData, successData, failureData});
71787179

71797180
// If the dismissedProductTraining.changeReportModal is not set,
7180-
// navigate to CHANGE_POLICY_EDUCATIONAL and a backTo param for the report page.
7181-
navigateToTrainingModal(isChangePolicyTrainingModalDismissed, report.reportID);
7181+
// navigate to the change policy educational modal over the current report.
7182+
navigateToTrainingModal(isChangePolicyTrainingModalDismissed);
71827183
}
71837184

71847185
/**
@@ -7277,8 +7278,8 @@ function changeReportPolicyAndInviteSubmitter({
72777278
API.write(WRITE_COMMANDS.CHANGE_REPORT_POLICY_AND_INVITE_SUBMITTER, params, {optimisticData, successData, failureData});
72787279

72797280
// If the dismissedProductTraining.changeReportModal is not set,
7280-
// navigate to CHANGE_POLICY_EDUCATIONAL and a backTo param for the report page.
7281-
navigateToTrainingModal(isChangePolicyTrainingModalDismissed, report.reportID);
7281+
// navigate to the change policy educational modal over the current report.
7282+
navigateToTrainingModal(isChangePolicyTrainingModalDismissed);
72827283
}
72837284

72847285
/**

0 commit comments

Comments
 (0)