mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-07 18:49:45 +00:00
Add episodeThumbnail parameter to navigation and enhance StreamsScreen image handling
This update introduces the episodeThumbnail parameter in the navigation between MetadataScreen and StreamsScreen, allowing for improved image handling. The StreamsScreen now utilizes the episodeThumbnail for displaying images, with additional checks for URL validity, enhancing the user experience and ensuring more reliable image rendering.
This commit is contained in:
parent
c4f5c9e374
commit
df8ac7352d
3 changed files with 23 additions and 3 deletions
|
|
@ -59,6 +59,7 @@ export type RootStackParamList = {
|
||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
episodeId?: string;
|
episodeId?: string;
|
||||||
|
episodeThumbnail?: string;
|
||||||
};
|
};
|
||||||
VideoPlayer: {
|
VideoPlayer: {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
||||||
|
|
@ -222,8 +222,14 @@ const MetadataScreen: React.FC = () => {
|
||||||
}, [navigation, id, type, episodes, episodeId, watchProgressData.watchProgress]);
|
}, [navigation, id, type, episodes, episodeId, watchProgressData.watchProgress]);
|
||||||
|
|
||||||
const handleEpisodeSelect = useCallback((episode: Episode) => {
|
const handleEpisodeSelect = useCallback((episode: Episode) => {
|
||||||
|
console.log('[MetadataScreen] Selected Episode:', JSON.stringify(episode, null, 2));
|
||||||
const episodeId = episode.stremioId || `${id}:${episode.season_number}:${episode.episode_number}`;
|
const episodeId = episode.stremioId || `${id}:${episode.season_number}:${episode.episode_number}`;
|
||||||
navigation.navigate('Streams', { id, type, episodeId });
|
navigation.navigate('Streams', {
|
||||||
|
id,
|
||||||
|
type,
|
||||||
|
episodeId,
|
||||||
|
episodeThumbnail: episode.still_path || undefined
|
||||||
|
});
|
||||||
}, [navigation, id, type]);
|
}, [navigation, id, type]);
|
||||||
|
|
||||||
const handleBack = useCallback(() => navigation.goBack(), [navigation]);
|
const handleBack = useCallback(() => navigation.goBack(), [navigation]);
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ const ProviderFilter = memo(({
|
||||||
export const StreamsScreen = () => {
|
export const StreamsScreen = () => {
|
||||||
const route = useRoute<RouteProp<RootStackParamList, 'Streams'>>();
|
const route = useRoute<RouteProp<RootStackParamList, 'Streams'>>();
|
||||||
const navigation = useNavigation<RootStackNavigationProp>();
|
const navigation = useNavigation<RootStackNavigationProp>();
|
||||||
const { id, type, episodeId } = route.params;
|
const { id, type, episodeId, episodeThumbnail } = route.params;
|
||||||
const { settings } = useSettings();
|
const { settings } = useSettings();
|
||||||
const { currentTheme } = useTheme();
|
const { currentTheme } = useTheme();
|
||||||
const { colors } = currentTheme;
|
const { colors } = currentTheme;
|
||||||
|
|
@ -255,6 +255,10 @@ export const StreamsScreen = () => {
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('[StreamsScreen] Received thumbnail from params:', episodeThumbnail);
|
||||||
|
}, [episodeThumbnail]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
metadata,
|
metadata,
|
||||||
episodes,
|
episodes,
|
||||||
|
|
@ -904,12 +908,21 @@ export const StreamsScreen = () => {
|
||||||
}, [selectedProvider, type, episodeStreams, groupedStreams]);
|
}, [selectedProvider, type, episodeStreams, groupedStreams]);
|
||||||
|
|
||||||
const episodeImage = useMemo(() => {
|
const episodeImage = useMemo(() => {
|
||||||
|
if (episodeThumbnail) {
|
||||||
|
if (episodeThumbnail.startsWith('http')) {
|
||||||
|
return episodeThumbnail;
|
||||||
|
}
|
||||||
|
return tmdbService.getImageUrl(episodeThumbnail, 'original');
|
||||||
|
}
|
||||||
if (!currentEpisode) return null;
|
if (!currentEpisode) return null;
|
||||||
if (currentEpisode.still_path) {
|
if (currentEpisode.still_path) {
|
||||||
|
if (currentEpisode.still_path.startsWith('http')) {
|
||||||
|
return currentEpisode.still_path;
|
||||||
|
}
|
||||||
return tmdbService.getImageUrl(currentEpisode.still_path, 'original');
|
return tmdbService.getImageUrl(currentEpisode.still_path, 'original');
|
||||||
}
|
}
|
||||||
return metadata?.poster || null;
|
return metadata?.poster || null;
|
||||||
}, [currentEpisode, metadata]);
|
}, [currentEpisode, metadata, episodeThumbnail]);
|
||||||
|
|
||||||
const isLoading = type === 'series' ? loadingEpisodeStreams : loadingStreams;
|
const isLoading = type === 'series' ? loadingEpisodeStreams : loadingStreams;
|
||||||
const streams = type === 'series' ? episodeStreams : groupedStreams;
|
const streams = type === 'series' ? episodeStreams : groupedStreams;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue