mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
fix: bump biome and fix error (#864)
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
This commit is contained in:
@@ -1,31 +1,13 @@
|
||||
import { useHaptic } from "@/hooks/useHaptic";
|
||||
import useImageStorage from "@/hooks/useImageStorage";
|
||||
import { useInterval } from "@/hooks/useInterval";
|
||||
import { DownloadMethod, useSettings } from "@/utils/atoms/settings";
|
||||
import { getOrSetDeviceId } from "@/utils/device";
|
||||
import useDownloadHelper from "@/utils/download";
|
||||
import { getItemImage } from "@/utils/getItemImage";
|
||||
import { useLog, writeToLog } from "@/utils/log";
|
||||
import { storage } from "@/utils/mmkv";
|
||||
import {
|
||||
type JobStatus,
|
||||
cancelAllJobs,
|
||||
cancelJobById,
|
||||
deleteDownloadItemInfoFromDiskTmp,
|
||||
getAllJobsByDeviceId,
|
||||
getDownloadItemInfoFromDiskTmp,
|
||||
} from "@/utils/optimize-server";
|
||||
import type {
|
||||
BaseItemDto,
|
||||
MediaSourceInfo,
|
||||
} from "@jellyfin/sdk/lib/generated-client/models";
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||
import BackGroundDownloader from "@kesha-antonov/react-native-background-downloader";
|
||||
import { focusManager, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
import * as Application from "expo-application";
|
||||
import * as FileSystem from "expo-file-system";
|
||||
import type { FileInfo } from "expo-file-system";
|
||||
import * as FileSystem from "expo-file-system";
|
||||
import Notifications from "expo-notifications";
|
||||
import { useRouter } from "expo-router";
|
||||
import { atom, useAtom } from "jotai";
|
||||
@@ -40,6 +22,23 @@ import {
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AppState, type AppStateStatus, Platform } from "react-native";
|
||||
import { toast } from "sonner-native";
|
||||
import { useHaptic } from "@/hooks/useHaptic";
|
||||
import useImageStorage from "@/hooks/useImageStorage";
|
||||
import { useInterval } from "@/hooks/useInterval";
|
||||
import { DownloadMethod, useSettings } from "@/utils/atoms/settings";
|
||||
import { getOrSetDeviceId } from "@/utils/device";
|
||||
import useDownloadHelper from "@/utils/download";
|
||||
import { getItemImage } from "@/utils/getItemImage";
|
||||
import { useLog, writeToLog } from "@/utils/log";
|
||||
import { storage } from "@/utils/mmkv";
|
||||
import {
|
||||
cancelAllJobs,
|
||||
cancelJobById,
|
||||
deleteDownloadItemInfoFromDiskTmp,
|
||||
getAllJobsByDeviceId,
|
||||
getDownloadItemInfoFromDiskTmp,
|
||||
type JobStatus,
|
||||
} from "@/utils/optimize-server";
|
||||
import { Bitrate } from "../components/BitrateSelector";
|
||||
import { apiAtom } from "./JellyfinProvider";
|
||||
|
||||
@@ -842,37 +841,35 @@ export function DownloadProvider({ children }: { children: React.ReactNode }) {
|
||||
}
|
||||
|
||||
export function useDownload() {
|
||||
const context = useContext(DownloadContext);
|
||||
|
||||
if (Platform.isTV) {
|
||||
// Since tv doesn't do downloads, just return no-op functions for everything
|
||||
return {
|
||||
processes: [],
|
||||
startBackgroundDownload: useCallback(
|
||||
async (
|
||||
_url: string,
|
||||
_item: BaseItemDto,
|
||||
_mediaSource: MediaSourceInfo,
|
||||
_maxBitrate?: Bitrate,
|
||||
) => {},
|
||||
[],
|
||||
),
|
||||
startBackgroundDownload: async (
|
||||
_url: string,
|
||||
_item: BaseItemDto,
|
||||
_mediaSource: MediaSourceInfo,
|
||||
_maxBitrate?: Bitrate,
|
||||
) => {},
|
||||
downloadedFiles: [],
|
||||
deleteAllFiles: async (): Promise<void> => {},
|
||||
deleteFile: async (id: string): Promise<void> => {},
|
||||
deleteItems: async (items: BaseItemDto[]) => {},
|
||||
saveDownloadedItemInfo: (item: BaseItemDto, size?: number) => {},
|
||||
removeProcess: (id: string) => {},
|
||||
deleteFile: async (_id: string): Promise<void> => {},
|
||||
deleteItems: async (_items: BaseItemDto[]) => {},
|
||||
saveDownloadedItemInfo: (_item: BaseItemDto, _size?: number) => {},
|
||||
removeProcess: (_id: string) => {},
|
||||
setProcesses: () => {},
|
||||
startDownload: async (_process: JobStatus): Promise<void> => {},
|
||||
getDownloadedItem: (itemId: string) => {},
|
||||
getDownloadedItem: (_itemId: string) => {},
|
||||
deleteFileByType: async (_type: BaseItemDto["Type"]) => {},
|
||||
appSizeUsage: async () => 0,
|
||||
getDownloadedItemSize: (itemId: string) => {},
|
||||
getDownloadedItemSize: (_itemId: string) => {},
|
||||
APP_CACHE_DOWNLOAD_DIRECTORY: "",
|
||||
cleanCacheDirectory: async (): Promise<void> => {},
|
||||
};
|
||||
}
|
||||
|
||||
const context = useContext(DownloadContext);
|
||||
if (context === null) {
|
||||
throw new Error("useDownload must be used within a DownloadProvider");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useJobProcessor } from "@/utils/atoms/queue";
|
||||
import type React from "react";
|
||||
import { createContext } from "react";
|
||||
import { useJobProcessor } from "@/utils/atoms/queue";
|
||||
|
||||
const JobQueueContext = createContext(null);
|
||||
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
import type { Bitrate } from "@/components/BitrateSelector";
|
||||
import { settingsAtom } from "@/utils/atoms/settings";
|
||||
import { getStreamUrl } from "@/utils/jellyfin/media/getStreamUrl";
|
||||
import generateDeviceProfile from "@/utils/profiles/native";
|
||||
import type {
|
||||
BaseItemDto,
|
||||
MediaSourceInfo,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api";
|
||||
import { useAtomValue } from "jotai";
|
||||
import type React from "react";
|
||||
import {
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
import { createContext, useCallback, useContext, useState } from "react";
|
||||
import type { Bitrate } from "@/components/BitrateSelector";
|
||||
import { settingsAtom } from "@/utils/atoms/settings";
|
||||
import { getStreamUrl } from "@/utils/jellyfin/media/getStreamUrl";
|
||||
import generateDeviceProfile from "@/utils/profiles/native";
|
||||
import { apiAtom, userAtom } from "./JellyfinProvider";
|
||||
|
||||
export type PlaybackType = {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { apiAtom, getOrSetDeviceId } from "@/providers/JellyfinProvider";
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api";
|
||||
import { useRouter } from "expo-router";
|
||||
import { useAtomValue } from "jotai";
|
||||
import React, {
|
||||
import {
|
||||
createContext,
|
||||
type ReactNode,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useState,
|
||||
type ReactNode,
|
||||
useMemo,
|
||||
useCallback,
|
||||
useState,
|
||||
} from "react";
|
||||
import { AppState, type AppStateStatus } from "react-native";
|
||||
import { apiAtom, getOrSetDeviceId } from "@/providers/JellyfinProvider";
|
||||
|
||||
interface WebSocketMessage {
|
||||
MessageType: string;
|
||||
|
||||
Reference in New Issue
Block a user