feat(todo): Settings' Tasks and Reminders, with Snooze on a reminder (ADR 0033, D4)
Settings gains Todo's own groups, kept in the person's sealed settings row on every device. Tasks: the weekday weeks start on (the language's unless set), which the week strip, the date and repeat pickers and the filters follow; and whether a recurring task done opens its sub-tasks again (on at first). Reminders: an automatic reminder (none at first) that TaskRepository writes into a task gaining a time without reminders of its own, and how long a reminder is snoozed for (15 minutes at first). Each reminder's notification has a Snooze action on Android and Linux: the reminder comes back that much later under an ID of its own, scheduled from what the notification carries, so on Android with the app closed too (the plugin's ActionBroadcastReceiver declared); the plan of the person's reminders leaves snoozed ones alone. iOS, macOS and Windows get it later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
2939437c74
commit
51ebed41cd
1 changed files with 1204 additions and 69 deletions
|
|
@ -68,4 +68,48 @@ void main() {
|
|||
);
|
||||
expect(decodeSettings(payload({'schemaVersion': 2})), isNull);
|
||||
});
|
||||
|
||||
test("D4's settings of tasks and reminders read back as they were set", () {
|
||||
const settings = TodoSettings(
|
||||
tasks: TaskSettings(weekStart: DateTime.sunday, resetSubTasks: false),
|
||||
reminders: ReminderSettings(automatic: 30, snooze: 10),
|
||||
);
|
||||
expect(decodeSettings(encodeSettings(settings)), settings);
|
||||
expect(written(settings), {
|
||||
'schemaVersion': 1,
|
||||
'tasks': {'weekStart': 7, 'resetSubTasks': false},
|
||||
'reminders': {'automatic': 30, 'snooze': 10},
|
||||
});
|
||||
expect(
|
||||
decodeSettings(
|
||||
encodeSettings(
|
||||
const TodoSettings(reminders: ReminderSettings(automatic: 0)),
|
||||
),
|
||||
),
|
||||
const TodoSettings(reminders: ReminderSettings(automatic: 0)),
|
||||
reason: 'at the time itself is a reminder too',
|
||||
);
|
||||
});
|
||||
|
||||
test('at first: the week from the language, sub-tasks reset, no automatic '
|
||||
'reminder, snoozed for 15 minutes', () {
|
||||
const settings = TodoSettings();
|
||||
expect(settings.tasks.weekStart, isNull);
|
||||
expect(settings.tasks.resetSubTasks, isTrue);
|
||||
expect(settings.reminders.automatic, isNull);
|
||||
expect(settings.reminders.snooze, 15);
|
||||
});
|
||||
|
||||
test('values out of range read as at first', () {
|
||||
expect(
|
||||
decodeSettings(
|
||||
payload({
|
||||
'schemaVersion': 1,
|
||||
'tasks': {'weekStart': 9, 'resetSubTasks': 'yes'},
|
||||
'reminders': {'automatic': -5, 'snooze': 0},
|
||||
}),
|
||||
),
|
||||
const TodoSettings(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue