buzz
buzz copied to clipboard
Mobile: derive the app badge from the channel list's highlight state
Problem
The mobile app badge and the channel list each decide which channels and events count as unread. When the two disagree, the badge either shows a count with no unread row (false positive) or misses an unread row (false negative). #9216 fixed one case: forum channels counted toward the badge but are not rendered in the list.
#9216 adds a shared Channel.showsInChannelList predicate and a badge/list invariant test. The list still computes its highlight state inside _SliverChannelsList (channels_page/body.dart): the channel filter, the readState.isReady gate, the first-seed gate (seeded), and computeChannelListHighlights. unreadBadgeProvider repeats part of that logic on its own.
Proposal
- Move the list's highlight state into a provider (channel filter, readiness gate, seed gate,
computeChannelListHighlights). The list renders from it, andunreadBadgeProvidercounts from it. The badge then cannot count a row the list does not show. - Replace the
channelTypestring checks with an enum and an exhaustiveswitch, so a new channel type must choose how it renders in the list and in the badge. - Extend
badge_list_invariant_test.dartto read the new provider instead of re-applying the list filter in the test. - Optional: log a debug event when the badge is above 0 after the first seed but the list has no highlighted rows, so drift shows up before users report it.
Related
- #9216
- #3383 (the same class of bug on desktop)