diff --git a/src/components/home/AppleTVHero.tsx b/src/components/home/AppleTVHero.tsx index 29a53c41..509ae992 100644 --- a/src/components/home/AppleTVHero.tsx +++ b/src/components/home/AppleTVHero.tsx @@ -672,13 +672,14 @@ const AppleTVHero: React.FC = ({ id: currentItem.id, type: currentItem.type, title: currentItem.name, + addonId: currentItem.addonId, metadata: { poster: currentItem.poster, banner: currentItem.banner, releaseInfo: currentItem.releaseInfo, genres: currentItem.genres - } - }; + } + }; // Add resume data if we have progress that's not near completion if (shouldResume && watchProgress) { @@ -697,6 +698,7 @@ const AppleTVHero: React.FC = ({ id: currentItem.id, type: currentItem.type, title: currentItem.name, + addonId: currentItem.addonId, metadata: { poster: currentItem.poster, banner: currentItem.banner, @@ -1184,6 +1186,7 @@ const AppleTVHero: React.FC = ({ navigation.navigate('Metadata', { id: currentItem.id, type: currentItem.type, + addonId: currentItem.addonId, }); } }} @@ -1220,6 +1223,7 @@ const AppleTVHero: React.FC = ({ navigation.navigate('Metadata', { id: currentItem.id, type: currentItem.type, + addonId: currentItem.addonId, }); } }} diff --git a/src/components/home/ContinueWatchingSection.tsx b/src/components/home/ContinueWatchingSection.tsx index 95236cdb..5db6d711 100644 --- a/src/components/home/ContinueWatchingSection.tsx +++ b/src/components/home/ContinueWatchingSection.tsx @@ -35,6 +35,7 @@ interface ContinueWatchingItem extends StreamingContent { season?: number; episode?: number; episodeTitle?: string; + addonId?: string; } // Define the ref interface @@ -997,12 +998,14 @@ const ContinueWatchingSection = React.forwardRef((props, re id: item.id, type: item.type, episodeId: episodeId + addonId: item.addonId }); } else { // For movies or series without specific episode, navigate to main content navigation.navigate('Streams', { id: item.id, type: item.type + addonId: item.addonId }); } } catch (error) { @@ -1505,4 +1508,4 @@ const styles = StyleSheet.create({ export default React.memo(ContinueWatchingSection, (prevProps, nextProps) => { // This component has no props that would cause re-renders return true; -}); \ No newline at end of file +}); diff --git a/src/components/home/HeroCarousel.tsx b/src/components/home/HeroCarousel.tsx index 96efe6f1..c498b479 100644 --- a/src/components/home/HeroCarousel.tsx +++ b/src/components/home/HeroCarousel.tsx @@ -228,9 +228,9 @@ const HeroCarousel: React.FC = ({ items, loading = false }) = const contentPadding = useMemo(() => ({ paddingHorizontal: (windowWidth - cardWidth) / 2 }), [windowWidth, cardWidth]); - const handleNavigateToMetadata = useCallback((id: string, type: any) => { - navigation.navigate('Metadata', { id, type }); - }, [navigation]); + const handleNavigateToMetadata = useCallback((id: string, type: any, addonId?: string) => { + navigation.navigate('Metadata', { id, type, addonId }); +}, [navigation]); // Container animation based on scroll - must be before early returns // TEMPORARILY DISABLED FOR PERFORMANCE TESTING @@ -399,7 +399,7 @@ const HeroCarousel: React.FC = ({ items, loading = false }) = colors={currentTheme.colors} logoFailed={failedLogoIds.has(item.id)} onLogoError={() => setFailedLogoIds((prev) => new Set(prev).add(item.id))} - onPressInfo={() => handleNavigateToMetadata(item.id, item.type)} + onPressInfo={() => handleNavigateToMetadata(item.id, item.type, item.addonId)} scrollX={scrollX} index={index} flipped={!!flippedMap[item.id]} diff --git a/src/components/home/ThisWeekSection.tsx b/src/components/home/ThisWeekSection.tsx index fbace08a..3992f026 100644 --- a/src/components/home/ThisWeekSection.tsx +++ b/src/components/home/ThisWeekSection.tsx @@ -50,6 +50,7 @@ interface ThisWeekEpisode { vote_average: number; still_path: string | null; season_poster_path: string | null; + addonId?: string; // Grouping fields isGroup?: boolean; episodeCount?: number; @@ -195,34 +196,37 @@ export const ThisWeekSection = React.memo(() => { }, [calendarData]); const handleEpisodePress = (episode: ThisWeekEpisode) => { - // For grouped episodes, always go to series details - if (episode.isGroup) { - navigation.navigate('Metadata', { - id: episode.seriesId, - type: 'series' - }); - return; - } - - // For upcoming episodes, go to the metadata screen - if (!episode.isReleased) { - const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; - navigation.navigate('Metadata', { - id: episode.seriesId, - type: 'series', - episodeId - }); - return; - } - - // For released episodes, go to the streams screen - const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; - navigation.navigate('Streams', { + // For grouped episodes, always go to series details + if (episode.isGroup) { + navigation.navigate('Metadata', { id: episode.seriesId, type: 'series', - episodeId + addonId: episode.addonId, }); - }; + return; + } + + // For upcoming episodes, go to the metadata screen + if (!episode.isReleased) { + const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; + navigation.navigate('Metadata', { + id: episode.seriesId, + type: 'series', + episodeId, + addonId: episode.addonId, + }); + return; + } + + // For released episodes, go to the streams screen + const episodeId = `${episode.seriesId}:${episode.season}:${episode.episode}`; + navigation.navigate('Streams', { + id: episode.seriesId, + type: 'series', + episodeId, + addonId: episode.addonId, + }); +}; const handleViewAll = () => { navigation.navigate('Calendar' as any); @@ -562,4 +566,4 @@ const styles = StyleSheet.create({ borderWidth: 1, zIndex: -1, }, -}); \ No newline at end of file +}); diff --git a/src/hooks/useCalendarData.ts b/src/hooks/useCalendarData.ts index 861a6707..4d0a8e68 100644 --- a/src/hooks/useCalendarData.ts +++ b/src/hooks/useCalendarData.ts @@ -22,6 +22,7 @@ interface CalendarEpisode { vote_average: number; still_path: string | null; season_poster_path: string | null; + addonId?: string; } interface CalendarSection { @@ -219,6 +220,7 @@ export const useCalendarData = (): UseCalendarDataReturn => { vote_average: tmdbEpisode.vote_average || 0, still_path: tmdbEpisode.still_path || null, season_poster_path: tmdbEpisode.season_poster_path || null + addonId: series.addonId, }; @@ -245,6 +247,7 @@ export const useCalendarData = (): UseCalendarDataReturn => { vote_average: 0, still_path: null, season_poster_path: null + addonId: series.addonId, } }; } @@ -265,6 +268,7 @@ export const useCalendarData = (): UseCalendarDataReturn => { vote_average: 0, still_path: null, season_poster_path: null + addonId: series.addonId, } }; } diff --git a/src/hooks/useFeaturedContent.ts b/src/hooks/useFeaturedContent.ts index cd4c27c5..279fdb28 100644 --- a/src/hooks/useFeaturedContent.ts +++ b/src/hooks/useFeaturedContent.ts @@ -103,6 +103,7 @@ export function useFeaturedContent() { id: item.id, type: item.type, name: item.name, + addonId: item.addonId, poster: item.poster, banner: (item as any).banner, logo: (item as any).logo, @@ -537,4 +538,4 @@ export function useFeaturedContent() { isItemSaved, refreshFeatured }; -} \ No newline at end of file +} diff --git a/src/hooks/useMetadata.ts b/src/hooks/useMetadata.ts index ce4231f7..ba8c7443 100644 --- a/src/hooks/useMetadata.ts +++ b/src/hooks/useMetadata.ts @@ -909,8 +909,13 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat // Centralized logo fetching logic try { + if (addonLogo) { + finalMetadata.logo = addonLogo; + if (__DEV__) { + console.log('[useMetadata] Using addon-provided logo:', { hasLogo: true }); + } // Check both master switch AND granular logos setting - if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichLogos) { + } else if (settings.enrichMetadataWithTMDB && settings.tmdbEnrichLogos) { // Only use TMDB logos when both enrichment AND logos option are ON const tmdbService = TMDBService.getInstance(); const preferredLanguage = settings.tmdbLanguagePreference || 'en'; @@ -2464,4 +2469,4 @@ export const useMetadata = ({ id, type, addonId }: UseMetadataProps): UseMetadat collectionMovies, loadingCollection, }; -}; \ No newline at end of file +}; diff --git a/src/services/catalogService.ts b/src/services/catalogService.ts index 221b883e..869a7cbd 100644 --- a/src/services/catalogService.ts +++ b/src/services/catalogService.ts @@ -54,6 +54,7 @@ export interface StreamingContent { id: string; type: string; name: string; + addonId?: string; tmdbId?: number; poster: string; posterShape?: 'poster' | 'square' | 'landscape'; @@ -835,6 +836,7 @@ class CatalogService { id: meta.id, type: meta.type, name: meta.name, + addonId, poster: posterUrl, posterShape: meta.posterShape || 'poster', // Use addon's shape or default to poster type banner: meta.background, @@ -857,6 +859,7 @@ class CatalogService { id: meta.id, type: meta.type, name: meta.name, + addonId, poster: meta.poster || 'https://via.placeholder.com/300x450/cccccc/666666?text=No+Image', posterShape: meta.posterShape || 'poster', banner: meta.background, diff --git a/src/services/storageService.ts b/src/services/storageService.ts index 9a2b4f7d..70946f2a 100644 --- a/src/services/storageService.ts +++ b/src/services/storageService.ts @@ -5,6 +5,7 @@ interface WatchProgress { currentTime: number; duration: number; lastUpdated: number; + addonId?: string; traktSynced?: boolean; traktLastSynced?: number; traktProgress?: number; @@ -707,4 +708,4 @@ class StorageService { } } -export const storageService = StorageService.getInstance(); \ No newline at end of file +export const storageService = StorageService.getInstance();