Skip to content

fix(detail): surface rewatch resume state for played items - #2

Closed
Quick104 wants to merge 2 commits into
mainfrom
fix/continue-watching-rewatch-parity
Closed

Quick104 wants to merge 2 commits into
mainfrom
fix/continue-watching-rewatch-parity

Conversation

@Quick104

@Quick104 Quick104 commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Context

Server PR silo-server#117 changes the watch-progress model: completed/played becomes a one-way watched latch and watched items now report position_seconds: 0 instead of position pinned to the duration. A rewatch of a watched item reports played: true with a live nonzero position, and such items now appear in the Continue Watching source (GET /progress, home sections), which keys on position > 0.

A full audit of this repo found the client almost entirely position-driven already — resume seek targets read positionSeconds directly, watched badges key on played, progress fractions guard on 0 < position < duration, and next-unwatched selection filters on played != true. Two detail-screen spots still assumed the old played ⇒ position == duration coupling:

Changes

  • computePlayLabel (DetailSharedComponents.kt): the "Resume H:MM" label was gated on !played, so during a rewatch the button said "Play" while tapping it actually resumed mid-stream (the player seeks to userData.positionSeconds unconditionally). Any nonzero position is now a live resume point, so the gate is removed.
  • EpisodeRow (EpisodeList.kt): the episode progress bar was suppressed for played episodes — necessary under the old model where played rows carried a stale 100% position, but it hid the bar for a rewatch in flight. The condition is now position > 0: rewatched episodes show their bar (alongside the watched checkmark, matching the web app and Jellyfin/Plex), and watched episodes (position 0) stay clean.

Audited and unchanged because already compatible: phone/TV player resume seek, TvItemDetailScreen.resumePositionSeconds() (position-gated), TvMediaCard/MediaRow/FeaturedCarousel/TvDetailEpisodeRail progress fractions, next-unwatched episode selection, watched badge rendering, and PlaybackSessionLifecycle (reports position only, never derives played locally).

Behavior notes

  • Old servers: behavior is unchanged in practice — under the old model a watched item's position equals its duration only until the server migration runs; this PR is intended to ship alongside/after feat(android): production-ready Watch Together (PR 108 slice F) #117.
  • Known cross-platform difference left as-is: on the season screen, iOS prefers an in-progress episode as "next up" while Android picks the first unwatched episode regardless of an active rewatch. Pre-existing, not a regression; can be aligned in a follow-up if desired.

Testing

./gradlew :androidApp:compileDebugKotlin clean. UI-level change only; no unit tests cover these composables today.


AI-use disclosure: implemented with Claude (Claude Code), reviewed by the maintainer.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Resume labels now appear whenever a saved position >30s is present and passes a duration sanity check, so “Resume …” shows reliably.
    • Progress bars now display for episodes with valid position/duration even if marked as watched.
    • Resume labeling takes precedence over episode-specific “Play …” formatting so in-progress items show “Resume” first.

Server PR Silo-Server/silo-server#117 changed the watch-progress model:
watched items now report position_seconds = 0 and a rewatch in flight
reports played = true WITH a live nonzero position (one-way watched
latch, Jellyfin-style). Two detail-screen spots still assumed the old
model where played implied position == duration:

- computePlayLabel gated the "Resume H:MM" label on !played, so a
  rewatch showed "Play" while playback actually resumed mid-stream.
  Any nonzero position is now a live resume point, so the gate goes.
- EpisodeRow suppressed the episode progress bar on played episodes
  (needed before, when played rows carried a stale 100% position).
  Gate on position > 0 instead so a rewatched episode shows its bar
  and watched episodes (position 0) stay clean.

Everything else (resume seek, watched badges, progress fractions,
next-unwatched selection, TV app) was audited and already keys on
position/played correctly under the new model.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 94356666-babc-41fc-859e-297a7b520273

📥 Commits

Reviewing files that changed from the base of the PR and between b154777 and 5dbadc2.

📒 Files selected for processing (2)
  • androidApp/src/androidMain/kotlin/com/continuum/app/android/ui/screens/detail/DetailSharedComponents.kt
  • androidApp/src/androidMain/kotlin/com/continuum/app/android/ui/screens/detail/EpisodeList.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • androidApp/src/androidMain/kotlin/com/continuum/app/android/ui/screens/detail/EpisodeList.kt

📝 Walkthrough

Walkthrough

The PR shows resume UI (label and progress) whenever the server supplies a nonzero resume position (with bounds/duration checks), removing played-status guards and adjusting label ordering so resume can take precedence for in-progress episodes.

Changes

Resume state handling for watched episodes

Layer / File(s) Summary
computePlayLabel: resume eligibility and ordering
androidApp/src/androidMain/kotlin/com/continuum/app/android/ui/screens/detail/DetailSharedComponents.kt
Resume condition now uses positionSeconds > 30 plus duration sanity checks and drops the played suppression; episode-specific “Play S…·E…” / “Play E…” formatting was moved after the resume logic.
EpisodeRow: progress eligibility
androidApp/src/androidMain/kotlin/com/continuum/app/android/ui/screens/detail/EpisodeList.kt
Progress bar now displays when pos and dur are present and 0 < pos < dur, removing the !isPlayed gate so watched items with a resume point show the progress indicator.
sequenceDiagram
  participant ClientUI as Client UI
  participant Server as Server (userData)
  participant computePlayLabel as computePlayLabel
  participant EpisodeRow as EpisodeRow
  ClientUI->>Server: request userData (positionSeconds, durationSeconds)
  Server-->>ClientUI: userData
  ClientUI->>computePlayLabel: computePlayLabel(userData)
  computePlayLabel-->>ClientUI: label ("Resume …" or "Play …")
  ClientUI->>EpisodeRow: render row with pos/dur
  EpisodeRow-->>ClientUI: progress bar visible when 0 < pos < dur
Loading

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(detail): surface rewatch resume state for played items' directly and specifically describes the main change: enabling resume functionality for rewatched (played) items on the detail screen.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/continue-watching-rewatch-parity

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1547772ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

val pos = detail.userData?.positionSeconds
val played = detail.userData?.played == true
if (pos != null && pos > 30 && !played) {
if (pos != null && pos > 30) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check resume position before episode label

For episode detail pages, this new resume condition is still unreachable because the detail.type == "episode" branch above returns Play S…·E… before looking at userData.positionSeconds. In the rewatch state this commit is handling (played == true with a live nonzero position), tapping the primary button will resume via the player, but the label remains Play Sx·Ey instead of surfacing the resume time; move the position-based label ahead of the episode label (or explicitly handle episode resume first).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5dbadc2 — the position check now runs before the episode-label branch, so an episode with a live resume point reads "Resume H:MM" (matching what tapping the button actually does) and falls back to "Play Sx·Ey" otherwise.

Comment on lines 78 to 79
val progress = if (pos != null && dur != null && dur > 0 && pos > 0) {
(pos / dur).toFloat().coerceIn(0f, 1f)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Hide bars for completed positions

When the app is pointed at a pre-migration server or stale cached/detail data where a watched episode still carries positionSeconds == durationSeconds, this condition now treats that completed position as in-progress and draws a full progress bar on every watched episode. Adding the same upper-bound check used by the TV detail rail (pos < dur) would still show active rewatches while preserving the clean watched-row state for completed items.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5dbadc2 — added the pos < dur upper bound (same as the TV detail rail), so stale pre-migration rows with position pinned to the duration render clean watched rows instead of full bars.

val pos = detail.userData?.positionSeconds
val played = detail.userData?.played == true
if (pos != null && pos > 30 && !played) {
if (pos != null && pos > 30) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject completed positions in the resume label

For movie/detail data that still contains the old watched representation (played == true with positionSeconds pinned at the duration), removing the !played guard makes the primary CTA show Resume <duration> even though there is no live resume point. Since LeafItemUserData includes durationSeconds, gate this label the way the TV detail screen does (pos < dur - 5) so completed/stale positions still render as Play while active rewatches continue to show Resume.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5dbadc2 — the label is now gated with pos < dur - 5 (matching TvItemDetailScreen.resumePositionSeconds), so stale completed positions render "Play" while live rewatches keep "Resume". When the duration is unknown the position-only check still applies.

… bounds

- Check the resume position before the episode-label branch in
  computePlayLabel: it returned "Play Sx·Ey" first, making the
  "Resume H:MM" label unreachable on episode pages even though tapping
  the button resumes.
- Bound both the resume label (pos < dur - 5, matching the TV detail
  screen) and the episode progress bar (pos < dur, matching the TV
  rail) so stale pre-migration data — watched rows with the position
  still pinned to the duration — renders as Play with no bar instead
  of "Resume <duration>" and a full bar.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants