Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import AttachmentView from '@components/Attachments/AttachmentView';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import {ShowContextMenuContext, showContextMenuForReport} from '@components/ShowContextMenuContext';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -28,6 +29,7 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP
const sourceID = (source.match(CONST.REGEX.ATTACHMENT_ID) ?? [])[1];

const [download] = useOnyx(`${ONYXKEYS.COLLECTION.DOWNLOAD}${sourceID}`, {canBeMissing: true});
const {translate} = useLocalize();

const {isOffline} = useNetwork();
const styles = useThemeStyles();
Expand All @@ -44,7 +46,7 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP
return;
}
setDownload(sourceID, true);
fileDownload(sourceURLWithAuth, displayName, '', isMobileSafari()).then(() => setDownload(sourceID, false));
fileDownload(translate, sourceURLWithAuth, displayName, '', isMobileSafari()).then(() => setDownload(sourceID, false));
}}
onPressIn={onPressIn}
onPressOut={onPressOut}
Expand Down
4 changes: 2 additions & 2 deletions src/components/AttachmentPicker/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function AttachmentPicker({
if (response.errorCode) {
switch (response.errorCode) {
case 'permission':
showCameraPermissionsAlert();
showCameraPermissionsAlert(translate);
return resolve();
default:
showGeneralAlert();
Expand Down Expand Up @@ -242,7 +242,7 @@ function AttachmentPicker({
}
});
}),
[fileLimit, showGeneralAlert, type],
[fileLimit, showGeneralAlert, translate, type],
);
/**
* Launch the DocumentPicker. Results are in the same format as ImagePicker
Expand Down
2 changes: 1 addition & 1 deletion src/components/DotIndicatorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function DotIndicatorMessage({messages = {}, style, type, textStyles, dismissErr
if (href.endsWith('retry')) {
handleRetryPress(receiptError, dismissError, setShouldShowErrorModal);
} else if (href.endsWith('download')) {
fileDownload(receiptError.source, receiptError.filename).finally(() => dismissError());
fileDownload(translate, receiptError.source, receiptError.filename).finally(() => dismissError());
}
};

Expand Down
16 changes: 10 additions & 6 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -782,9 +782,13 @@ function MoneyReportHeader({
setOfflineModalVisible(true);
return;
}
exportReportToCSV({reportID: moneyRequestReport.reportID, transactionIDList: transactionIDs}, () => {
setDownloadErrorModalVisible(true);
});
exportReportToCSV(
{reportID: moneyRequestReport.reportID, transactionIDList: transactionIDs},
() => {
setDownloadErrorModalVisible(true);
},
translate,
);
},
},
[CONST.REPORT.EXPORT_OPTIONS.EXPORT_TO_INTEGRATION]: {
Expand Down Expand Up @@ -1423,9 +1427,9 @@ function MoneyReportHeader({
if (!hasFinishedPDFDownload || !canTriggerAutomaticPDFDownload.current) {
return;
}
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '');
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '', translate);
canTriggerAutomaticPDFDownload.current = false;
}, [hasFinishedPDFDownload, reportPDFFilename, moneyRequestReport?.reportName]);
}, [hasFinishedPDFDownload, reportPDFFilename, moneyRequestReport?.reportName, translate]);

const shouldShowBackButton = shouldDisplayBackButton || shouldUseNarrowLayout;

Expand Down Expand Up @@ -1734,7 +1738,7 @@ function MoneyReportHeader({
if (!hasFinishedPDFDownload) {
setIsPDFModalVisible(false);
} else {
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '');
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '', translate);
}
}}
text={hasFinishedPDFDownload ? translate('common.download') : translate('common.cancel')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function QRShareWithDownload({ref, ...props}: QRShareWithDownloadProps) {
ref,
() => ({
download: () =>
qrCodeScreenshotRef.current?.capture?.().then((uri) => fileDownload(uri, getQrCodeFileName(props.title ?? 'QRCode'), translate('fileDownload.success.qrMessage'))),
qrCodeScreenshotRef.current?.capture?.().then((uri) => fileDownload(translate, uri, getQrCodeFileName(props.title ?? 'QRCode'), translate('fileDownload.success.qrMessage'))),
}),
[props.title, translate],
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/QRShare/QRShareWithDownload/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {useImperativeHandle, useRef} from 'react';
import getQrCodeFileName from '@components/QRShare/getQrCodeDownloadFileName';
import type {QRShareHandle} from '@components/QRShare/types';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import fileDownload from '@libs/fileDownload';
import QRShare from '..';
Expand All @@ -9,6 +10,7 @@ import type {QRShareWithDownloadProps} from './types';
function QRShareWithDownload({ref, ...props}: QRShareWithDownloadProps) {
const {isOffline} = useNetwork();
const qrShareRef = useRef<QRShareHandle>(null);
const {translate} = useLocalize();

useImperativeHandle(
ref,
Expand All @@ -22,10 +24,10 @@ function QRShareWithDownload({ref, ...props}: QRShareWithDownloadProps) {
return;
}

svg.toDataURL((dataURL) => resolve(fileDownload(dataURL, getQrCodeFileName(props.title ?? 'QRCode'))));
svg.toDataURL((dataURL) => resolve(fileDownload(translate, dataURL, getQrCodeFileName(props.title ?? 'QRCode'))));
}),
}),
[props.title],
[props.title, translate],
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function VideoPopoverMenuContextProvider({children}: ChildrenProps) {
if (typeof source === 'number' || !source) {
return;
}
fileDownload(addEncryptedAuthTokenToURL(source));
}, [source]);
fileDownload(translate, addEncryptedAuthTokenToURL(source));
}, [source, translate]);

const menuItems = useMemo(() => {
const items: PopoverMenuItem[] = [];
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useFilesValidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ function useFilesValidation(onFilesValidated: (files: FileObject[], dataTransfer
if (!fileError) {
return '';
}
const prompt = getFileValidationErrorText(fileError, {fileType: invalidFileExtension}, isValidatingReceipts === true).reason;
const prompt = getFileValidationErrorText(translate, fileError, {fileType: invalidFileExtension}, isValidatingReceipts === true).reason;
if (fileError === CONST.FILE_VALIDATION_ERRORS.WRONG_FILE_TYPE_MULTIPLE || fileError === CONST.FILE_VALIDATION_ERRORS.WRONG_FILE_TYPE) {
return (
<Text>
Expand All @@ -401,7 +401,7 @@ function useFilesValidation(onFilesValidated: (files: FileObject[], dataTransfer

const ErrorModal = (
<ConfirmModal
title={getFileValidationErrorText(fileError, {fileType: invalidFileExtension}, isValidatingReceipts === true).title}
title={getFileValidationErrorText(translate, fileError, {fileType: invalidFileExtension}, isValidatingReceipts === true).title}
onConfirm={onConfirmError}
onCancel={hideModalAndReset}
isVisible={isErrorModalVisible}
Expand Down
11 changes: 8 additions & 3 deletions src/hooks/useSelectedTransactionsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@

const {translate} = useLocalize();
const [isDeleteModalVisible, setIsDeleteModalVisible] = useState(false);
// eslint-disable-next-line @typescript-eslint/no-deprecated
const isTrackExpenseThread = isTrackExpenseReport(report);
const isInvoice = isInvoiceReport(report);

Expand Down Expand Up @@ -247,9 +248,13 @@
onExportOffline?.();
return;
}
exportReportToCSV({reportID: report.reportID, transactionIDList: selectedTransactionIDs}, () => {
onExportFailed?.();
});
exportReportToCSV(
{reportID: report.reportID, transactionIDList: selectedTransactionIDs},
() => {
onExportFailed?.();
},
translate,
);
clearSelectedTransactions(true);
},
},
Expand Down Expand Up @@ -361,7 +366,7 @@
});
}
return options;
}, [

Check warning on line 369 in src/hooks/useSelectedTransactionsActions.ts

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useMemo has a missing dependency: 'session.email'. Either include it or remove the dependency array

Check warning on line 369 in src/hooks/useSelectedTransactionsActions.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useMemo has a missing dependency: 'session.email'. Either include it or remove the dependency array
selectedTransactionIDs,
report,
selectedTransactionsList,
Expand Down
5 changes: 3 additions & 2 deletions src/libs/actions/Policy/Category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import lodashCloneDeep from 'lodash/cloneDeep';
import type {OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {PartialDeep} from 'type-fest';
import type {LocalizedTranslate} from '@components/LocaleContextProvider';
import type PolicyData from '@hooks/usePolicyData/types';
import * as API from '@libs/API';
import type {
Expand Down Expand Up @@ -1235,7 +1236,7 @@ function setPolicyCustomUnitDefaultCategory(policyID: string, customUnitID: stri
API.write(WRITE_COMMANDS.SET_CUSTOM_UNIT_DEFAULT_CATEGORY, params, {optimisticData, successData, failureData});
}

function downloadCategoriesCSV(policyID: string, onDownloadFailed: () => void) {
function downloadCategoriesCSV(policyID: string, onDownloadFailed: () => void, translate: LocalizedTranslate) {
const finalParameters = enhanceParameters(WRITE_COMMANDS.EXPORT_CATEGORIES_CSV, {
policyID,
});
Expand All @@ -1247,7 +1248,7 @@ function downloadCategoriesCSV(policyID: string, onDownloadFailed: () => void) {
formData.append(key, String(value));
}

fileDownload(ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_CATEGORIES_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
fileDownload(translate, ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_CATEGORIES_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
}

function setWorkspaceCategoryDescriptionHint(policyID: string, categoryName: string, commentHint: string, policyCategories: PolicyCategories = {}) {
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/Policy/Member.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {OnyxCollection, OnyxCollectionInputValue, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {LocaleContextProps} from '@components/LocaleContextProvider';
import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleContextProvider';
import * as API from '@libs/API';
import type {
AddMembersToWorkspaceParams,
Expand Down Expand Up @@ -49,7 +49,7 @@
};

const allPolicies: OnyxCollection<Policy> = {};
Onyx.connect({

Check warning on line 52 in src/libs/actions/Policy/Member.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
callback: (val, key) => {
if (!key) {
Expand All @@ -65,14 +65,14 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 68 in src/libs/actions/Policy/Member.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => (allReportActions = actions),
});

let policyOwnershipChecks: Record<string, PolicyOwnershipChangeChecks>;
Onyx.connect({

Check warning on line 75 in src/libs/actions/Policy/Member.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.POLICY_OWNERSHIP_CHANGE_CHECKS,
callback: (value) => {
policyOwnershipChecks = value ?? {};
Expand Down Expand Up @@ -1275,7 +1275,7 @@
API.write(WRITE_COMMANDS.DECLINE_JOIN_REQUEST, parameters, {optimisticData, failureData, successData});
}

function downloadMembersCSV(policyID: string, onDownloadFailed: () => void) {
function downloadMembersCSV(policyID: string, onDownloadFailed: () => void, translate: LocalizedTranslate) {
const finalParameters = enhanceParameters(WRITE_COMMANDS.EXPORT_MEMBERS_CSV, {
policyID,
});
Expand All @@ -1287,7 +1287,7 @@
formData.append(key, String(value));
}

fileDownload(ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_MEMBERS_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
fileDownload(translate, ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_MEMBERS_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
}

function clearInviteDraft(policyID: string) {
Expand Down
5 changes: 3 additions & 2 deletions src/libs/actions/Policy/PerDiem.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import lodashDeepClone from 'lodash/cloneDeep';
import type {NullishDeep} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {LocalizedTranslate} from '@components/LocaleContextProvider';
import * as API from '@libs/API';
import {READ_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import {getCommandURL} from '@libs/ApiUtils';
Expand Down Expand Up @@ -173,7 +174,7 @@ function importPerDiemRates(policyID: string, customUnitID: string, rates: Rate[
API.write(WRITE_COMMANDS.IMPORT_PER_DIEM_RATES, parameters, onyxData);
}

function downloadPerDiemCSV(policyID: string, onDownloadFailed: () => void) {
function downloadPerDiemCSV(policyID: string, onDownloadFailed: () => void, translate: LocalizedTranslate) {
const finalParameters = enhanceParameters(WRITE_COMMANDS.EXPORT_PER_DIEM_CSV, {
policyID,
});
Expand All @@ -185,7 +186,7 @@ function downloadPerDiemCSV(policyID: string, onDownloadFailed: () => void) {
formData.append(key, String(value));
}

fileDownload(getCommandURL({command: WRITE_COMMANDS.EXPORT_PER_DIEM_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
fileDownload(translate, getCommandURL({command: WRITE_COMMANDS.EXPORT_PER_DIEM_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
}

function clearPolicyPerDiemRatesErrorFields(policyID: string, customUnitID: string, updatedErrorFields: ErrorFields) {
Expand Down
9 changes: 5 additions & 4 deletions src/libs/actions/Policy/Tag.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import lodashCloneDeep from 'lodash/cloneDeep';
import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {LocalizedTranslate} from '@components/LocaleContextProvider';
import type PolicyData from '@hooks/usePolicyData/types';
import * as API from '@libs/API';
import type {
Expand Down Expand Up @@ -36,7 +37,7 @@
import type {OnyxData} from '@src/types/onyx/Request';

let allPolicyTags: OnyxCollection<PolicyTagLists> = {};
Onyx.connect({

Check warning on line 40 in src/libs/actions/Policy/Tag.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_TAGS,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1234,7 +1235,7 @@
API.write(WRITE_COMMANDS.SET_POLICY_TAG_APPROVER, parameters, onyxData);
}

function downloadTagsCSV(policyID: string, onDownloadFailed: () => void) {
function downloadTagsCSV(policyID: string, onDownloadFailed: () => void, translate: LocalizedTranslate) {
const finalParameters = enhanceParameters(WRITE_COMMANDS.EXPORT_TAGS_CSV, {
policyID,
});
Expand All @@ -1245,10 +1246,10 @@
formData.append(key, String(value));
}

fileDownload(ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_TAGS_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
fileDownload(translate, ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_TAGS_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
}

function downloadMultiLevelTagsCSV(policyID: string, onDownloadFailed: () => void, hasDependentTags: boolean) {
function downloadMultiLevelTagsCSV(policyID: string, onDownloadFailed: () => void, hasDependentTags: boolean, translate: LocalizedTranslate) {
const command = hasDependentTags ? WRITE_COMMANDS.EXPORT_MULTI_LEVEL_DEPENDENT_TAGS_CSV : WRITE_COMMANDS.EXPORT_MULTI_LEVEL_INDEPENDENT_TAGS_CSV;

const finalParameters = enhanceParameters(command, {
Expand All @@ -1261,7 +1262,7 @@
formData.append(key, String(value));
}

fileDownload(ApiUtils.getCommandURL({command}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
fileDownload(translate, ApiUtils.getCommandURL({command}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
}

function getPolicyTagsData(policyID: string | undefined) {
Expand Down
10 changes: 5 additions & 5 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Onyx from 'react-native-onyx';
import type {PartialDeep, ValueOf} from 'type-fest';
import type {Emoji} from '@assets/emojis/types';
import type {LocaleContextProps} from '@components/LocaleContextProvider';
import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleContextProvider';
import * as ActiveClientManager from '@libs/ActiveClientManager';
import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL';
import * as API from '@libs/API';
Expand Down Expand Up @@ -276,7 +276,7 @@
let currentUserAccountID = -1;
let currentUserEmail: string | undefined;

Onyx.connect({

Check warning on line 279 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -289,7 +289,7 @@
},
});

Onyx.connect({

Check warning on line 292 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => (conciergeReportID = value),
});
Expand All @@ -297,7 +297,7 @@
// map of reportID to all reportActions for that report
const allReportActions: OnyxCollection<ReportActions> = {};

Onyx.connect({

Check warning on line 300 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
callback: (actions, key) => {
if (!key || !actions) {
Expand All @@ -309,14 +309,14 @@
});

let allTransactionViolations: OnyxCollection<TransactionViolations> = {};
Onyx.connect({

Check warning on line 312 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => (allTransactionViolations = value),
});

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 319 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -4848,7 +4848,7 @@
API.write(WRITE_COMMANDS.MARK_AS_EXPORTED, params, {optimisticData, successData, failureData});
}

function exportReportToCSV({reportID, transactionIDList}: ExportReportCSVParams, onDownloadFailed: () => void) {
function exportReportToCSV({reportID, transactionIDList}: ExportReportCSVParams, onDownloadFailed: () => void, translate: LocalizedTranslate) {
let reportIDParam = reportID;
const allReportTransactions = getReportTransactions(reportID).filter((transaction) => transaction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);
const allTransactionIDs = allReportTransactions.map((transaction) => transaction.transactionID);
Expand All @@ -4869,7 +4869,7 @@
}
}

fileDownload(ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_REPORT_TO_CSV}), 'Expensify.csv', '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
fileDownload(translate, ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_REPORT_TO_CSV}), 'Expensify.csv', '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
}

function exportReportToPDF({reportID}: ExportReportPDFParams) {
Expand All @@ -4895,14 +4895,14 @@
API.write(WRITE_COMMANDS.EXPORT_REPORT_TO_PDF, params, {optimisticData, failureData});
}

function downloadReportPDF(fileName: string, reportName: string) {
function downloadReportPDF(fileName: string, reportName: string, translate: LocalizedTranslate) {
const baseURL = addTrailingForwardSlash(getOldDotURLFromEnvironment(environment));
const downloadFileName = `${reportName}.pdf`;
setDownload(fileName, true);
const pdfURL = `${baseURL}secure?secureType=pdfreport&filename=${encodeURIComponent(fileName)}&downloadName=${encodeURIComponent(downloadFileName)}&email=${encodeURIComponent(
currentUserEmail ?? '',
)}`;
fileDownload(addEncryptedAuthTokenToURL(pdfURL, true), downloadFileName, '', Browser.isMobileSafari()).then(() => setDownload(fileName, false));
fileDownload(translate, addEncryptedAuthTokenToURL(pdfURL, true), downloadFileName, '', Browser.isMobileSafari()).then(() => setDownload(fileName, false));
}

function setDeleteTransactionNavigateBackUrl(url: string) {
Expand Down
Loading
Loading