Documentation
¶
Overview ¶
Package reminders fires calendar reminders when their alarms come due (docs/design/pim.md, Reminders): it records them as fired, tells the app, and, while the app is away, shows desktop notifications. Each minute it also has maild fire the messages' Remind Me reminders (ADR-0025).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DB *store.DB
// List is calendar.reminders: the reminders to show now.
List func(ctx context.Context) ([]api.Reminder, error)
// Attended reports whether the app is connected (rpcserver).
Attended func() bool
// Notifier shows reminders while the app is away; nil shows none.
Notifier Notifier
// Messages fires the Remind Me reminders of messages due by now
// (mailsync.Manager.FireReminders); nil fires none.
Messages func(ctx context.Context, now time.Time) error
Now func() time.Time
Local *time.Location
Log *slog.Logger
}
Config is what the scheduler needs; nil Now, Local and Log take time.Now, time.Local and a discarding logger.
type Notifier ¶
type Notifier interface {
Remind(ctx context.Context, rs []notify.Reminder) error
// Withdraw closes the notes of reminders not in active.
Withdraw(ctx context.Context, active map[string]bool) error
}
Notifier shows reminders on the desktop (notify.Desktop).
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler checks for due reminders once a minute.
func (*Scheduler) Check ¶
Check fires the alarms due since the last check, and the snoozes that ended, and announces them: an event for the app, or notifications while it is away. It also withdraws the notes of reminders no longer shown. Run calls it; tests call it with their clock.