Matthias Nott
2026-06-11 7747e467ed7d5316c62a439a5e3e58bf891f0d73
refs
author Matthias Nott <mnott@mnsoft.org>
Thursday, June 11, 2026 09:27 +0200
committer Matthias Nott <mnott@mnsoft.org>
Thursday, June 11, 2026 09:27 +0200
commit7747e467ed7d5316c62a439a5e3e58bf891f0d73
tree 666876b660cc4a3cf647961f4f8a41b96322514b tree | zip | gz
parent 100f2bc6c8a7d4dc867c77724723a402346d3b62 view | diff
fix: clear unread counts on app foreground so badge doesn't ghost

The badge persisted at e.g. 15 after the user had effectively seen the
messages because the app re-painted PushService.setBadge(total) on
AppLifecycleState.paused from persisted unread counts, even when those
counts no longer reflected reality. Now:

- On AppLifecycleState.resumed: clear all unread counts and the icon
badge. App being foregrounded = user is here = everything is seen.
- After cold-start load: same. The brief load is kept so any code that
reads the provider sees a valid state, but it's immediately cleared
so the next background doesn't re-paint a stale total.

New messages arriving while backgrounded still accumulate fresh and
update the badge as before.
1 files modified
changed files
lib/screens/chat_screen.dart diff | view | blame | history