Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions LESSONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -669,3 +669,28 @@ The fix, and the general rule:
`darkColorScheme(...)`, Material 3 fills them with a fixed default neutral
(lavender in light, charcoal in dark) that clashes with the custom
background in menus, bottom sheets, and the navigation bar.

## 29. One delivery-mode -> channel table shared by every notification "kind", not one per feature

Overdue-chore alerts (`DailyStaleChoreWorker`) were on a single fixed
notification channel with no Do Not Disturb bypass and no Alarm/Silent
variants, while task reminders and standalone reminders already resolved one
of three channels from the global delivery-mode setting via
`NotificationHelper.channelForDeliveryMode()`. The obvious fix (copy that
function into a second `choreChannelForDeliveryMode()` plus a second
three-channel `createNotificationChannel()` block) would have worked, but it
duplicates channel ids, importance defaults, DND-bypass logic, and
legacy-channel cleanup across two near-identical code paths that can drift
independently the next time a delivery mode is added, renamed, or
re-tuned.

Instead, model every notification source as one `ReminderKind` enum
(`TASK_REMINDER`, `CHORE_ALERT`, ...) crossed with one `ChannelStyle` enum
(`ALARM`/`NOTIFICATION`/`SILENT`), stored as a single list of `ChannelDef`s
(id, name/desc string resource, importance). `createChannels()` loops that
list once instead of hand-writing a `createNotificationChannel()` call per
channel; `channelId(kind, deliveryMode)` is the one function every caller
(`AlarmReceiver`, `BootWorker`, `DailyStaleChoreWorker`) resolves through.
Adding a third notification kind later means adding rows to the table, not
a third parallel set of functions that can quietly fall out of sync with
the first two.
Loading