From 841be8b8a8628ed13d25356d46028a86206416fa Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 26 Nov 2024 21:47:37 +0800 Subject: [PATCH 1/3] play sound when pay invoice --- src/libs/actions/IOU.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 511a5bf16283..2132a12f4439 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -38,6 +38,7 @@ import * as FileUtils from '@libs/fileDownload/FileUtils'; import GoogleTagManager from '@libs/GoogleTagManager'; import * as IOUUtils from '@libs/IOUUtils'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; +import playSound, {SOUNDS} from '@libs/Sound'; import * as Localize from '@libs/Localize'; import isSearchTopmostCentralPane from '@libs/Navigation/isSearchTopmostCentralPane'; import Navigation from '@libs/Navigation/Navigation'; @@ -7544,6 +7545,7 @@ function payInvoice(paymentMethodType: PaymentMethodType, chatReport: OnyxTypes. }; } + playSound(SOUNDS.SUCCESS); API.write(WRITE_COMMANDS.PAY_INVOICE, params, {optimisticData, successData, failureData}); } From 5d325d80eefff65a72c707d95d4069d7fe178b2f Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 26 Nov 2024 21:48:20 +0800 Subject: [PATCH 2/3] play sound in payMoneyRequest instead --- src/components/ProcessMoneyReportHoldMenu.tsx | 2 -- src/components/SettlementButton/index.tsx | 4 ---- src/libs/actions/IOU.ts | 1 + 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/ProcessMoneyReportHoldMenu.tsx b/src/components/ProcessMoneyReportHoldMenu.tsx index f1a72cc7fb8e..3d6ad9006dc5 100644 --- a/src/components/ProcessMoneyReportHoldMenu.tsx +++ b/src/components/ProcessMoneyReportHoldMenu.tsx @@ -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'; @@ -75,7 +74,6 @@ function ProcessMoneyReportHoldMenu({ if (startAnimation) { startAnimation(); } - playSound(SOUNDS.SUCCESS); IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport, full); } onClose(); diff --git a/src/components/SettlementButton/index.tsx b/src/components/SettlementButton/index.tsx index ed1d8fd73565..001e561e70eb 100644 --- a/src/components/SettlementButton/index.tsx +++ b/src/components/SettlementButton/index.tsx @@ -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'; @@ -213,9 +212,6 @@ function SettlementButton({ return; } - if (!ReportUtils.hasHeldExpenses(iouReport?.reportID)) { - playSound(SOUNDS.SUCCESS); - } onPress(iouPaymentType); }; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 2132a12f4439..bcde74a03f0b 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7497,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); API.write(apiCommand, params, {optimisticData, successData, failureData}); } From 290ef8793570a825afa645886996bf1c829b5f3e Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 26 Nov 2024 21:54:30 +0800 Subject: [PATCH 3/3] prettier --- src/libs/actions/IOU.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index bcde74a03f0b..72f14974e227 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -38,7 +38,6 @@ import * as FileUtils from '@libs/fileDownload/FileUtils'; import GoogleTagManager from '@libs/GoogleTagManager'; import * as IOUUtils from '@libs/IOUUtils'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; -import playSound, {SOUNDS} from '@libs/Sound'; import * as Localize from '@libs/Localize'; import isSearchTopmostCentralPane from '@libs/Navigation/isSearchTopmostCentralPane'; import Navigation from '@libs/Navigation/Navigation'; @@ -53,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';