mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
fix: cancel for direct downloads
This commit is contained in:
@@ -23,9 +23,6 @@ import { Button } from "../Button";
|
|||||||
const BackGroundDownloader = !Platform.isTV
|
const BackGroundDownloader = !Platform.isTV
|
||||||
? require("@kesha-antonov/react-native-background-downloader")
|
? require("@kesha-antonov/react-native-background-downloader")
|
||||||
: null;
|
: null;
|
||||||
//const FFmpegKitProvider = !Platform.isTV
|
|
||||||
// ? require("ffmpeg-kit-react-native")
|
|
||||||
// : null;
|
|
||||||
|
|
||||||
interface Props extends ViewProps {}
|
interface Props extends ViewProps {}
|
||||||
|
|
||||||
@@ -72,23 +69,18 @@ const DownloadCard = ({ process, ...props }: DownloadCardProps) => {
|
|||||||
mutationFn: async (id: string) => {
|
mutationFn: async (id: string) => {
|
||||||
if (!process) throw new Error("No active download");
|
if (!process) throw new Error("No active download");
|
||||||
|
|
||||||
if (settings?.downloadMethod === DownloadMethod.Optimized) {
|
try {
|
||||||
try {
|
const tasks = await BackGroundDownloader.checkForExistingDownloads();
|
||||||
const tasks = await BackGroundDownloader.checkForExistingDownloads();
|
for (const task of tasks) {
|
||||||
for (const task of tasks) {
|
if (task.id === id) {
|
||||||
if (task.id === id) {
|
task.stop();
|
||||||
task.stop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} finally {
|
}
|
||||||
await removeProcess(id);
|
} finally {
|
||||||
|
await removeProcess(id);
|
||||||
|
if (settings?.downloadMethod === DownloadMethod.Optimized) {
|
||||||
await queryClient.refetchQueries({ queryKey: ["jobs"] });
|
await queryClient.refetchQueries({ queryKey: ["jobs"] });
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//FFmpegKitProvider.FFmpegKit.cancel(Number(id));
|
|
||||||
setProcesses((prev: any[]) =>
|
|
||||||
prev.filter((p: { id: string }) => p.id !== id),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user