fix(todo): the permission to notify asked wherever a reminder is planned, and Settings saying while it is off (ADR 0033, D31)

On a fresh install Todo's reminders never showed: the permission to notify
(Android 13's POST_NOTIFICATIONS, iOS' and macOS' alert) was asked only
where a task's sheet chose its first reminder, so reminders typed in quick
add, added by the automatic reminder or brought by sync were scheduled and
dropped by the system without a word.

Now NotificationAccess, the device's, reads whether notifications are
allowed whenever the plan holds a reminder and asks where they aren't,
once an app start, so that a refusal isn't met with the dialog again and
again; the task sheet asks through it. While reminders are planned and
notifications are off, Settings' Reminders say so, with Turn on: asked
again, and where that doesn't allow it, the system's notification settings
of the app opened (flutter_local_notifications' own call, nothing added).
Read again whenever the app comes back.

Whats-New: Todo asks to notify as soon as there is a reminder, and Settings › Reminders shows when notifications are off, with Turn on.
Whats-New-De: Todo fragt nach Benachrichtigungen, sobald es eine Erinnerung gibt, und Einstellungen › Erinnerungen zeigt, wenn sie aus sind, mit Einschalten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-04 22:35:06 +01:00
commit 82f1bf2739
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -15,9 +15,17 @@ class MemoryReminderGateway() implements ReminderGateway {
/// What the person answers when asked.
bool allowed = true;
/// Whether the app may notify now: not on a fresh install until the
/// person is asked and allows it (Android 13 on, iOS, macOS), or allows
/// it in the system's settings meanwhile.
bool enabled = false;
/// How often they were asked.
int asked = 0;
/// How often the system's notification settings of the app were opened.
int openedSettings = 0;
@override
Future<void> replace(
List<ReminderNotice> notices, {
@ -29,9 +37,17 @@ class MemoryReminderGateway() implements ReminderGateway {
replaced++;
}
@override
Future<bool> notificationsAllowed() async => enabled;
@override
Future<bool> askPermission() async {
asked++;
return allowed;
return enabled = allowed;
}
@override
Future<void> openSettings() async {
openedSettings++;
}
}