mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-02-11 23:02:22 +00:00
Compare commits
1 Commits
fix/refres
...
renovate/g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
907d7e5f6f |
6
.github/workflows/ci-codeql.yml
vendored
6
.github/workflows/ci-codeql.yml
vendored
@@ -27,13 +27,13 @@ jobs:
|
|||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: 🏁 Initialize CodeQL
|
- name: 🏁 Initialize CodeQL
|
||||||
uses: github/codeql-action/init@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
|
uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
queries: +security-extended,security-and-quality
|
queries: +security-extended,security-and-quality
|
||||||
|
|
||||||
- name: 🛠️ Autobuild
|
- name: 🛠️ Autobuild
|
||||||
uses: github/codeql-action/autobuild@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
|
uses: github/codeql-action/autobuild@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
|
||||||
|
|
||||||
- name: 🧪 Perform CodeQL Analysis
|
- name: 🧪 Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
|
uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import { MediaListSection } from "@/components/medialists/MediaListSection";
|
|||||||
import { Colors } from "@/constants/Colors";
|
import { Colors } from "@/constants/Colors";
|
||||||
import useRouter from "@/hooks/useAppRouter";
|
import useRouter from "@/hooks/useAppRouter";
|
||||||
import { useNetworkStatus } from "@/hooks/useNetworkStatus";
|
import { useNetworkStatus } from "@/hooks/useNetworkStatus";
|
||||||
import { useRefetchHomeOnForeground } from "@/hooks/useRefetchHomeOnForeground";
|
|
||||||
import { useInvalidatePlaybackProgressCache } from "@/hooks/useRevalidatePlaybackProgressCache";
|
import { useInvalidatePlaybackProgressCache } from "@/hooks/useRevalidatePlaybackProgressCache";
|
||||||
import { useDownload } from "@/providers/DownloadProvider";
|
import { useDownload } from "@/providers/DownloadProvider";
|
||||||
import { useIntroSheet } from "@/providers/IntroSheetProvider";
|
import { useIntroSheet } from "@/providers/IntroSheetProvider";
|
||||||
@@ -108,9 +107,6 @@ export const Home = () => {
|
|||||||
prevIsConnected.current = isConnected;
|
prevIsConnected.current = isConnected;
|
||||||
}, [isConnected, invalidateCache]);
|
}, [isConnected, invalidateCache]);
|
||||||
|
|
||||||
// Refresh home data on mount (cold start) and when app returns to foreground
|
|
||||||
useRefetchHomeOnForeground();
|
|
||||||
|
|
||||||
const hasDownloads = useMemo(() => {
|
const hasDownloads = useMemo(() => {
|
||||||
if (Platform.isTV) return false;
|
if (Platform.isTV) return false;
|
||||||
return downloadedItems.length > 0;
|
return downloadedItems.length > 0;
|
||||||
@@ -200,13 +196,10 @@ export const Home = () => {
|
|||||||
|
|
||||||
const refetch = async () => {
|
const refetch = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
setLoadedSections(new Set());
|
||||||
setLoadedSections(new Set());
|
await refreshStreamyfinPluginSettings();
|
||||||
await refreshStreamyfinPluginSettings();
|
await invalidateCache();
|
||||||
await invalidateCache();
|
setLoading(false);
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createCollectionConfig = useCallback(
|
const createCollectionConfig = useCallback(
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { useTranslation } from "react-i18next";
|
|||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Platform,
|
Platform,
|
||||||
RefreshControl,
|
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
@@ -38,7 +37,6 @@ import { MediaListSection } from "@/components/medialists/MediaListSection";
|
|||||||
import { Colors } from "@/constants/Colors";
|
import { Colors } from "@/constants/Colors";
|
||||||
import useRouter from "@/hooks/useAppRouter";
|
import useRouter from "@/hooks/useAppRouter";
|
||||||
import { useNetworkStatus } from "@/hooks/useNetworkStatus";
|
import { useNetworkStatus } from "@/hooks/useNetworkStatus";
|
||||||
import { useRefetchHomeOnForeground } from "@/hooks/useRefetchHomeOnForeground";
|
|
||||||
import { useInvalidatePlaybackProgressCache } from "@/hooks/useRevalidatePlaybackProgressCache";
|
import { useInvalidatePlaybackProgressCache } from "@/hooks/useRevalidatePlaybackProgressCache";
|
||||||
import { useDownload } from "@/providers/DownloadProvider";
|
import { useDownload } from "@/providers/DownloadProvider";
|
||||||
import { apiAtom, userAtom } from "@/providers/JellyfinProvider";
|
import { apiAtom, userAtom } from "@/providers/JellyfinProvider";
|
||||||
@@ -69,8 +67,8 @@ export const HomeWithCarousel = () => {
|
|||||||
const api = useAtomValue(apiAtom);
|
const api = useAtomValue(apiAtom);
|
||||||
const user = useAtomValue(userAtom);
|
const user = useAtomValue(userAtom);
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
const [_loading, setLoading] = useState(false);
|
||||||
const { settings, refreshStreamyfinPluginSettings } = useSettings();
|
const { settings, refreshStreamyfinPluginSettings } = useSettings();
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
const headerOverlayOffset = Platform.isTV ? 0 : 60;
|
const headerOverlayOffset = Platform.isTV ? 0 : 60;
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
const animatedScrollRef = useAnimatedRef<Animated.ScrollView>();
|
const animatedScrollRef = useAnimatedRef<Animated.ScrollView>();
|
||||||
@@ -93,19 +91,6 @@ export const HomeWithCarousel = () => {
|
|||||||
prevIsConnected.current = isConnected;
|
prevIsConnected.current = isConnected;
|
||||||
}, [isConnected, invalidateCache]);
|
}, [isConnected, invalidateCache]);
|
||||||
|
|
||||||
// Refresh home data on mount (cold start) and when app returns to foreground
|
|
||||||
useRefetchHomeOnForeground();
|
|
||||||
|
|
||||||
const refetch = async () => {
|
|
||||||
setLoading(true);
|
|
||||||
try {
|
|
||||||
await refreshStreamyfinPluginSettings();
|
|
||||||
await invalidateCache();
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const hasDownloads = useMemo(() => {
|
const hasDownloads = useMemo(() => {
|
||||||
if (Platform.isTV) return false;
|
if (Platform.isTV) return false;
|
||||||
return downloadedItems.length > 0;
|
return downloadedItems.length > 0;
|
||||||
@@ -193,6 +178,13 @@ export const HomeWithCarousel = () => {
|
|||||||
);
|
);
|
||||||
}, [userViews]);
|
}, [userViews]);
|
||||||
|
|
||||||
|
const _refetch = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
await refreshStreamyfinPluginSettings();
|
||||||
|
await invalidateCache();
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
const createCollectionConfig = useCallback(
|
const createCollectionConfig = useCallback(
|
||||||
(
|
(
|
||||||
title: string,
|
title: string,
|
||||||
@@ -548,18 +540,8 @@ export const HomeWithCarousel = () => {
|
|||||||
nestedScrollEnabled
|
nestedScrollEnabled
|
||||||
contentInsetAdjustmentBehavior='never'
|
contentInsetAdjustmentBehavior='never'
|
||||||
scrollEventThrottle={16}
|
scrollEventThrottle={16}
|
||||||
bounces={!Platform.isTV}
|
bounces={false}
|
||||||
overScrollMode='never'
|
overScrollMode='never'
|
||||||
refreshControl={
|
|
||||||
!Platform.isTV ? (
|
|
||||||
<RefreshControl
|
|
||||||
refreshing={loading}
|
|
||||||
onRefresh={refetch}
|
|
||||||
tintColor='white'
|
|
||||||
colors={["white"]}
|
|
||||||
/>
|
|
||||||
) : undefined
|
|
||||||
}
|
|
||||||
style={{ marginTop: -headerOverlayOffset }}
|
style={{ marginTop: -headerOverlayOffset }}
|
||||||
contentContainerStyle={{ paddingTop: headerOverlayOffset }}
|
contentContainerStyle={{ paddingTop: headerOverlayOffset }}
|
||||||
onScroll={(event) => {
|
onScroll={(event) => {
|
||||||
@@ -588,7 +570,7 @@ export const HomeWithCarousel = () => {
|
|||||||
settings.streamyStatsPromotedWatchlists;
|
settings.streamyStatsPromotedWatchlists;
|
||||||
const streamystatsSections =
|
const streamystatsSections =
|
||||||
index === streamystatsIndex && hasStreamystatsContent ? (
|
index === streamystatsIndex && hasStreamystatsContent ? (
|
||||||
<View key='streamystats-sections'>
|
<>
|
||||||
{settings.streamyStatsMovieRecommendations && (
|
{settings.streamyStatsMovieRecommendations && (
|
||||||
<StreamystatsRecommendations
|
<StreamystatsRecommendations
|
||||||
title={t(
|
title={t(
|
||||||
@@ -608,7 +590,7 @@ export const HomeWithCarousel = () => {
|
|||||||
{settings.streamyStatsPromotedWatchlists && (
|
{settings.streamyStatsPromotedWatchlists && (
|
||||||
<StreamystatsPromotedWatchlists />
|
<StreamystatsPromotedWatchlists />
|
||||||
)}
|
)}
|
||||||
</View>
|
</>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
if (section.type === "InfiniteScrollingCollectionList") {
|
if (section.type === "InfiniteScrollingCollectionList") {
|
||||||
|
|||||||
@@ -37,18 +37,7 @@ export const ItemPeopleSections: React.FC<Props> = ({ item, ...props }) => {
|
|||||||
return { ...item, People: people } as BaseItemDto;
|
return { ...item, People: people } as BaseItemDto;
|
||||||
}, [item, people]);
|
}, [item, people]);
|
||||||
|
|
||||||
const topPeople = useMemo(() => {
|
const topPeople = useMemo(() => people.slice(0, 3), [people]);
|
||||||
const seen = new Set<string>();
|
|
||||||
const unique: BaseItemPerson[] = [];
|
|
||||||
for (const person of people) {
|
|
||||||
if (person.Id && !seen.has(person.Id)) {
|
|
||||||
seen.add(person.Id);
|
|
||||||
unique.push(person);
|
|
||||||
}
|
|
||||||
if (unique.length >= 3) break;
|
|
||||||
}
|
|
||||||
return unique;
|
|
||||||
}, [people]);
|
|
||||||
|
|
||||||
const renderActorSection = useCallback(
|
const renderActorSection = useCallback(
|
||||||
(person: BaseItemPerson, idx: number, total: number) => {
|
(person: BaseItemPerson, idx: number, total: number) => {
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
import { useQueryClient } from "@tanstack/react-query";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { AppState } from "react-native";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refetches active home queries on mount (cold start) and whenever
|
|
||||||
* the app returns to the foreground from background.
|
|
||||||
*/
|
|
||||||
export function useRefetchHomeOnForeground() {
|
|
||||||
const queryClient = useQueryClient();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// On mount (cold start), use cancelRefetch: false so we don't cancel
|
|
||||||
// an in-flight initial fetch that React Query already started.
|
|
||||||
queryClient.refetchQueries(
|
|
||||||
{ queryKey: ["home"], type: "active" },
|
|
||||||
{ cancelRefetch: false },
|
|
||||||
);
|
|
||||||
|
|
||||||
const subscription = AppState.addEventListener("change", (state) => {
|
|
||||||
if (state === "active") {
|
|
||||||
// On foreground return, force a fresh refetch
|
|
||||||
queryClient.refetchQueries(
|
|
||||||
{ queryKey: ["home"], type: "active" },
|
|
||||||
{ cancelRefetch: true },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => subscription.remove();
|
|
||||||
}, [queryClient]);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user