buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Mobile: derive the app badge from the channel list's highlight state

Open blakemcanally opened this issue 3 weeks ago • 0 comments

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

  1. Move the list's highlight state into a provider (channel filter, readiness gate, seed gate, computeChannelListHighlights). The list renders from it, and unreadBadgeProvider counts from it. The badge then cannot count a row the list does not show.
  2. Replace the channelType string checks with an enum and an exhaustive switch, so a new channel type must choose how it renders in the list and in the badge.
  3. Extend badge_list_invariant_test.dart to read the new provider instead of re-applying the list filter in the test.
  4. 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)

blakemcanally avatar Nov 06 '26 20:11 blakemcanally