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

Fix missing sound when pay invoice #53129

Merged
Merged
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
2 changes: 0 additions & 2 deletions src/components/ProcessMoneyReportHoldMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import Navigation from '@libs/Navigation/Navigation';
import {isLinkedTransactionHeld} from '@libs/ReportActionsUtils';
import playSound, {SOUNDS} from '@libs/Sound';
import * as IOU from '@userActions/IOU';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -75,7 +74,6 @@ function ProcessMoneyReportHoldMenu({
if (startAnimation) {
startAnimation();
}
playSound(SOUNDS.SUCCESS);
IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport, full);
}
onClose();
Expand Down
4 changes: 0 additions & 4 deletions src/components/SettlementButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import useNetwork from '@hooks/useNetwork';
import Navigation from '@libs/Navigation/Navigation';
import getPolicyEmployeeAccountIDs from '@libs/PolicyEmployeeListUtils';
import * as ReportUtils from '@libs/ReportUtils';
import playSound, {SOUNDS} from '@libs/Sound';
import * as SubscriptionUtils from '@libs/SubscriptionUtils';
import * as BankAccounts from '@userActions/BankAccounts';
import * as IOU from '@userActions/IOU';
Expand Down Expand Up @@ -213,9 +212,6 @@ function SettlementButton({
return;
}

if (!ReportUtils.hasHeldExpenses(iouReport?.reportID)) {
playSound(SOUNDS.SUCCESS);
}
onPress(iouPaymentType);
};

Expand Down
3 changes: 3 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import * as ReportConnection from '@libs/ReportConnection';
import type {OptimisticChatReport, OptimisticCreatedReportAction, OptimisticIOUReportAction, TransactionDetails} from '@libs/ReportUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as SessionUtils from '@libs/SessionUtils';
import playSound, {SOUNDS} from '@libs/Sound';
import * as SubscriptionUtils from '@libs/SubscriptionUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import {getCurrency, getTransaction} from '@libs/TransactionUtils';
Expand Down Expand Up @@ -7496,6 +7497,7 @@ function payMoneyRequest(paymentType: PaymentMethodType, chatReport: OnyxTypes.R
// Expensify Wallets.
const apiCommand = paymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY ? WRITE_COMMANDS.PAY_MONEY_REQUEST_WITH_WALLET : WRITE_COMMANDS.PAY_MONEY_REQUEST;

playSound(SOUNDS.SUCCESS);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will change the behaviour now and play the sound if a report with held expenses is paid, right? Or is the behaviour same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the current behavior, right? I'm guessing you're talking about this one: #50572

On that issue, the sounds played when the confirm modal shows. So, it's fixed by preventing the sound from playing when the confirm modal shows and instead playing it when the user selects either of the options. This PR doesn't change that behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok thanks!

API.write(apiCommand, params, {optimisticData, successData, failureData});
}

Expand Down Expand Up @@ -7544,6 +7546,7 @@ function payInvoice(paymentMethodType: PaymentMethodType, chatReport: OnyxTypes.
};
}

playSound(SOUNDS.SUCCESS);
API.write(WRITE_COMMANDS.PAY_INVOICE, params, {optimisticData, successData, failureData});
}

Expand Down
Loading