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
1 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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue