From ae9af2bbdfae544735898af7a8842ebe720e49e2 Mon Sep 17 00:00:00 2001 From: kalzEOS <49320606+kalzEOS@users.noreply.github.com> Date: Sun, 17 May 2026 20:34:38 -0400 Subject: [PATCH] Fix Continue Watching series card delay --- app/build.gradle.kts | 4 +- .../example/xtreamplayer/MainActivityUi.kt | 41 +++++++++++++------ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7b221e7..cf7e2c0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -3,8 +3,8 @@ import java.util.Properties import org.gradle.api.provider.Property import org.jetbrains.kotlin.gradle.dsl.JvmTarget -val appVersionCode = 144 -val appVersionName = "3.4.8" +val appVersionCode = 145 +val appVersionName = "3.4.9" plugins { alias(libs.plugins.android.application) diff --git a/app/src/main/java/com/example/xtreamplayer/MainActivityUi.kt b/app/src/main/java/com/example/xtreamplayer/MainActivityUi.kt index add8fbd..997119b 100644 --- a/app/src/main/java/com/example/xtreamplayer/MainActivityUi.kt +++ b/app/src/main/java/com/example/xtreamplayer/MainActivityUi.kt @@ -8744,6 +8744,24 @@ private data class ContinueWatchingDisplayEntry( val timestampMs: Long ) +private fun provisionalContinueWatchingSeriesParent(item: ContentItem): ContentItem? { + if (item.contentType != ContentType.SERIES || item.containerExtension.isNullOrBlank()) { + return null + } + val parentSeriesId = item.parentSeriesId?.takeUnless { it.isBlank() } ?: return null + val parentTitle = stripEpisodeSuffixes(item.title).takeUnless { it.isBlank() } ?: item.title + return item.copy( + id = parentSeriesId, + title = parentTitle, + subtitle = "", + section = Section.SERIES, + contentType = ContentType.SERIES, + streamId = parentSeriesId, + containerExtension = null, + parentSeriesId = null + ) +} + @Composable fun ContinueWatchingScreen( title: String, @@ -8781,9 +8799,8 @@ fun ContinueWatchingScreen( remember { androidx.compose.runtime.mutableStateMapOf() } val posterFontScale = remember(columns) { 4f / columns.toFloat() } val resolvedParentsSnapshot = resolvedParents.toMap() - val parentResolutionAttemptedSnapshot = parentResolutionAttempted.toMap() val displayEntries = - remember(continueWatchingItems, resolvedParentsSnapshot, parentResolutionAttemptedSnapshot) { + remember(continueWatchingItems, resolvedParentsSnapshot) { fun displayGroupingKey(entry: ContinueWatchingEntry): String { val canonicalSeriesId = entry.parentItem?.streamId?.takeUnless { it.isBlank() } @@ -8820,17 +8837,11 @@ fun ContinueWatchingScreen( } .maxByOrNull { it.first } ?.second - val waitingForParentResolution = - group.any { entry -> - entry.item.contentType == ContentType.SERIES && - entry.parentItem == null && - !resolvedParentsSnapshot.containsKey(entry.key) && - parentResolutionAttemptedSnapshot[entry.key] != true - } - if (latestSeriesParent == null && waitingForParentResolution) { - return@mapNotNull null - } - val displayItem = latestSeriesParent ?: latest.item + val provisionalSeriesParent = + latestSeriesParent + ?: latest.parentItem + ?: provisionalContinueWatchingSeriesParent(latest.item) + val displayItem = provisionalSeriesParent ?: latest.item val resumeLabel = if (latest.item.contentType == ContentType.SERIES) { formatEpisodeLabel(latest.item, separator = " - ")?.let { "Resume $it" } @@ -9210,6 +9221,10 @@ fun ContinueWatchingScreen( val seriesItem = resolvedParent ?: entry.parentItem + ?: item.takeIf { + it.contentType == ContentType.SERIES && + it.containerExtension.isNullOrBlank() + } if (seriesItem != null) { returnFocusItem = item pendingResumeItem = entry.resumeItem