chore: removed code

This commit is contained in:
Fredrik Burmester
2025-02-17 14:19:29 +01:00
parent 9ca0f04278
commit 8924dd2ce8
3 changed files with 0 additions and 57 deletions

View File

@@ -25,14 +25,6 @@ function downloadHLSAsset(
HlsDownloaderModule.downloadHLSAsset(id, url, metadata);
}
/**
* Checks for existing downloads.
* Returns an array of downloads with additional fields:
*/
async function checkForExistingDownloads(): Promise<DownloadInfo[]> {
return HlsDownloaderModule.checkForExistingDownloads();
}
/**
* Cancels an ongoing download.
* @param id - The unique identifier for the download.
@@ -105,7 +97,6 @@ function useDownloadError(): string | null {
export {
downloadHLSAsset,
checkForExistingDownloads,
useDownloadError,
useDownloadProgress,
addCompleteListener,

View File

@@ -144,30 +144,6 @@ public class HlsDownloaderModule: Module {
}
}
Function("checkForExistingDownloads") {
() -> [[String: Any]] in
var downloads: [[String: Any]] = []
for (id, pair) in self.activeDownloads {
let task = pair.task
let delegate = pair.delegate
let metadata = pair.metadata
let startTime = pair.startTime
let downloaded = delegate.downloadedSeconds
let total = delegate.totalSeconds
let progress = total > 0 ? downloaded / total : 0
downloads.append([
"id": delegate.providedId.isEmpty ? String(id) : delegate.providedId,
"progress": progress,
"secondsDownloaded": downloaded,
"secondsTotal": total,
"state": self.mappedState(for: task),
"metadata": metadata,
"startTime": startTime,
])
}
return downloads
}
Function("cancelDownload") { (providedId: String) -> Void in
guard
let entry = self.activeDownloads.first(where: { $0.value.delegate.providedId == providedId }

View File

@@ -3,7 +3,6 @@ import {
addCompleteListener,
addErrorListener,
addProgressListener,
checkForExistingDownloads,
downloadHLSAsset,
cancelDownload,
} from "@/modules/hls-downloader";
@@ -145,29 +144,6 @@ export const NativeDownloadProvider: React.FC<{
});
useEffect(() => {
// const initializeDownloads = async () => {
// const hlsDownloads = await checkForExistingDownloads();
// const hlsDownloadStates = hlsDownloads.reduce(
// (acc, download) => ({
// ...acc,
// [download.id]: {
// id: download.id,
// progress: download.progress,
// state: download.state,
// secondsDownloaded: download.secondsDownloaded,
// secondsTotal: download.secondsTotal,
// metadata: download.metadata,
// startTime: download?.startTime,
// },
// }),
// {}
// );
// setDownloads({ ...hlsDownloadStates });
// };
// initializeDownloads();
const progressListener = addProgressListener((download) => {
if (!download.metadata) throw new Error("No metadata found in download");