fix(todo): a snoozed reminder back at the minute too (ADR 0033, D31)
A snooze was scheduled inexact, as snoozes are minutes long; an idle phone may bring an inexact alarm back later than the snooze lasts. With USE_EXACT_ALARM (D31) Android lets the app wake at the minute, so a snoozed reminder is exactAllowWhileIdle too wherever the plugin says it can schedule exactly, and inexact where it can't (Android 12 with the permission taken back). Whats-New: A snoozed reminder comes back on the minute. Whats-New-De: Eine geschlummerte Erinnerung kommt pünktlich wieder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
82f1bf2739
commit
c00169acbc
2 changed files with 16 additions and 3 deletions
|
|
@ -54,14 +54,25 @@ Future<void> _scheduleSnoozed(
|
|||
return;
|
||||
}
|
||||
try {
|
||||
// Back at the minute too, where Android lets the app wake then
|
||||
// (USE_EXACT_ALARM, D31): an inexact alarm may come many minutes late
|
||||
// while the phone idles, longer than a short snooze lasts.
|
||||
final exact =
|
||||
await plugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.canScheduleExactNotifications() ??
|
||||
true;
|
||||
await plugin.zonedSchedule(
|
||||
id: back.notice.id,
|
||||
title: back.notice.title,
|
||||
body: back.notice.body,
|
||||
scheduledDate: tz.TZDateTime.from(back.notice.at.toUtc(), tz.UTC),
|
||||
notificationDetails: details,
|
||||
// Snoozed for minutes, not to the minute: no exact alarm needed.
|
||||
androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle,
|
||||
androidScheduleMode: exact
|
||||
? AndroidScheduleMode.exactAllowWhileIdle
|
||||
: AndroidScheduleMode.inexactAllowWhileIdle,
|
||||
payload: back.payload,
|
||||
);
|
||||
} on Object catch (error) {
|
||||
|
|
|
|||
|
|
@ -594,7 +594,9 @@ The developer's review of 4 Nov 2026, again beside Todoist's screens.
|
|||
declared for Android 12 and 12L, which don't know the other, up to API 32 alone
|
||||
(`test/android/exact_alarms_test.dart`). `AlarmManager.canScheduleExactAlarms` is
|
||||
true with either, so the plugin's `canScheduleExactNotifications` is, and reminders
|
||||
are `exactAllowWhileIdle`. *Alternatives:* leading the person to *Alarms &
|
||||
are `exactAllowWhileIdle`, a snoozed reminder too (the developer's, as it had been
|
||||
inexact while snoozes were minutes long; an idle phone may bring an inexact one later
|
||||
than the snooze lasts). *Alternatives:* leading the person to *Alarms &
|
||||
reminders* (one more permission to ask and explain, which most would never find
|
||||
again once refused), staying inexact (reminders minutes late, which a reminder at a
|
||||
time can't be). Google Play reviews `USE_EXACT_ALARM` against that purpose; Todo is
|
||||
|
|
|
|||
Loading…
Reference in a new issue