Skip to content

Commit c30ad40

Browse files
committed
change the utils file
1 parent 5dbab96 commit c30ad40

3 files changed

Lines changed: 16 additions & 18 deletions

File tree

src/libs/IOUUtils.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import Onyx from 'react-native-onyx';
2-
import type {NullishDeep, OnyxEntry} from 'react-native-onyx';
32
import type {ValueOf} from 'type-fest';
43
import type {IOUAction, IOUType} from '@src/CONST';
54
import CONST from '@src/CONST';
65
import ONYXKEYS from '@src/ONYXKEYS';
76
import ROUTES from '@src/ROUTES';
8-
import type {OnyxInputOrEntry, PersonalDetails, Report, Transaction} from '@src/types/onyx';
7+
import type {OnyxInputOrEntry, PersonalDetails, Report} from '@src/types/onyx';
98
import type {Attendee} from '@src/types/onyx/IOU';
10-
import {getMoneyRequestParticipantsFromReport} from './actions/IOU';
119
import type {IOURequestType} from './actions/IOU';
1210
import {getCurrencyUnit} from './CurrencyUtils';
1311
import DateUtils from './DateUtils';
@@ -218,19 +216,6 @@ function shouldStartLocationPermissionFlow() {
218216
);
219217
}
220218

221-
function setMultipleMoneyRequestParticipantsFromReport(transactionIDs: string[], reportValue: OnyxEntry<Report>) {
222-
const participants = getMoneyRequestParticipantsFromReport(reportValue);
223-
const updatedTransactions: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${string}`, NullishDeep<Transaction>> = {};
224-
transactionIDs.forEach((transactionID) => {
225-
updatedTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`] = {
226-
participants,
227-
participantsAutoAssigned: true,
228-
};
229-
});
230-
// eslint-disable-next-line rulesdir/prefer-actions-set-data
231-
return Onyx.mergeCollection(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, updatedTransactions);
232-
}
233-
234219
export {
235220
calculateAmount,
236221
insertTagIntoTransactionTagsString,
@@ -243,5 +228,4 @@ export {
243228
formatCurrentUserToAttendee,
244229
shouldStartLocationPermissionFlow,
245230
navigateToParticipantPage,
246-
setMultipleMoneyRequestParticipantsFromReport,
247231
};

src/libs/actions/IOU.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11188,6 +11188,18 @@ function updateLastLocationPermissionPrompt() {
1118811188
Onyx.set(ONYXKEYS.NVP_LAST_LOCATION_PERMISSION_PROMPT, new Date().toISOString());
1118911189
}
1119011190

11191+
function setMultipleMoneyRequestParticipantsFromReport(transactionIDs: string[], reportValue: OnyxEntry<Report>) {
11192+
const participants = getMoneyRequestParticipantsFromReport(reportValue);
11193+
const updatedTransactions: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${string}`, NullishDeep<OnyxTypes.Transaction>> = {};
11194+
transactionIDs.forEach((transactionID) => {
11195+
updatedTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`] = {
11196+
participants,
11197+
participantsAutoAssigned: true,
11198+
};
11199+
});
11200+
return Onyx.mergeCollection(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, updatedTransactions);
11201+
}
11202+
1119111203
/** Instead of merging the duplicates, it updates the transaction we want to keep and puts the others on hold without deleting them */
1119211204
function resolveDuplicates(params: MergeDuplicatesParams) {
1119311205
if (!params.transactionID) {
@@ -11892,6 +11904,7 @@ export {
1189211904
setMoneyRequestParticipantsFromReport,
1189311905
getMoneyRequestParticipantsFromReport,
1189411906
setMoneyRequestPendingFields,
11907+
setMultipleMoneyRequestParticipantsFromReport,
1189511908
setMoneyRequestReceipt,
1189611909
setMoneyRequestTag,
1189711910
setMoneyRequestTaxAmount,

src/pages/iou/request/step/IOURequestStepScan/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {dismissProductTraining} from '@libs/actions/Welcome';
3939
import {isMobile, isMobileWebKit} from '@libs/Browser';
4040
import {base64ToFile, isLocalFile as isLocalFileFileUtils} from '@libs/fileDownload/FileUtils';
4141
import getCurrentPosition from '@libs/getCurrentPosition';
42-
import {navigateToParticipantPage, setMultipleMoneyRequestParticipantsFromReport, shouldStartLocationPermissionFlow} from '@libs/IOUUtils';
42+
import {navigateToParticipantPage, shouldStartLocationPermissionFlow} from '@libs/IOUUtils';
4343
import Log from '@libs/Log';
4444
import Navigation from '@libs/Navigation/Navigation';
4545
import {getManagerMcTestParticipant, getParticipantsOption, getReportOption} from '@libs/OptionsListUtils';
@@ -61,6 +61,7 @@ import {
6161
setMoneyRequestParticipants,
6262
setMoneyRequestParticipantsFromReport,
6363
setMoneyRequestReceipt,
64+
setMultipleMoneyRequestParticipantsFromReport,
6465
startSplitBill,
6566
trackExpense,
6667
updateLastLocationPermissionPrompt,

0 commit comments

Comments
 (0)