From 68e3b74e4925172d133b15c9bbe91d34f625424b Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 07:05:46 +0200 Subject: [PATCH 1/5] Fix Jellyseerr TV request permission logic bug (#1026) --- utils/_jellyseerr/useJellyseerrCanRequest.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/_jellyseerr/useJellyseerrCanRequest.ts b/utils/_jellyseerr/useJellyseerrCanRequest.ts index f1306c44..c8872769 100644 --- a/utils/_jellyseerr/useJellyseerrCanRequest.ts +++ b/utils/_jellyseerr/useJellyseerrCanRequest.ts @@ -3,6 +3,7 @@ import { useJellyseerr } from "@/hooks/useJellyseerr"; import { MediaRequestStatus, MediaStatus, + MediaType, } from "@/utils/jellyseerr/server/constants/media"; import { hasPermission, @@ -40,7 +41,7 @@ export const useJellyseerrCanRequest = ( const userHasPermission = hasPermission( [ Permission.REQUEST, - item?.mediaInfo?.mediaType + item?.mediaInfo?.mediaType === MediaType.MOVIE ? Permission.REQUEST_MOVIE : Permission.REQUEST_TV, ], From 62b25d7bf7e537670d84ed43204624a5aa6c9f85 Mon Sep 17 00:00:00 2001 From: lance chant <13349722+lancechant@users.noreply.github.com> Date: Wed, 3 Sep 2025 12:26:56 +0200 Subject: [PATCH 2/5] fix: offline checking (#989) --- components/settings/HomeIndex.tsx | 59 +++++++++---------------------- hooks/useNetworkStatus.ts | 30 ++++++++++++++++ hooks/usePlaybackManager.ts | 6 ++-- hooks/useTwoWaySync.ts | 6 ++-- 4 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 hooks/useNetworkStatus.ts diff --git a/components/settings/HomeIndex.tsx b/components/settings/HomeIndex.tsx index 79243147..f7b2713d 100644 --- a/components/settings/HomeIndex.tsx +++ b/components/settings/HomeIndex.tsx @@ -11,7 +11,6 @@ import { getUserLibraryApi, getUserViewsApi, } from "@jellyfin/sdk/lib/utils/api"; -import NetInfo from "@react-native-community/netinfo"; import { type QueryFunction, useQuery } from "@tanstack/react-query"; import { useNavigation, useRouter, useSegments } from "expo-router"; import { useAtomValue } from "jotai"; @@ -33,6 +32,7 @@ import { ScrollingCollectionList } from "@/components/home/ScrollingCollectionLi import { Loader } from "@/components/Loader"; import { MediaListSection } from "@/components/medialists/MediaListSection"; import { Colors } from "@/constants/Colors"; +import { useNetworkStatus } from "@/hooks/useNetworkStatus"; import { useInvalidatePlaybackProgressCache } from "@/hooks/useRevalidatePlaybackProgressCache"; import { useDownload } from "@/providers/DownloadProvider"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; @@ -72,9 +72,6 @@ export const HomeIndex = () => { refreshStreamyfinPluginSettings, ] = useSettings(null); - const [isConnected, setIsConnected] = useState(null); - const [loadingRetry, setLoadingRetry] = useState(false); - const navigation = useNavigation(); const insets = useSafeAreaInsets(); @@ -83,6 +80,7 @@ export const HomeIndex = () => { const { getDownloadedItems, cleanCacheDirectory } = useDownload(); const prevIsConnected = useRef(false); + const { isConnected, loading: retryLoading, retryCheck } = useNetworkStatus(); const invalidateCache = useInvalidatePlaybackProgressCache(); useEffect(() => { // Only invalidate cache when transitioning from offline to online @@ -137,29 +135,6 @@ export const HomeIndex = () => { }; }, [segments]); - const checkConnection = useCallback(async () => { - setLoadingRetry(true); - const state = await NetInfo.fetch(); - setIsConnected(state.isConnected); - setLoadingRetry(false); - }, []); - - useEffect(() => { - const unsubscribe = NetInfo.addEventListener((state) => { - if (state.isConnected === false || state.isInternetReachable === false) - setIsConnected(false); - else setIsConnected(true); - }); - - NetInfo.fetch().then((state) => { - setIsConnected(state.isConnected); - }); - - return () => { - unsubscribe(); - }; - }, []); - const { data, isError: e1, @@ -397,30 +372,30 @@ export const HomeIndex = () => { {t("home.no_internet_message")} - + {!Platform.isTV && ( + + )}