channels: keep the logged-in user's row when it has no videos
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 <noreply@anthropic.com>
This commit is contained in:
parent
b55288b02d
commit
31846f6eaf
1 changed files with 13 additions and 1 deletions
|
|
@ -270,7 +270,19 @@ class ChannelsViewModel(private val store: TokenStore) : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rebuildRowsInner(host: String?) {
|
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 ownNames = userChannels.map { c -> c.name }.toSet()
|
||||||
val byOwner = locals.groupBy { ownerKey(it) }
|
val byOwner = locals.groupBy { ownerKey(it) }
|
||||||
val groups = byOwner.values.map { row ->
|
val groups = byOwner.values.map { row ->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue