Catch Up v2: Continue watching, picture cards, search and channel filters, options while catching up

Where you leave a programme, live or catching up, is noted for whoever's watching and offered
first in Catch Up once it has aired; held OK takes it off. Cards show the programme's picture.
Search and a chip per channel filter the page. Catching up, a held OK opens subtitles, sound,
Start again, Go to a channel and Back to live. 0.108.94.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-07 15:31:16 +00:00
co-authored by Claude Opus 5.5
parent 2ef38b7f70
commit af2c78de73
8 changed files with 311 additions and 54 deletions
@@ -138,4 +138,37 @@ class CatchUpTest {
SleepTimer.set(SleepChoice.AfterThis, now, null)
assertEquals(SleepChoice.Off, SleepTimer.choice)
}
// Continue watching (Paul, 7 November 2026): where you left a programme, offered once it has aired, gone when watched.
@Test fun continueWatchingKeepsWhereYouLeftOff() {
val c = channel()
val e = c.plan.entries.last { it.endMs <= now - hour }
val show = SampleBroadcast(e.media, e.startMs, e.presentation)
var marks = notedMarks(emptyList(), c.number, show, 2 * minute, now)
assertTrue("barely begun doesn't count", marks.isEmpty())
marks = notedMarks(marks, c.number, show, 20 * minute, now)
assertEquals(1, marks.size)
val carry = continueEntries(listOf(c), marks, now).single()
assertEquals(20 * minute, carry.positionMs); assertEquals(e.startMs, carry.entry.show.startMs)
assertEquals("25 min left", leftLabel(carry.leftMs))
// Watched to the last few minutes: off the row.
assertTrue(notedMarks(marks, c.number, show, e.media.durationMs - 2 * minute, now).isEmpty())
// Still airing, or gone from Catch Up: not offered.
val live = c.plan.entries.first { it.startMs <= now && it.endMs > now }
val liveMarks = notedMarks(emptyList(), c.number, SampleBroadcast(live.media, live.startMs, live.presentation), 10 * minute, now)
assertTrue(continueEntries(listOf(c), liveMarks, now).isEmpty())
assertTrue(continueEntries(listOf(c), marks, e.startMs + CATCH_UP_MS + minute).isEmpty())
assertEquals("1 h 12 min left", leftLabel(72 * minute))
}
@Test fun catchUpFiltersByChannelAndTitle() {
val c = channel()
val e = c.plan.entries.last { it.endMs <= now }
val entry = catchUpEntry(c, SampleBroadcast(e.media, e.startMs, e.presentation))
val title = e.media.item.title
assertTrue(catchUpMatches(entry, null, ""))
assertTrue(catchUpMatches(entry, 106, title.take(6).lowercase()))
assertFalse(catchUpMatches(entry, 107, ""))
assertFalse(catchUpMatches(entry, null, "Twin Peaks"))
}
}