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 MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js. #35455

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dae08c9
Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 …
Krishna2323 Jan 31, 2024
ff8b9a3
Merge branch 'main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 3, 2024
cdaa1aa
remove redundant code and old component.
Krishna2323 Feb 3, 2024
b915c4e
remove redundant code and comment
Krishna2323 Feb 3, 2024
2c93aef
Merge branch 'main' of https://github.com/Krishna2323/App into krishn…
Krishna2323 Feb 6, 2024
8325c22
Merge branch 'main' of https://github.com/Krishna2323/App into krishn…
Krishna2323 Feb 6, 2024
0824fb9
update startMoneyRequest_temporaryForRefactor to startMoneyRequest.
Krishna2323 Feb 6, 2024
4e69672
remove: unused routes from ROUTES.ts
Krishna2323 Feb 6, 2024
013376d
minor fix.
Krishna2323 Feb 6, 2024
423af4e
updated sendMoney callback dependencies.
Krishna2323 Feb 6, 2024
4bed3d0
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 7, 2024
c6b0ffe
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 9, 2024
4c6f886
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 13, 2024
92789b5
Remove redundant constants for the old screen names.
Krishna2323 Feb 13, 2024
53f913f
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 14, 2024
dfd6b8b
removed MoneyRequest route.
Krishna2323 Feb 14, 2024
53edc67
minor fix.
Krishna2323 Feb 14, 2024
06cc5b4
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 17, 2024
2b53cb3
Merge branch 'main' of https://github.com/Krishna2323/App into krishn…
Krishna2323 Feb 22, 2024
ecefca7
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 22, 2024
8b2a982
minor fic.
Krishna2323 Feb 22, 2024
5bb76c1
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 22, 2024
2e8fc66
Merge branch 'main' of https://github.com/Krishna2323/App into krishn…
Krishna2323 Feb 23, 2024
6bea0f8
Merge branch 'krishna2323/remove/redundant/34613' of https://github.c…
Krishna2323 Feb 23, 2024
34ed2fa
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 24, 2024
59b8d60
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 25, 2024
24fb17b
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Feb 26, 2024
3b9f478
Merge branch 'main' of https://github.com/Krishna2323/App into krishn…
Krishna2323 Mar 3, 2024
a3115ba
fix failing typechecks.
Krishna2323 Mar 3, 2024
3ad7a4f
fix route iou type for send.
Krishna2323 Mar 4, 2024
b1df87f
rename startMoneyRestartMoneyRequestquest_temporaryForRefactor.
Krishna2323 Mar 8, 2024
82327ed
Merge branch 'main' of https://github.com/Krishna2323/App into krishn…
Krishna2323 Mar 8, 2024
2d15cca
minor fix.
Krishna2323 Mar 8, 2024
24c6f46
minor fixes.
Krishna2323 Mar 9, 2024
6ba7f40
Merge branch 'Expensify:main' into krishna2323/remove/redundant/34613
Krishna2323 Mar 12, 2024
6c6ed85
update according to all NAB suggestions.
Krishna2323 Mar 16, 2024
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
7 changes: 0 additions & 7 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,6 @@ const ROUTES = {
route: ':iouType/new/address/:reportID?',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/address/${reportID}` as const,
},
MONEY_REQUEST_DISTANCE_TAB: {
route: ':iouType/new/:reportID?/distance',
getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance` as const,
},
MONEY_REQUEST_MANUAL_TAB: ':iouType/new/:reportID?/manual',
MONEY_REQUEST_SCAN_TAB: ':iouType/new/:reportID?/scan',

Krishna2323 marked this conversation as resolved.
Show resolved Hide resolved
MONEY_REQUEST_CREATE: {
route: 'create/:iouType/start/:transactionID/:reportID',
getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string) => `create/${iouType}/start/${transactionID}/${reportID}` as const,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
// Do not hide fields in case of send money request
const shouldShowAllFields = isDistanceRequest || shouldExpandFields || !shouldShowSmartScanFields || isTypeSend || isEditingSplitBill;

const shouldShowDate = shouldShowSmartScanFields || isDistanceRequest;
const shouldShowMerchant = shouldShowSmartScanFields && !isDistanceRequest;
const shouldShowDate = (shouldShowSmartScanFields || isDistanceRequest) && !isTypeSend;
const shouldShowMerchant = shouldShowSmartScanFields && !isDistanceRequest && !isTypeSend;
Comment on lines +270 to +271
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain why do we have those changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't show date & merchant option when sending.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you share any ref link (for example GH issue/discussion) so I can cross-check? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current send flow also don't allow merchant and date, I just copied this from old component.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Krishna2323 nice. Could you share the link to that code from the old component? Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Krishna2323 in meanwhile, could you fix the TS error? THanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DylanDylann can you pls update here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you quickly check if we need to copy any changes from MoneyRequestConfirmPage => IOURequestStepConfirmation

Yes, we need to do that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoangzinh bump

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Krishna2323 according to his PR here https://github.com/Expensify/App/pull/35461/files#diff-5e4afd2b33b309cd8b0ddee94902568e7abbcf32a83df362df5555767816ac71 It appears that there is no updates from MoneyRequestConfirmPage. So I think we're good to go. What do you think?


// Fetches the first tag list of the policy
const policyTag = PolicyUtils.getTag(policyTags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
[SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require('../../../pages/iou/request/step/IOURequestStepScan').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.STEP_TAG]: () => require('../../../pages/iou/request/step/IOURequestStepTag').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require('../../../pages/iou/request/step/IOURequestStepWaypoint').default as React.ComponentType,
[SCREENS.MONEY_REQUEST.ROOT]: () => require('../../../pages/iou/MoneyRequestSelectorPage').default as React.ComponentType,
[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,
Expand Down
18 changes: 0 additions & 18 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,24 +382,6 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.MONEY_REQUEST.STEP_SCAN]: ROUTES.MONEY_REQUEST_STEP_SCAN.route,
[SCREENS.MONEY_REQUEST.STEP_TAG]: ROUTES.MONEY_REQUEST_STEP_TAG.route,
[SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: ROUTES.MONEY_REQUEST_STEP_WAYPOINT.route,
[SCREENS.MONEY_REQUEST.ROOT]: {
Krishna2323 marked this conversation as resolved.
Show resolved Hide resolved
path: ROUTES.MONEY_REQUEST.route,
exact: true,
screens: {
[SCREENS.MONEY_REQUEST.MANUAL_TAB]: {
path: ROUTES.MONEY_REQUEST_MANUAL_TAB,
exact: true,
},
[SCREENS.MONEY_REQUEST.SCAN_TAB]: {
path: ROUTES.MONEY_REQUEST_SCAN_TAB,
exact: true,
},
[SCREENS.MONEY_REQUEST.DISTANCE_TAB]: {
path: ROUTES.MONEY_REQUEST_DISTANCE_TAB.route,
exact: true,
},
},
},
Krishna2323 marked this conversation as resolved.
Show resolved Hide resolved
[SCREENS.MONEY_REQUEST.AMOUNT]: ROUTES.MONEY_REQUEST_AMOUNT.route,
[SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: ROUTES.MONEY_REQUEST_STEP_TAX_AMOUNT.route,
[SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: ROUTES.MONEY_REQUEST_STEP_TAX_RATE.route,
Expand Down
1 change: 0 additions & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ type RoomInviteNavigatorParamList = {
};

type MoneyRequestNavigatorParamList = {
[SCREENS.MONEY_REQUEST.ROOT]: undefined;
[SCREENS.MONEY_REQUEST.AMOUNT]: undefined;
[SCREENS.MONEY_REQUEST.PARTICIPANTS]: {
iouType: string;
Expand Down
9 changes: 1 addition & 8 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Onyx.connect({
* @param iouRequestType one of manual/scan/distance
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
function startMoneyRequest_temporaryForRefactor(reportID: string, isFromGlobalCreate: boolean, iouRequestType: IOURequestType = CONST.IOU.REQUEST_TYPE.MANUAL) {
function startMoneyRequest(reportID: string, isFromGlobalCreate: boolean, iouRequestType: IOURequestType = CONST.IOU.REQUEST_TYPE.MANUAL) {
// Generate a brand new transactionID
const newTransactionID = CONST.IOU.OPTIMISTIC_TRANSACTION_ID;
// Disabling this line since currentDate can be an empty string
Expand Down Expand Up @@ -3569,12 +3569,6 @@ function setMoneyRequestParticipantsFromReport(transactionID: string, report: On
Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {participants, participantsAutoAssigned: true});
}

/** Initialize money request info and navigate to the MoneyRequest page */
function startMoneyRequest(iouType: string, reportID = '') {
Krishna2323 marked this conversation as resolved.
Show resolved Hide resolved
resetMoneyRequestInfo(`${iouType}${reportID}`);
Navigation.navigate(ROUTES.MONEY_REQUEST.getRoute(iouType, reportID));
}

function setMoneyRequestId(id: string) {
Onyx.merge(ONYXKEYS.IOU, {id});
}
Expand Down Expand Up @@ -3721,7 +3715,6 @@ export {
payMoneyRequest,
sendMoneyWithWallet,
startMoneyRequest,
startMoneyRequest_temporaryForRefactor,
resetMoneyRequestCategory,
resetMoneyRequestCategory_temporaryForRefactor,
resetMoneyRequestInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import * as Browser from '@libs/Browser';
import compose from '@libs/compose';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import * as IOU from '@userActions/IOU';
import * as Report from '@userActions/Report';
import * as Task from '@userActions/Task';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -155,7 +154,7 @@ function AttachmentPickerWithMenuItems({
[CONST.IOU.TYPE.SEND]: {
icon: Expensicons.Send,
text: translate('iou.sendMoney'),
onSelected: () => IOU.startMoneyRequest(CONST.IOU.TYPE.SEND, report.reportID),
onSelected: () => Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.SEND, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, report.reportID)),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import * as App from '@userActions/App';
import * as IOU from '@userActions/IOU';
import * as Policy from '@userActions/Policy';
import * as Task from '@userActions/Task';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -176,7 +175,14 @@ function FloatingActionButtonAndPopover(props) {
{
icon: Expensicons.Send,
text: translate('iou.sendMoney'),
onSelected: () => interceptAnonymousUser(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SEND)),
onSelected: () =>
interceptAnonymousUser(() =>
Navigation.navigate(
// When starting to create a send money request from the global FAB, there is not an existing report yet. A random optimistic reportID is generated and used
// for all of the routes in the creation flow.
ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.SEND, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID()),
),
),
},
...[
{
Expand Down
169 changes: 0 additions & 169 deletions src/pages/iou/MoneyRequestSelectorPage.js

This file was deleted.

40 changes: 22 additions & 18 deletions src/pages/iou/request/IOURequestStartPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function IOURequestStartPage({
if (transaction.reportID === reportID) {
return;
}
IOU.startMoneyRequest_temporaryForRefactor(reportID, isFromGlobalCreate, transactionRequestType.current);
IOU.startMoneyRequest(reportID, isFromGlobalCreate, transactionRequestType.current);
}, [transaction, reportID, iouType, isFromGlobalCreate]);

const isExpenseChat = ReportUtils.isPolicyExpenseChat(report);
Expand All @@ -125,7 +125,7 @@ function IOURequestStartPage({
if (newIouType === previousIOURequestType) {
return;
}
IOU.startMoneyRequest_temporaryForRefactor(reportID, isFromGlobalCreate, newIouType);
IOU.startMoneyRequest(reportID, isFromGlobalCreate, newIouType);
transactionRequestType.current = newIouType;
},
[previousIOURequestType, reportID, isFromGlobalCreate],
Expand Down Expand Up @@ -156,22 +156,26 @@ function IOURequestStartPage({
title={tabTitles[iouType]}
onBackButtonPress={navigateBack}
/>
<OnyxTabNavigator
id={CONST.TAB.IOU_REQUEST_TYPE}
selectedTab={selectedTab || CONST.IOU.REQUEST_TYPE.SCAN}
onTabSelected={resetIOUTypeIfChanged}
tabBar={({state, navigation, position}) => (
<TabSelector
state={state}
navigation={navigation}
position={position}
/>
)}
>
<TopTab.Screen name={CONST.TAB_REQUEST.MANUAL}>{() => <IOURequestStepAmount route={route} />}</TopTab.Screen>
<TopTab.Screen name={CONST.TAB_REQUEST.SCAN}>{() => <IOURequestStepScan route={route} />}</TopTab.Screen>
{shouldDisplayDistanceRequest && <TopTab.Screen name={CONST.TAB_REQUEST.DISTANCE}>{() => <IOURequestStepDistance route={route} />}</TopTab.Screen>}
</OnyxTabNavigator>
{iouType === CONST.IOU.TYPE.REQUEST || iouType === CONST.IOU.TYPE.SPLIT ? (
<OnyxTabNavigator
id={CONST.TAB.IOU_REQUEST_TYPE}
selectedTab={selectedTab || CONST.IOU.REQUEST_TYPE.SCAN}
onTabSelected={resetIOUTypeIfChanged}
tabBar={({state, navigation, position}) => (
<TabSelector
state={state}
navigation={navigation}
position={position}
/>
)}
>
<TopTab.Screen name={CONST.TAB_REQUEST.MANUAL}>{() => <IOURequestStepAmount route={route} />}</TopTab.Screen>
<TopTab.Screen name={CONST.TAB_REQUEST.SCAN}>{() => <IOURequestStepScan route={route} />}</TopTab.Screen>
{shouldDisplayDistanceRequest && <TopTab.Screen name={CONST.TAB_REQUEST.DISTANCE}>{() => <IOURequestStepDistance route={route} />}</TopTab.Screen>}
</OnyxTabNavigator>
) : (
<IOURequestStepAmount route={route} />
)}
</View>
</DragAndDropProvider>
</FullPageNotFoundView>
Expand Down
Loading
Loading