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

Bring back send money option for newDot #28321

Merged
merged 12 commits into from
Oct 10, 2023
4 changes: 3 additions & 1 deletion src/components/ReportWelcomeText.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ function ReportWelcomeText(props) {
))}
</Text>
)}
{moneyRequestOptions.includes(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST) && <Text>{props.translate('reportActionsView.usePlusButton')}</Text>}
{(moneyRequestOptions.includes(CONST.IOU.MONEY_REQUEST_TYPE.SEND) || moneyRequestOptions.includes(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST)) && (
<Text>{props.translate('reportActionsView.usePlusButton')}</Text>
)}
</Text>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export default {
chatWithAccountManager: 'Chat with your account manager here',
sayHello: 'Say hello!',
welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`,
usePlusButton: '\n\nYou can also use the + button below to request money or assign a task!',
usePlusButton: '\n\nYou can also use the + button below to send or request money or assign a task!',
techievivek marked this conversation as resolved.
Show resolved Hide resolved
},
reportAction: {
asCopilot: 'as copilot for',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ export default {
chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí',
sayHello: '¡Saluda!',
welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`,
usePlusButton: '\n\n¡También puedes usar el botón + de abajo para pedir dinero o asignar una tarea!',
usePlusButton: '\n\n¡También puedes usar el botón + de abajo para enviar o pedir dinero o asignar una tarea!',
},
reportAction: {
asCopilot: 'como copiloto de',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function isIOUReportPendingCurrencyConversion(iouReport: Report): boolean {
* Checks if the iou type is one of request, send, or split.
*/
function isValidMoneyRequestType(iouType: string): boolean {
const moneyRequestType: string[] = [CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, CONST.IOU.MONEY_REQUEST_TYPE.SPLIT];
const moneyRequestType: string[] = [CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, CONST.IOU.MONEY_REQUEST_TYPE.SPLIT, CONST.IOU.MONEY_REQUEST_TYPE.SEND];
return moneyRequestType.includes(iouType);
}

Expand Down
7 changes: 2 additions & 5 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ function canUseDefaultRooms(betas: Beta[]): boolean {
return betas?.includes(CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas);
}

/**
* IOU Send feature is temporarily disabled.
*/
function canUseIOUSend(): boolean {
return false;
function canUseIOUSend(betas: Beta[]): boolean {
return betas?.includes(CONST.BETAS.IOU_SEND) || canUseAllBetas(betas);
techievivek marked this conversation as resolved.
Show resolved Hide resolved
}

function canUseWallet(betas: Beta[]): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) {
ref={(el) => (optionsSelectorRef.current = el)}
participants={iou.participants}
onAddParticipants={IOU.setMoneyRequestParticipants}
navigateToRequest={(option) => navigateToRequestStep(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, option)}
navigateToRequest={(option) => navigateToRequestStep(iouType.current, option)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this be different based on who is looking at the iou?

For instance, if I try to send you money will this be a MONEY_REQUEST_TYPE.REQUEST for you and a MONEY_REQUEST_TYPE.SEND for me?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is part of the flow when a user taps on the send money button on either global create or on a DM. So it solely depends on the option you have selected in the beginning. So if a userA started the flow then it will always be a Send request for them and this page doesn't actually come into the picture for userB.

For instance, if I try to send you money will this be a MONEY_REQUEST_TYPE.REQUEST for you and a MONEY_REQUEST_TYPE.SEND for me?

I think we figure this out by the accountID and managerID, manager seems to be the payer and accountID is the payee.

Screenshot 2023-10-05 at 11 56 47 PM

navigateToSplit={() => navigateToSplitStep(CONST.IOU.MONEY_REQUEST_TYPE.SPLIT)}
safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle}
iouType={iouType.current}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/IOUUtilsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ describe('isValidMoneyRequestType', () => {
test('Return true for valid iou type', () => {
expect(IOUUtils.isValidMoneyRequestType('request')).toBe(true);
expect(IOUUtils.isValidMoneyRequestType('split')).toBe(true);
expect(IOUUtils.isValidMoneyRequestType('send')).toBe(true);
});

test('Return false for invalid iou type', () => {
expect(IOUUtils.isValidMoneyRequestType('send')).toBe(false);
expect(IOUUtils.isValidMoneyRequestType('money')).toBe(false);
});
});
Loading