trakt episode marking bug fix

This commit is contained in:
tapframe 2025-11-16 17:55:38 +05:30
parent e9b38db8b4
commit 13523fbbe4
2 changed files with 31 additions and 7 deletions

View file

@ -289,7 +289,7 @@ const TabletStreamsLayout: React.FC<TabletStreamsLayoutProps> = ({
}
if (streamsEmpty) {
if (showInitialLoading || showStillFetching) {
if (showInitialLoading || showStillFetching || isAutoplayWaiting) {
return (
<View style={[styles.loadingContainer, { paddingTop: 50 }]}>
<ActivityIndicator size="large" color={colors.primary} />
@ -411,7 +411,7 @@ const TabletStreamsLayout: React.FC<TabletStreamsLayoutProps> = ({
{/* Left Panel: Movie Logo/Episode Info */}
<Animated.View style={[styles.tabletLeftPanel, leftPanelAnimatedStyle]}>
{type === 'movie' && metadata && (
{type === 'movie' && metadata ? (
<View style={styles.tabletMovieLogoContainer}>
{metadata.logo && !movieLogoError ? (
<FastImage
@ -424,9 +424,7 @@ const TabletStreamsLayout: React.FC<TabletStreamsLayoutProps> = ({
<Text style={styles.tabletMovieTitle}>{metadata.name}</Text>
)}
</View>
)}
{type === 'series' && currentEpisode && (
) : type === 'series' && currentEpisode ? (
<View style={styles.tabletEpisodeInfo}>
<Text style={[styles.streamsHeroEpisodeNumber, styles.tabletEpisodeText, styles.tabletEpisodeNumber]}>{currentEpisode.episodeString}</Text>
<Text style={[styles.streamsHeroTitle, styles.tabletEpisodeText, styles.tabletEpisodeTitle]} numberOfLines={2}>{currentEpisode.name}</Text>
@ -434,6 +432,10 @@ const TabletStreamsLayout: React.FC<TabletStreamsLayoutProps> = ({
<Text style={[styles.streamsHeroOverview, styles.tabletEpisodeText, styles.tabletEpisodeOverview]} numberOfLines={4}>{currentEpisode.overview}</Text>
)}
</View>
) : (
<View style={styles.tabletEmptyLeftPanel}>
<Text style={styles.tabletEmptyLeftPanelText}>No content information available</Text>
</View>
)}
</Animated.View>
@ -769,6 +771,17 @@ const createStyles = (colors: any) => StyleSheet.create({
lineHeight: 24,
opacity: 0.95,
},
tabletEmptyLeftPanel: {
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: '100%',
},
tabletEmptyLeftPanelText: {
color: colors.mediumEmphasis,
fontSize: 16,
fontStyle: 'italic',
},
tabletRightPanel: {
width: '60%',
flex: 1,

View file

@ -250,9 +250,20 @@ const SeriesContentComponent: React.FC<SeriesContentProps> = ({
const traktService = TraktService.getInstance();
const isAuthed = await traktService.isAuthenticated();
if (isAuthed && metadata?.id) {
const historyItems = await traktService.getWatchedEpisodesHistory(1, 400);
// Fetch multiple pages to ensure we get all episodes for shows with many seasons
// Each page has up to 100 items by default, fetch enough to cover ~12+ seasons
let allHistoryItems: any[] = [];
const pageLimit = 10; // Fetch up to 10 pages (max 1000 items) to cover extensive libraries
for (let page = 1; page <= pageLimit; page++) {
const historyItems = await traktService.getWatchedEpisodesHistory(page, 100);
if (!historyItems || historyItems.length === 0) {
break; // No more items to fetch
}
allHistoryItems = allHistoryItems.concat(historyItems);
}
historyItems.forEach(item => {
allHistoryItems.forEach(item => {
if (item.type !== 'episode') return;
const showImdb = item.show?.ids?.imdb ? `tt${item.show.ids.imdb.replace(/^tt/, '')}` : null;