Skip to content

Commit 02e9f44

Browse files
authored
Merge pull request Expensify#76327 from shubham1206agra/refactor-iou-currency-selection
Refactored IOU currency to use modal structure
2 parents b7dddc9 + 0a39d26 commit 02e9f44

12 files changed

Lines changed: 145 additions & 226 deletions

File tree

src/ROUTES.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,12 +1075,6 @@ const ROUTES = {
10751075
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
10761076
getUrlWithBackToParam(`settings/${policyID}/category/${encodeURIComponent(categoryName)}/gl-code` as const, backTo),
10771077
},
1078-
MONEY_REQUEST_STEP_CURRENCY: {
1079-
route: ':action/:iouType/currency/:transactionID/:reportID/:pageIndex?',
1080-
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, pageIndex = '', currency = '', backTo = '') =>
1081-
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
1082-
getUrlWithBackToParam(`${action as string}/${iouType as string}/currency/${transactionID}/${reportID}/${pageIndex}?currency=${currency}`, backTo),
1083-
},
10841078
MONEY_REQUEST_STEP_DATE: {
10851079
route: ':action/:iouType/date/:transactionID/:reportID/:reportActionID?',
10861080
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string | undefined, reportID: string | undefined, backTo = '', reportActionID?: string) => {

src/SCREENS.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ const SCREENS = {
288288
STEP_UPGRADE: 'Money_Request_Step_Upgrade',
289289
STEP_AMOUNT: 'Money_Request_Step_Amount',
290290
STEP_CATEGORY: 'Money_Request_Step_Category',
291-
STEP_CURRENCY: 'Money_Request_Step_Currency',
292291
STEP_DATE: 'Money_Request_Step_Date',
293292
STEP_DESCRIPTION: 'Money_Request_Step_Description',
294293
STEP_DISTANCE: 'Money_Request_Step_Distance',

src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
208208
[SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepTaxAmountPage').default,
209209
[SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepTaxRatePage').default,
210210
[SCREENS.MONEY_REQUEST.STEP_CATEGORY]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepCategory').default,
211-
[SCREENS.MONEY_REQUEST.STEP_CURRENCY]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepCurrency').default,
212211
[SCREENS.MONEY_REQUEST.STEP_DATE]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepDate').default,
213212
[SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepDescription').default,
214213
[SCREENS.MONEY_REQUEST.STEP_DISTANCE]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepDistance').default,

src/libs/Navigation/linkingConfig/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
14121412
[SCREENS.MONEY_REQUEST.STEP_CATEGORY]: ROUTES.MONEY_REQUEST_STEP_CATEGORY.route,
14131413
[SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.route,
14141414
[SCREENS.MONEY_REQUEST.STEP_CONFIRMATION_VERIFY_ACCOUNT]: ROUTES.MONEY_REQUEST_STEP_CONFIRMATION_VERIFY_ACCOUNT.route,
1415-
[SCREENS.MONEY_REQUEST.STEP_CURRENCY]: ROUTES.MONEY_REQUEST_STEP_CURRENCY.route,
14161415
[SCREENS.MONEY_REQUEST.STEP_DATE]: ROUTES.MONEY_REQUEST_STEP_DATE.route,
14171416
[SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: ROUTES.MONEY_REQUEST_STEP_DESCRIPTION.route,
14181417
[SCREENS.MONEY_REQUEST.STEP_DISTANCE]: ROUTES.MONEY_REQUEST_STEP_DISTANCE.route,

src/libs/Navigation/types.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,6 @@ type MoneyRequestNavigatorParamList = {
15671567
reportID: string;
15681568
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
15691569
backTo: Routes;
1570-
currency?: string;
15711570
};
15721571
[SCREENS.MONEY_REQUEST.STEP_TAG]: {
15731572
action: IOUAction;
@@ -1649,7 +1648,6 @@ type MoneyRequestNavigatorParamList = {
16491648
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
16501649
backTo: never;
16511650
action: never;
1652-
currency: never;
16531651
pageIndex?: string;
16541652
backToReport?: string;
16551653
reportActionID?: string;
@@ -1668,7 +1666,6 @@ type MoneyRequestNavigatorParamList = {
16681666
backTo: Routes;
16691667
action: IOUAction;
16701668
pageIndex?: string;
1671-
currency?: string;
16721669
backToReport?: string;
16731670
reportActionID?: string;
16741671
};
@@ -1713,16 +1710,6 @@ type MoneyRequestNavigatorParamList = {
17131710
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
17141711
backTo: Routes;
17151712
};
1716-
[SCREENS.MONEY_REQUEST.STEP_CURRENCY]: {
1717-
action: IOUAction;
1718-
iouType: IOUType;
1719-
transactionID: string;
1720-
reportID: string;
1721-
pageIndex?: string;
1722-
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
1723-
backTo?: Routes;
1724-
currency?: string;
1725-
};
17261713
[SCREENS.MONEY_REQUEST.HOLD]: {
17271714
/** ID of the transaction the page was opened for */
17281715
transactionID: string;
@@ -1834,7 +1821,6 @@ type MoneyRequestNavigatorParamList = {
18341821
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
18351822
backTo: never;
18361823
action: never;
1837-
currency: never;
18381824
pageIndex?: string;
18391825
backToReport?: string;
18401826
reportActionID?: string;

src/pages/iou/request/DistanceRequestStartPage.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,6 @@ function DistanceRequestStartPage({
9292
Navigation.closeRHPFlow();
9393
};
9494

95-
// This useEffect is used to initialize the money request, so that currency will be reset to default currency on page reload.
96-
useEffect(() => {
97-
if (transaction?.amount !== 0) {
98-
return;
99-
}
100-
initMoneyRequest({
101-
reportID,
102-
policy,
103-
isFromGlobalCreate,
104-
currentIouRequestType: transaction?.iouRequestType,
105-
newIouRequestType: transaction?.iouRequestType,
106-
report,
107-
parentReport,
108-
currentDate,
109-
lastSelectedDistanceRates,
110-
currentUserPersonalDetails,
111-
});
112-
// eslint-disable-next-line
113-
}, []);
114-
11595
const resetIOUTypeIfChanged = useCallback(
11696
(newIOUType: IOURequestType) => {
11797
Keyboard.dismiss();

src/pages/iou/request/IOURequestStartPage.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,6 @@ function IOURequestStartPage({
137137
Navigation.closeRHPFlow();
138138
};
139139

140-
// This useEffect is used to initialize the money request, so that currency will be reset to default currency on page reload.
141-
useEffect(() => {
142-
if (transaction?.amount !== 0) {
143-
return;
144-
}
145-
initMoneyRequest({
146-
reportID,
147-
policy,
148-
isFromGlobalCreate,
149-
currentIouRequestType: transaction?.iouRequestType,
150-
newIouRequestType: transaction?.iouRequestType,
151-
report,
152-
parentReport,
153-
currentDate,
154-
lastSelectedDistanceRates,
155-
currentUserPersonalDetails,
156-
});
157-
// eslint-disable-next-line
158-
}, []);
159-
160140
const resetIOUTypeIfChanged = useCallback(
161141
(newIOUType: IOURequestType) => {
162142
Keyboard.dismiss();

0 commit comments

Comments
 (0)