From 31846f6eaf926a34cbdff0c96d82a586d2c72c25 Mon Sep 17 00:00:00 2001 From: Jeena Date: Mon, 19 Oct 2026 14:09:27 +0000 Subject: [PATCH] channels: keep the logged-in user's row when it has no videos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The per-user rows are built from the local video listing, so a channel that never uploaded is invisible to the row build — and an account that owns only such channels lost its row entirely. tvbot is exactly that case: the local tvbots channel exists, it has no videos, and while logged in as tvbot the screen opened on the next user's channels. The row build now merges the logged-in user's own local channels from the account-channels listing (already fetched, carries the full card data) into the locals before grouping; the group sort already puts the own row first. Verified on the emulator logged in as tvbot: the "tvbot's Channels" row renders first with the video-less tvbots card. Co-Authored-By: Claude --- .../net/jeena/jtubetv/ui/screens/ChannelsScreen.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/jeena/jtubetv/ui/screens/ChannelsScreen.kt b/app/src/main/java/net/jeena/jtubetv/ui/screens/ChannelsScreen.kt index 7502c04..26bdd54 100644 --- a/app/src/main/java/net/jeena/jtubetv/ui/screens/ChannelsScreen.kt +++ b/app/src/main/java/net/jeena/jtubetv/ui/screens/ChannelsScreen.kt @@ -270,7 +270,19 @@ class ChannelsViewModel(private val store: TokenStore) : ViewModel() { } private fun rebuildRowsInner(host: String?) { - val locals = allChannels.filter { it.host == host } + val allLocals = allChannels.filter { it.host == host } + // The video-listing fast path cannot see channels with no videos at all — + // an account owning only such channels used to lose its row entirely + // (tvbot: the local tvbots channel exists, it just never uploaded). Merge + // the logged-in user's own local channels in; the group sort below still + // puts the own row first. The account-channels listing already carries + // the full card shape (avatar/banners/followers), no extra calls. + var locals = allLocals + if (userChannels.isNotEmpty()) { + val missing = userChannels + .filter { it.host == host && allLocals.none { l -> l.name == it.name } } + if (missing.isNotEmpty()) locals = allLocals + missing + } val ownNames = userChannels.map { c -> c.name }.toSet() val byOwner = locals.groupBy { ownerKey(it) } val groups = byOwner.values.map { row ->