feat(todo): a pin in the map's middle, and what is around it (ADR 0033, D32)

The location picker fills the screen with its map, the search floating
over it. A pin stays in the middle, lifting while the map moves, as
Molly's; where it lands the instance names the address and lists the
places around, as Threema's. That is `nearby` on the search endpoint,
for those signed in, the point neither kept nor logged, counted among
the searches: two lookups, as a plain one finds house numbers alone.

Fixes the map's credit, which overflowed a phone and was pale on white.

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 23:42:06 +01:00
commit ce07fab193
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -207,6 +207,51 @@ void main() {
expect([for (final place in places) place.osmValue], ['supermarket']);
});
test('the places around a point: each name once, what nobody goes to left '
'out', () {
final places = neighboursOf(
photonAnswer(const [
{'lat': 47.5, 'lon': 9.7, 'name': 'Volksbank', 'osm_value': 'bank'},
{'lat': 47.5, 'lon': 9.7, 'name': 'Volksbank', 'osm_value': 'bank'},
{'lat': 47.5, 'lon': 9.7, 'name': 'Volksbank', 'osm_value': 'atm'},
{'lat': 47.5, 'lon': 9.7, 'name': 'Bank', 'osm_value': 'bench'},
{'lat': 47.5, 'lon': 9.7, 'name': 'EDEKA', 'osm_value': 'parking'},
{'lat': 47.5, 'lon': 9.7, 'name': 'EDEKA', 'osm_value': 'supermarket'},
]),
);
expect(places.map((place) => (place.name, place.osmValue)), [
('Volksbank', 'bank'),
('EDEKA', 'supermarket'),
]);
});
test(
'HttpPhoton asks /reverse with the point, the radius and each tag',
() async {
final server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
addTearDown(() => server.close(force: true));
Uri? asked;
server.listen((request) {
asked = request.uri;
request.response
..write(jsonEncode(photonAnswer(const [])))
..close();
});
await HttpPhoton(Uri.parse('http://127.0.0.1:${server.port}/')).around(
PlacePoint(lat: 47.5, lon: 9.7),
radiusKm: 0.5,
tags: const {'shop', 'amenity'},
language: 'de',
limit: 20,
);
expect(asked?.path, '/reverse');
expect(asked?.queryParameters['lat'], '47.5');
expect(asked?.queryParameters['radius'], '0.5');
expect(asked?.queryParameters['lang'], 'de');
expect(asked?.queryParametersAll['osm_tag'], ['shop', 'amenity']);
},
);
test('HttpPhoton asks /api with the query, the point, the language and '
'the limit, and fails on what is no answer', () async {
final server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);