diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt index e4f94532..db2a71cf 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt @@ -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(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?>(null) }