feat(android): notifications of due reminders with a Done action #290
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "288_android-reminder-notifications"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #288.
The Android app now posts a notification when a reminder command (R29) comes due. Where the reminder has an
into_file, the notification has a Done action. Done marks the reminder exactly as the banner on the Stream tab does: it writes the line, then commits and pushes according to the Changes switches, without opening the app.Core and bindings
reminder::next_due(due.rs) gives the earliest moment after now at which a reminder that is not due now comes due:daysrule: the start of its day, DST-safe, in the configured timezone;sincerule: the next occurrence of its recurrence.It reuses
finding/expected_momentsand has no rules of its own. The facade hasapi::next_reminder_due, and the bindings haveProject.nextReminderDue.DueReminderin the bindings gainstext(the description, else the key), which the notification uses as its title.Android
RepositoryConnection, theStreamSessionand thePinStorenow belong to a newStreamdobject, held by a newStreamdApplication. They no longer belong to the view model. The screens and the workers share one clone, and the app shows a done from a notification without reloading.Streamd.ready()lets a worker start the connection and wait for a read stream. The view model's behaviour is unchanged, and the screenshot tests are unchanged.notify/: nothing outside this package names WorkManager orNotificationManager, apart from the manifest andStreamdApplication.ReminderAlerts.ktis pure and unit-tested. A reminder rings when it comes due or itssincechanges, and again on a later day from 08:00 on. Otherwise it is updated silently, and only while the notification is still shown, so a swiped-away notification waits for the next ring. It is withdrawn once the reminder is no longer due.ReminderWork:DoneWorker, started byReminderDoneReceiver.Readystream triggers a check without a pull.POST_NOTIFICATIONSpermission is asked for once, the first time the project has a reminder command.android/deps.jsonhas been written again.Tests
next_duewithdays(with and withoutstart, and with a futurestart), daily and timedsince, across a DST change in Berlin, an already-due reminder, and the earliest of several. The facade is tested on aMemoryStore, and the ffi has a test too.ReminderAlertsTest(9 tests),StreamdTest, andStreamSessionTestfortext,sinceandnextDue.nix flake checkpasses.nix build .#streamd-apppasses, including the unit tests and the unchanged screenshot tests.ReminderWorkerruns, and the fallback job is scheduled.Notes
REPLACEon its own unique work), WorkManager cancels the running worker. This happens only after the check has finished, so nothing is lost, but the run is logged as cancelled.288fe85. That sentence has been dropped.