The drawer (FolderDrawer.kt) lists each account's folders with a friendly label and role icon
(folderDisplayLabel/folderIcon, FolderDrawer.kt:129-150), but gives no indication of how much
unread mail each folder holds. Folder (domain/model/Folder.kt) carries no count, and neither FolderDao nor MessageDao exposes a per-folder unread aggregate today — MessageDao only reads/writes
row-level isRead (no GROUP BY query), and FolderDao.observeForAccount/getForAccountOnce just
return the folder list.
Proposed behavior
Each folder row in the drawer shows its unread count when > 0 (e.g. "Inbox 12"), the common mail-client
convention. Material3's NavigationDrawerItem already has a badge slot
(NavigationDrawerItem(..., badge = { Text(count.toString()) })), so the drawer-side change is additive
once the count is available.
Suggested approach
Add a MessageDao query aggregating unread, synced (inInbox = 1) rows per folder for an account,
e.g. SELECT folder, COUNT(*) AS count FROM messages WHERE accountId = :accountId AND inInbox = 1 AND isRead = 0 GROUP BY folder, exposed as a Flow Room can map to a small data class or Map<String, Int>.
Thread it through MailRepository/MailboxViewModel alongside folders (MailboxViewModel.kt:80-88),
since FolderDrawer already receives the List<Folder> that would carry (or be zipped with) counts.
Pass the count into NavigationDrawerItem's badge in FolderDrawer.kt:91-101.
Hide the badge at 0 (matches how the Drafts/Outbox banners already hide at 0 in MailboxScreen.kt:257-264); consider a display cap (e.g. "99+") for very large counts.
Shares its data plumbing with #84 (bold account rows for unread mail) — worth building the underlying
per-account/per-folder unread-count source once and consuming it from both places.
Acceptance criteria
Each folder in the drawer shows its unread count when > 0, and nothing when 0.
Counts update live as mail is read/synced, with no manual refresh needed.
Unit test for the new DAO query / repository aggregation.
## Context
The drawer (`FolderDrawer.kt`) lists each account's folders with a friendly label and role icon
(`folderDisplayLabel`/`folderIcon`, `FolderDrawer.kt:129-150`), but gives no indication of how much
unread mail each folder holds. `Folder` (`domain/model/Folder.kt`) carries no count, and neither
`FolderDao` nor `MessageDao` exposes a per-folder unread aggregate today — `MessageDao` only reads/writes
row-level `isRead` (no `GROUP BY` query), and `FolderDao.observeForAccount`/`getForAccountOnce` just
return the folder list.
## Proposed behavior
Each folder row in the drawer shows its unread count when > 0 (e.g. "Inbox 12"), the common mail-client
convention. Material3's `NavigationDrawerItem` already has a `badge` slot
(`NavigationDrawerItem(..., badge = { Text(count.toString()) })`), so the drawer-side change is additive
once the count is available.
## Suggested approach
1. Add a `MessageDao` query aggregating unread, synced (`inInbox = 1`) rows per folder for an account,
e.g. `SELECT folder, COUNT(*) AS count FROM messages WHERE accountId = :accountId AND inInbox = 1 AND
isRead = 0 GROUP BY folder`, exposed as a `Flow` Room can map to a small data class or `Map<String, Int>`.
2. Thread it through `MailRepository`/`MailboxViewModel` alongside `folders` (`MailboxViewModel.kt:80-88`),
since `FolderDrawer` already receives the `List<Folder>` that would carry (or be zipped with) counts.
3. Pass the count into `NavigationDrawerItem`'s `badge` in `FolderDrawer.kt:91-101`.
4. Hide the badge at 0 (matches how the Drafts/Outbox banners already hide at 0 in
`MailboxScreen.kt:257-264`); consider a display cap (e.g. "99+") for very large counts.
Shares its data plumbing with #84 (bold account rows for unread mail) — worth building the underlying
per-account/per-folder unread-count source once and consuming it from both places.
## Acceptance criteria
- [ ] Each folder in the drawer shows its unread count when > 0, and nothing when 0.
- [ ] Counts update live as mail is read/synced, with no manual refresh needed.
- [ ] Unit test for the new DAO query / repository aggregation.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Context
The drawer (
FolderDrawer.kt) lists each account's folders with a friendly label and role icon(
folderDisplayLabel/folderIcon,FolderDrawer.kt:129-150), but gives no indication of how muchunread mail each folder holds.
Folder(domain/model/Folder.kt) carries no count, and neitherFolderDaonorMessageDaoexposes a per-folder unread aggregate today —MessageDaoonly reads/writesrow-level
isRead(noGROUP BYquery), andFolderDao.observeForAccount/getForAccountOncejustreturn the folder list.
Proposed behavior
Each folder row in the drawer shows its unread count when > 0 (e.g. "Inbox 12"), the common mail-client
convention. Material3's
NavigationDrawerItemalready has abadgeslot(
NavigationDrawerItem(..., badge = { Text(count.toString()) })), so the drawer-side change is additiveonce the count is available.
Suggested approach
MessageDaoquery aggregating unread, synced (inInbox = 1) rows per folder for an account,e.g.
SELECT folder, COUNT(*) AS count FROM messages WHERE accountId = :accountId AND inInbox = 1 AND isRead = 0 GROUP BY folder, exposed as aFlowRoom can map to a small data class orMap<String, Int>.MailRepository/MailboxViewModelalongsidefolders(MailboxViewModel.kt:80-88),since
FolderDraweralready receives theList<Folder>that would carry (or be zipped with) counts.NavigationDrawerItem'sbadgeinFolderDrawer.kt:91-101.MailboxScreen.kt:257-264); consider a display cap (e.g. "99+") for very large counts.Shares its data plumbing with #84 (bold account rows for unread mail) — worth building the underlying
per-account/per-folder unread-count source once and consuming it from both places.
Acceptance criteria