Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js #35161

Closed
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
37 changes: 27 additions & 10 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,17 @@ const ROUTES = {
getRoute: (threadReportID: string, field: ValueOf<typeof CONST.EDIT_REQUEST_FIELD>) => `r/${threadReportID}/edit/${field}` as const,
},
EDIT_CURRENCY_REQUEST: {
route: 'r/:threadReportID/edit/currency',
getRoute: (threadReportID: string, currency: string, backTo: string) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}` as const,
route: 'r/:action/:iouType/:transactionID/:threadReportID/:reportID/currency/:pageIndex',
getRoute: (
action: ValueOf<typeof CONST.IOU.ACTION>,
iouType: ValueOf<typeof CONST.IOU.TYPE>,
transactionID: string,
reportID: string,
threadReportID: string,
pageIndex: string,
currency: string,
backTo: string,
) => `r/${action}/${iouType}/${transactionID}/${threadReportID}/${reportID}/currency/${pageIndex}?backTo=${backTo}&currency=${currency}` as const,
},
EDIT_REPORT_FIELD_REQUEST: {
route: 'r/:reportID/edit/policyField/:policyID/:fieldID',
Expand Down Expand Up @@ -228,9 +237,17 @@ const ROUTES = {
getRoute: (reportID: string, reportActionID: string, field: ValueOf<typeof CONST.EDIT_REQUEST_FIELD>) => `r/${reportID}/split/${reportActionID}/edit/${field}` as const,
},
EDIT_SPLIT_BILL_CURRENCY: {
route: 'r/:reportID/split/:reportActionID/edit/currency',
getRoute: (reportID: string, reportActionID: string, currency: string, backTo: string) =>
`r/${reportID}/split/${reportActionID}/edit/currency?currency=${currency}&backTo=${backTo}` as const,
route: 'r/:action/:iouType/:transactionID/:reportID/:reportActionID/currency/:pageIndex',
getRoute: (
action: ValueOf<typeof CONST.IOU.ACTION>,
iouType: ValueOf<typeof CONST.IOU.TYPE>,
transactionID: string,
reportID: string,
reportActionID: string,
pageIndex: string,
currency: string,
backTo: string,
) => `r/${action}/${iouType}/${transactionID}/${reportID}/${reportActionID}/currency/${pageIndex}?backTo=${backTo}&currency=${currency}` as const,
},
TASK_TITLE: {
route: 'r/:reportID/title',
Expand Down Expand Up @@ -267,8 +284,8 @@ const ROUTES = {
getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}` as const,
},
MONEY_REQUEST_AMOUNT: {
route: ':iouType/new/amount/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/amount/${reportID}` as const,
route: ':iouType/new/amount/:reportID/:transactionID?',
getRoute: (iouType: string, reportID = '', transactionID = '') => `${iouType}/new/amount/${reportID}/${transactionID}` as const,
},
MONEY_REQUEST_PARTICIPANTS: {
route: ':iouType/new/participants/:reportID?',
Expand Down Expand Up @@ -334,9 +351,9 @@ const ROUTES = {
getUrlWithBackToParam(`create/${iouType}/category/${transactionID}/${reportID}`, backTo),
},
MONEY_REQUEST_STEP_CURRENCY: {
route: 'create/:iouType/currency/:transactionID/:reportID/:pageIndex?',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, pageIndex = '', backTo = '') =>
getUrlWithBackToParam(`create/${iouType}/currency/${transactionID}/${reportID}/${pageIndex}`, backTo),
route: ':action/:iouType/currency/:transactionID/:reportID/:pageIndex?',
getRoute: (action: ValueOf<typeof CONST.IOU.ACTION>, iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, pageIndex = '', backTo = '') =>
getUrlWithBackToParam(`${action}/${iouType}/currency/${transactionID}/${reportID}/${pageIndex}`, backTo),
},
MONEY_REQUEST_STEP_DATE: {
route: ':action/:iouType/date/:transactionID/:reportID',
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ function MoneyRequestConfirmationList(props) {
Navigation.navigate(ROUTES.EDIT_SPLIT_BILL.getRoute(props.reportID, props.reportActionID, CONST.EDIT_REQUEST_FIELD.AMOUNT));
return;
}
Navigation.navigate(ROUTES.MONEY_REQUEST_AMOUNT.getRoute(props.iouType, props.reportID));
Navigation.navigate(ROUTES.MONEY_REQUEST_AMOUNT.getRoute(props.iouType, props.reportID, transaction.transactionID));
}}
style={[styles.moneyRequestMenuItem, styles.mt2]}
titleStyle={styles.moneyRequestConfirmationAmount}
Expand Down
5 changes: 2 additions & 3 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
[SCREENS.MONEY_REQUEST.AMOUNT]: () => require('../../../pages/iou/steps/NewRequestAmountPage').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.PARTICIPANTS]: () => require('../../../pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.CONFIRMATION]: () => require('../../../pages/iou/steps/MoneyRequestConfirmPage').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.CATEGORY]: () => require('../../../pages/iou/MoneyRequestCategoryPage').default as React.ComponentType,
[SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../pages/AddPersonalBankAccountPage').default as React.ComponentType,
[SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType,
Expand All @@ -111,7 +110,7 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
const SplitDetailsModalStackNavigator = createModalStackNavigator<SplitDetailsNavigatorParamList>({
[SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../pages/iou/SplitBillDetailsPage').default as React.ComponentType,
[SCREENS.SPLIT_DETAILS.EDIT_REQUEST]: () => require('../../../pages/EditSplitBillPage').default as React.ComponentType,
[SCREENS.SPLIT_DETAILS.EDIT_CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default as React.ComponentType,
[SCREENS.SPLIT_DETAILS.EDIT_CURRENCY]: () => require('../../../pages/iou/request/step/IOURequestStepCurrency').default as React.ComponentType,
});

const DetailsModalStackNavigator = createModalStackNavigator<DetailsNavigatorParamList>({
Expand Down Expand Up @@ -276,7 +275,7 @@ const FlagCommentStackNavigator = createModalStackNavigator<FlagCommentNavigator

const EditRequestStackNavigator = createModalStackNavigator<EditRequestNavigatorParamList>({
[SCREENS.EDIT_REQUEST.ROOT]: () => require('../../../pages/EditRequestPage').default as React.ComponentType,
[SCREENS.EDIT_REQUEST.CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default as React.ComponentType,
[SCREENS.EDIT_REQUEST.CURRENCY]: () => require('../../../pages/iou/request/step/IOURequestStepCurrency').default as React.ComponentType,
[SCREENS.EDIT_REQUEST.REPORT_FIELD]: () => require('../../../pages/EditReportFieldPage').default as React.ComponentType,
});

Expand Down
11 changes: 10 additions & 1 deletion src/pages/EditRequestAmountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import Navigation from '@libs/Navigation/Navigation';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import MoneyRequestAmountForm from './iou/steps/MoneyRequestAmountForm';

const propTypes = {
Expand Down Expand Up @@ -40,14 +42,21 @@ function EditRequestAmountPage({defaultAmount, defaultCurrency, onNavigateToCurr
}, []),
);

const navigateBack = () => {
Navigation.goBack(ROUTES.HOME);
};

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableKeyboardAvoidingView={false}
shouldEnableMinHeight={DeviceCapabilities.canUseTouchScreen()}
testID={EditRequestAmountPage.displayName}
>
<HeaderWithBackButton title={translate('iou.amount')} />
<HeaderWithBackButton
title={translate('iou.amount')}
onBackButtonPress={navigateBack}
/>
<MoneyRequestAmountForm
currency={defaultCurrency}
amount={defaultAmount}
Expand Down
13 changes: 12 additions & 1 deletion src/pages/EditRequestPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,18 @@ function EditRequestPage({report, route, policy, policyCategories, policyTags, p
onSubmit={saveAmountAndCurrency}
onNavigateToCurrency={() => {
const activeRoute = encodeURIComponent(Navigation.getActiveRouteWithoutParams());
Navigation.navigate(ROUTES.EDIT_CURRENCY_REQUEST.getRoute(report.reportID, defaultCurrency, activeRoute));
Navigation.navigate(
ROUTES.EDIT_CURRENCY_REQUEST.getRoute(
CONST.IOU.ACTION.EDIT,
CONST.IOU.TYPE.REQUEST,
transaction.transactionID,
report.reportID,
report.reportID,
'edit',
defaultCurrency,
activeRoute,
),
);
}}
/>
);
Expand Down
13 changes: 12 additions & 1 deletion src/pages/EditSplitBillPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,18 @@ function EditSplitBillPage({route, transaction, draftTransaction, report}: EditS
}}
onNavigateToCurrency={() => {
const activeRoute = encodeURIComponent(Navigation.getActiveRouteWithoutParams());
Navigation.navigate(ROUTES.EDIT_SPLIT_BILL_CURRENCY.getRoute(reportID, reportActionID, defaultCurrency, activeRoute));
Navigation.navigate(
ROUTES.EDIT_SPLIT_BILL_CURRENCY.getRoute(
CONST.IOU.ACTION.EDIT,
CONST.IOU.TYPE.SPLIT,
transaction?.transactionID ?? CONST.IOU.OPTIMISTIC_TRANSACTION_ID,
reportID,
reportActionID,
'edit',
defaultCurrency,
activeRoute,
),
);
}}
/>
);
Expand Down
198 changes: 0 additions & 198 deletions src/pages/iou/IOUCurrencySelection.js

This file was deleted.

4 changes: 3 additions & 1 deletion src/pages/iou/request/step/IOURequestStepAmount.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ function IOURequestStepAmount({
};

const navigateToCurrencySelectionPage = () => {
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CURRENCY.getRoute(iouType, transactionID, reportID, backTo ? 'confirm' : '', Navigation.getActiveRouteWithoutParams()));
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_CURRENCY.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backTo ? 'confirm' : '', Navigation.getActiveRouteWithoutParams()),
);
};

/**
Expand Down
Loading
Loading