Pick up a channel of your own whose first plan was cut short

Switched on but never planned (an update arrived mid-read) left it with no loop, so the hourly
round skipped it until someone pressed its switch. The round now plans it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-07 15:00:37 +00:00
co-authored by Claude Opus 5.5
parent dec0628a5a
commit 801a82ce73
@@ -366,6 +366,8 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
delay(5 * 60_000L)
}
}
// A channel of your own whose first plan was cut short, picked up again (set by the round below, run once setSmartSchedule exists).
var resumeNumber by remember { mutableStateOf<Int?>(null) }
// Keeps smart channels topped up in the background. A failure changes nothing on air.
LaunchedEffect(session, extraChannels, channel, afterDarkChannel, toonamiChannel) {
val active = session ?: return@LaunchedEffect
@@ -381,7 +383,13 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
delay(3_000)
while (true) {
for (programming in SmartChannels) {
val loop = smartLoop(programming) ?: continue
val loop = smartLoop(programming) ?: run {
// A channel of your own that is switched on but whose first plan never finished (an update arrived mid-read,
// 7 November 2026) has no loop yet: plan it now rather than leave it waiting for a press.
if (CustomChannels.of(programming.number) != null && !busy && withContext(Dispatchers.IO) { scheduler.enabled(active.accountId, programming.number) })
resumeNumber = programming.number
null
} ?: continue
try {
withContext(Dispatchers.IO) {
if (scheduler.enabled(active.accountId, programming.number)) {
@@ -535,6 +543,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
finally { busy = false; CustomChannels.planning = null }
}
}
LaunchedEffect(resumeNumber) { resumeNumber?.let { n -> SmartChannels.firstOrNull { it.number == n }?.let { setSmartSchedule(it, true) }; resumeNumber = null } }
// Create your own from a phone and the Companion: kept here, before any screen returns early, so the phone can make
// and edit channels from every section, not only while Settings is open (Paul, 7 November 2026).
var lastRemoved by remember { mutableStateOf<Pair<CustomChannel, Long>?>(null) }