feat(todo): places are watched by a quiet service, and asked to notify (ADR 0033, D32)

The first walk showed two faults. Android gives a proximity alert of an
app in the background a fix every 30 minutes (17:04:38, then 17:34:43 on
the Pixel), so a short stop goes unseen. And the place did remind, at
17:36:43, but nothing had asked to notify, so Android showed nothing.

A foreground service of the type location now takes its own fixes while
places wait, under the quietest notification there is: as long as
reaching the nearest circle takes at 30 m/s, doubled while the phone
lies still, between 30 s and 5 min. A place with a reminder asks to
notify as any reminder does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-05 18:17:48 +01:00
commit a7385e2169
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
3 changed files with 499 additions and 125 deletions

View file

@ -2441,6 +2441,48 @@ void main() {
expect(locationGateway.watched, isEmpty);
});
testWidgets('a place with a reminder asks to notify, as any reminder '
'does, and says what the quiet notification says', (tester) async {
reminders.allowed = false;
await start(tester, usedBefore: true);
expect(reminders.asked, 0);
await seed(
tester,
TaskContent(
title: 'Shop',
projectId: inbox(),
locations: const [
TaskLocation(
name: 'EDEKA',
lat: 47.55,
lon: 9.70,
trigger: LocationTrigger.arrive,
),
],
),
);
expect(reminders.asked, 1);
expect(locationGateway.watchingSays, 'Watching your places');
});
testWidgets('a place without a reminder asks nothing', (tester) async {
reminders.allowed = false;
await start(tester, usedBefore: true);
await seed(
tester,
TaskContent(
title: 'Shop',
projectId: inbox(),
locations: const [
TaskLocation(name: 'EDEKA', lat: 47.55, lon: 9.70),
],
),
);
expect(reminders.asked, 0);
});
testWidgets('an unchanged plan is not handed over again, nor is a person '
'asked anything for it', (tester) async {
locationGateway.allowed = LocationAccess.whileInUse;

View file

@ -37,6 +37,8 @@ class _Gateway(var LocationAccess now) implements LocationReminderGateway {
Future<void> replace(
List<LocationWatch> watches, {
required String channel,
String watching = '',
String watchingChannel = '',
}) async {}
}

View file

@ -9,6 +9,9 @@ class MemoryLocationGateway() implements LocationReminderGateway {
/// What the device allows.
LocationAccess allowed = LocationAccess.always;
/// What the quiet notification of watching says.
String watchingSays = '';
/// How often the places were handed over.
int replaced = 0;
@ -19,7 +22,10 @@ class MemoryLocationGateway() implements LocationReminderGateway {
Future<void> replace(
List<LocationWatch> watches, {
required String channel,
String watching = '',
String watchingChannel = '',
}) async {
watchingSays = watching;
watched = watches;
replaced++;
}