This commit is contained in:
Fredrik Burmester
2025-02-15 23:03:14 +01:00
parent ca726e0ca5
commit ca48af26d5
2 changed files with 8 additions and 5 deletions

View File

@@ -25,6 +25,8 @@ export type OnProgressEventPayload = BaseEventPayload & {
export type OnErrorEventPayload = BaseEventPayload & {
error: string;
errorCode: number;
errorDomain: string;
};
export type OnCompleteEventPayload = BaseEventPayload & {

View File

@@ -118,16 +118,17 @@ export const NativeDownloadProvider: React.FC<{
console.log("Original download location:", payload.location);
try {
// Get the download info from our state
const downloadInfo = downloads[payload.id];
if (downloadInfo?.metadata?.Name) {
if (payload?.metadata?.Name) {
const newLocation = await persistDownloadedFile(
payload.location,
downloadInfo.metadata.Name
payload.metadata.Name
);
console.log("File successfully persisted to:", newLocation);
} else {
console.log("No filename in metadata, using original location");
console.log(
"No filename in metadata, using original location",
payload
);
}
} catch (error) {
console.error("Failed to persist file:", error);