Meds due at the same wall-clock minute now share a single notification
instead of one card each — they resolve to an identical scheduledAtMillis,
which becomes the occurrence (and notification) key. Per the feature
request: "Tatt alle" / "Utsett alle" handle the whole morning batch in
one tap; a single med just renders as a normal card with "Tatt".
- Notification id is per-occurrence (scheduledAtMillis), not per-log, so
co-timed doses collapse onto one card and re-nags replace it.
- DoseActionReceiver buttons carry the occurrence and call group ops
(takeAll/snoozeAll/muteAll); DoseActions keeps a single per-dose state
mutation (takeState/snoozeState/muteState) reused by both the group ops
and the app's per-dose actions, so the two surfaces can't diverge.
- The card is rebuilt from getActiveAtOccurrence: still-unresolved doses
with nagCount <= cap. "Ikke forstyrr" now sets nagCount above the cap so
a muted dose drops off the card, while a naturally-capped dose (== cap)
stays visible and actionable.
- refreshOccurrence re-renders silently after a single in-app action and
never creates a card for a not-yet-due occurrence.
Adds DoseActionsGroupTest (instrumented) covering takeAll, muteAll, and
the muted-vs-capped distinction at the data layer.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two ways to stop the every-10-min nag, per feature request:
- A global "Gjenta påminnelser" switch in Settings. Off → a due dose
alerts once and goes quiet; only the automatic re-nag chain is gated,
so an explicit "Utsett 15 min" still gives one more reminder. The gate
sits at the three automatic arm points (fireOccurrence, escalate
re-arm, armAll resume-after-reboot), never on Snooze.
- An "Ikke forstyrr" action that appears from the second reminder on
(nagCount >= 1). It stops nagging this one dose but leaves it PENDING
so it can still be taken later — distinct from Skip. Implemented by
jumping to the existing terminal state (nagCount = NAG_CAP) rather than
a new column, so it needs no migration and survives reboot for free
(armAll re-arms only nagCount < cap).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Milestone 9. Hand-rolled back-stack navigation (4 screens don't justify
navigation-compose). DoseActions is now the single implementation of
Taken/Snooze/Skip/Undo shared by notification receiver and UI — two
code paths for 'taken' would eventually disagree about inventory.
Screens read DAO Flows directly; every schedule mutation re-arms
alarms via armAll() (idempotent, OS-deduplicated). One-time battery
prompt + POST_NOTIFICATIONS request on the today screen. Settings:
S3/Garage config, typed-passphrase export/import (replace-all import
re-arms alarms), FEST refresh, PDF share. TalkBack: merged semantics
with full descriptions on dose cards, content descriptions on icon
buttons and day chips. Doctor PDF locale pinned to Bokmål — verified
on emulator after catching English month names on an en-US device.
Emulator-verified end-to-end: battery prompt → system dialog, med
created via editor (validation catches bad input), dose time added →
exact alarm armed immediately, Ta nå → TAKEN + inventory 20→19 +
reactive UI update, Angre → PENDING + inventory restored, settings
renders, PDF generated and share sheet opened.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Milestone 4. AlarmScheduler is the only AlarmManager writer; one stable
PendingIntent requestCode per dose-time means re-arming replaces and can
never stack (the no-drift invariant is OS-enforced). DoseAlarmReceiver
handles both occurrence and escalation alarms idempotently and always
re-arms the next occurrence before anything else so the chain can't
break. nagCount lives in dose_log so the ~6-nag cap survives reboot.
SCHEDULE_EXACT_ALARM added maxSdk 32 (USE_EXACT_ALARM is 33+ only).
Emulator-verified (API 35): exact alarm armed (window=0,
policy_permission), fired on time, HIGH notification with Tatt/Utsett,
escalation armed +10 min, next day re-armed, Tatt → TAKEN + inventory
10→9 + escalation cancelled, reboot → BootReceiver re-armed everything.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>