mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
Revert "chore(tmp): workaround download provider"
This reverts commit e9effd5436.
This commit is contained in:
@@ -38,13 +38,9 @@ import {
|
||||
} from "./Downloads/types";
|
||||
import { apiAtom } from "./JellyfinProvider";
|
||||
|
||||
// TEMPORARILY DISABLED
|
||||
// To re-enable: Move package from "disabledDependencies" to "dependencies" in package.json,
|
||||
// run "bun install", then uncomment the require below and remove the null assignment
|
||||
// const BackGroundDownloader = !Platform.isTV
|
||||
// ? require("@kesha-antonov/react-native-background-downloader")
|
||||
// : null;
|
||||
const BackGroundDownloader = null;
|
||||
const BackGroundDownloader = !Platform.isTV
|
||||
? require("@kesha-antonov/react-native-background-downloader")
|
||||
: null;
|
||||
|
||||
// Cap progress at 99% to avoid showing 100% before the download is actually complete
|
||||
const MAX_PROGRESS_BEFORE_COMPLETION = 99;
|
||||
@@ -183,9 +179,6 @@ function useDownloadProvider() {
|
||||
|
||||
/// Cant use the background downloader callback. As its not triggered if size is unknown.
|
||||
const updateProgress = async () => {
|
||||
if (!BackGroundDownloader) {
|
||||
return;
|
||||
}
|
||||
const tasks = await BackGroundDownloader.checkForExistingDownloads();
|
||||
if (!tasks) {
|
||||
return;
|
||||
@@ -469,8 +462,7 @@ function useDownloadProvider() {
|
||||
*/
|
||||
const startDownload = useCallback(
|
||||
async (process: JobStatus) => {
|
||||
if (!process?.item.Id || !authHeader || !BackGroundDownloader)
|
||||
throw new Error("No item id or downloader unavailable");
|
||||
if (!process?.item.Id || !authHeader) throw new Error("No item id");
|
||||
|
||||
// Enhanced cleanup for existing tasks to prevent duplicates
|
||||
try {
|
||||
@@ -746,10 +738,6 @@ function useDownloadProvider() {
|
||||
|
||||
const removeProcess = useCallback(
|
||||
async (id: string) => {
|
||||
if (!BackGroundDownloader) {
|
||||
setProcesses((prev) => prev.filter((process) => process.id !== id));
|
||||
return;
|
||||
}
|
||||
const tasks = await BackGroundDownloader.checkForExistingDownloads();
|
||||
const task = tasks?.find((t: any) => t.id === id);
|
||||
if (task) {
|
||||
@@ -1024,8 +1012,7 @@ function useDownloadProvider() {
|
||||
const pauseDownload = useCallback(
|
||||
async (id: string) => {
|
||||
const process = processes.find((p) => p.id === id);
|
||||
if (!process || !BackGroundDownloader)
|
||||
throw new Error("No active download or downloader unavailable");
|
||||
if (!process) throw new Error("No active download");
|
||||
|
||||
// TODO: iOS pause functionality temporarily disabled due to background task issues
|
||||
// Remove this check to re-enable iOS pause functionality in the future
|
||||
@@ -1127,8 +1114,7 @@ function useDownloadProvider() {
|
||||
const resumeDownload = useCallback(
|
||||
async (id: string) => {
|
||||
const process = processes.find((p) => p.id === id);
|
||||
if (!process || !BackGroundDownloader)
|
||||
throw new Error("No active download or downloader unavailable");
|
||||
if (!process) throw new Error("No active download");
|
||||
|
||||
// TODO: iOS resume functionality temporarily disabled due to background task issues
|
||||
// Remove this check to re-enable iOS resume functionality in the future
|
||||
|
||||
Reference in New Issue
Block a user