@@ -8744,6 +8744,24 @@ private data class ContinueWatchingDisplayEntry(
87448744 val timestampMs: Long
87458745)
87468746
8747+ private fun provisionalContinueWatchingSeriesParent(item: ContentItem): ContentItem? {
8748+ if (item.contentType != ContentType.SERIES || item.containerExtension.isNullOrBlank()) {
8749+ return null
8750+ }
8751+ val parentSeriesId = item.parentSeriesId?.takeUnless { it.isBlank() } ?: return null
8752+ val parentTitle = stripEpisodeSuffixes(item.title).takeUnless { it.isBlank() } ?: item.title
8753+ return item.copy(
8754+ id = parentSeriesId,
8755+ title = parentTitle,
8756+ subtitle = "",
8757+ section = Section.SERIES,
8758+ contentType = ContentType.SERIES,
8759+ streamId = parentSeriesId,
8760+ containerExtension = null,
8761+ parentSeriesId = null
8762+ )
8763+ }
8764+
87478765@Composable
87488766fun ContinueWatchingScreen(
87498767 title: String,
@@ -8781,9 +8799,8 @@ fun ContinueWatchingScreen(
87818799 remember { androidx.compose.runtime.mutableStateMapOf<String, Boolean>() }
87828800 val posterFontScale = remember(columns) { 4f / columns.toFloat() }
87838801 val resolvedParentsSnapshot = resolvedParents.toMap()
8784- val parentResolutionAttemptedSnapshot = parentResolutionAttempted.toMap()
87858802 val displayEntries =
8786- remember(continueWatchingItems, resolvedParentsSnapshot, parentResolutionAttemptedSnapshot ) {
8803+ remember(continueWatchingItems, resolvedParentsSnapshot) {
87878804 fun displayGroupingKey(entry: ContinueWatchingEntry): String {
87888805 val canonicalSeriesId =
87898806 entry.parentItem?.streamId?.takeUnless { it.isBlank() }
@@ -8820,17 +8837,11 @@ fun ContinueWatchingScreen(
88208837 }
88218838 .maxByOrNull { it.first }
88228839 ?.second
8823- val waitingForParentResolution =
8824- group.any { entry ->
8825- entry.item.contentType == ContentType.SERIES &&
8826- entry.parentItem == null &&
8827- !resolvedParentsSnapshot.containsKey(entry.key) &&
8828- parentResolutionAttemptedSnapshot[entry.key] != true
8829- }
8830- if (latestSeriesParent == null && waitingForParentResolution) {
8831- return@mapNotNull null
8832- }
8833- val displayItem = latestSeriesParent ?: latest.item
8840+ val provisionalSeriesParent =
8841+ latestSeriesParent
8842+ ?: latest.parentItem
8843+ ?: provisionalContinueWatchingSeriesParent(latest.item)
8844+ val displayItem = provisionalSeriesParent ?: latest.item
88348845 val resumeLabel =
88358846 if (latest.item.contentType == ContentType.SERIES) {
88368847 formatEpisodeLabel(latest.item, separator = " - ")?.let { "Resume $it" }
@@ -9210,6 +9221,10 @@ fun ContinueWatchingScreen(
92109221 val seriesItem =
92119222 resolvedParent
92129223 ?: entry.parentItem
9224+ ?: item.takeIf {
9225+ it.contentType == ContentType.SERIES &&
9226+ it.containerExtension.isNullOrBlank()
9227+ }
92139228 if (seriesItem != null) {
92149229 returnFocusItem = item
92159230 pendingResumeItem = entry.resumeItem
0 commit comments