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:
parent
5d9c640e5a
commit
ce07fab193
3 changed files with 1254 additions and 113 deletions
|
|
@ -13,6 +13,8 @@
|
|||
import 'dart:async' as _ida;
|
||||
import 'package:halkyon_base_client/halkyon_base_client.dart' as _ihk4p5t7;
|
||||
import 'package:halkyon_oidc_client/halkyon_oidc_client.dart' as _ibkpwzgl;
|
||||
import 'package:halkyon_todo_client/src/protocol/search/nearby.dart'
|
||||
as _i77fdwoz;
|
||||
import 'package:halkyon_todo_client/src/protocol/search/place.dart'
|
||||
as _i15767wh;
|
||||
import 'package:halkyon_todo_client/src/protocol/search/place_point.dart'
|
||||
|
|
@ -66,6 +68,22 @@ class EndpointSearch extends _isc.EndpointRef {
|
|||
'language': language,
|
||||
},
|
||||
);
|
||||
|
||||
/// What is around [at], a point on the map, named in [language]: the
|
||||
/// address that names a pin and the places to go to. Refused as [places]
|
||||
/// is, and counted among its searches; the point is neither kept nor
|
||||
/// logged.
|
||||
_ida.Future<_i77fdwoz.Nearby> nearby(
|
||||
_icyq0v3n.PlacePoint at, {
|
||||
String? language,
|
||||
}) => caller.callServerEndpoint<_i77fdwoz.Nearby>(
|
||||
'search',
|
||||
'nearby',
|
||||
{
|
||||
'at': at,
|
||||
'language': language,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class Modules {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import 'label/label.dart' as _ivak08z4;
|
|||
import 'privacy/content_key.dart' as _imed3x5d;
|
||||
import 'project/project.dart' as _i9c44spp;
|
||||
import 'project/section.dart' as _imadkvi9;
|
||||
import 'search/nearby.dart' as _ispk4ita;
|
||||
import 'search/place.dart' as _iadh29yw;
|
||||
import 'search/place_point.dart' as _itf0ur2u;
|
||||
import 'search/search_refused.dart' as _ihbxkwke;
|
||||
|
|
@ -36,6 +37,7 @@ export 'label/label.dart';
|
|||
export 'privacy/content_key.dart';
|
||||
export 'project/project.dart';
|
||||
export 'project/section.dart';
|
||||
export 'search/nearby.dart';
|
||||
export 'search/place.dart';
|
||||
export 'search/place_point.dart';
|
||||
export 'search/search_refused.dart';
|
||||
|
|
@ -509,6 +511,9 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (t == _imadkvi9.Section) {
|
||||
return _imadkvi9.Section.fromJson(data) as T;
|
||||
}
|
||||
if (t == _ispk4ita.Nearby) {
|
||||
return _ispk4ita.Nearby.fromJson(data) as T;
|
||||
}
|
||||
if (t == _iadh29yw.Place) {
|
||||
return _iadh29yw.Place.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -536,6 +541,9 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (t == _isc.getType<_imadkvi9.Section?>()) {
|
||||
return (data != null ? _imadkvi9.Section.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _isc.getType<_ispk4ita.Nearby?>()) {
|
||||
return (data != null ? _ispk4ita.Nearby.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == _isc.getType<_iadh29yw.Place?>()) {
|
||||
return (data != null ? _iadh29yw.Place.fromJson(data) : null) as T;
|
||||
}
|
||||
|
|
@ -552,6 +560,10 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (t == _isc.getType<_ib4f8uyw.Task?>()) {
|
||||
return (data != null ? _ib4f8uyw.Task.fromJson(data) : null) as T;
|
||||
}
|
||||
if (t == List<_iadh29yw.Place>) {
|
||||
return (data as List).map((e) => deserialize<_iadh29yw.Place>(e)).toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_i15767wh.Place>) {
|
||||
return (data as List).map((e) => deserialize<_i15767wh.Place>(e)).toList()
|
||||
as T;
|
||||
|
|
@ -580,6 +592,7 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
_imed3x5d.ContentKey => 'ContentKey',
|
||||
_i9c44spp.Project => 'Project',
|
||||
_imadkvi9.Section => 'Section',
|
||||
_ispk4ita.Nearby => 'Nearby',
|
||||
_iadh29yw.Place => 'Place',
|
||||
_itf0ur2u.PlacePoint => 'PlacePoint',
|
||||
_ihbxkwke.SearchRefused => 'SearchRefused',
|
||||
|
|
@ -610,6 +623,8 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
return 'Project';
|
||||
case _imadkvi9.Section():
|
||||
return 'Section';
|
||||
case _ispk4ita.Nearby():
|
||||
return 'Nearby';
|
||||
case _iadh29yw.Place():
|
||||
return 'Place';
|
||||
case _itf0ur2u.PlacePoint():
|
||||
|
|
@ -668,6 +683,9 @@ class Protocol extends _isd.DatabaseSerializationManager {
|
|||
if (dataClassName == 'Section') {
|
||||
return deserialize<_imadkvi9.Section>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'Nearby') {
|
||||
return deserialize<_ispk4ita.Nearby>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'Place') {
|
||||
return deserialize<_iadh29yw.Place>(data['data']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:halkyon_todo_client/src/protocol/protocol.dart' as _i5b39hch;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
import '../search/place.dart' as _iz6lll64;
|
||||
|
||||
/// What is around a point on the map (ADR 0033, D32): never stored by the
|
||||
/// server, as a found place isn't.
|
||||
abstract class Nearby
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
Nearby._({
|
||||
this.spot,
|
||||
required this.places,
|
||||
});
|
||||
|
||||
factory Nearby({
|
||||
_iz6lll64.Place? spot,
|
||||
required List<_iz6lll64.Place> places,
|
||||
}) = _NearbyImpl;
|
||||
|
||||
factory Nearby.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return Nearby(
|
||||
spot: jsonSerialization['spot'] == null
|
||||
? null
|
||||
: _i5b39hch.Protocol().deserialize<_iz6lll64.Place>(
|
||||
jsonSerialization['spot'],
|
||||
),
|
||||
places: _i5b39hch.Protocol().deserialize<List<_iz6lll64.Place>>(
|
||||
jsonSerialization['places'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The address nearest the point, what names a pin; null where none is.
|
||||
_iz6lll64.Place? spot;
|
||||
|
||||
/// The places to go to around it, nearest first: shops, restaurants and
|
||||
/// the like, what a person more likely means than a house number.
|
||||
List<_iz6lll64.Place> places;
|
||||
|
||||
/// Returns a shallow copy of this [Nearby]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
Nearby copyWith({
|
||||
_iz6lll64.Place? spot,
|
||||
List<_iz6lll64.Place>? places,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'Nearby',
|
||||
if (spot != null) 'spot': spot?.toJson(),
|
||||
'places': places.toJson(valueToJson: (v) => v.toJson()),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'Nearby',
|
||||
if (spot != null) 'spot': spot?.toJsonForProtocol(),
|
||||
'places': places.toJson(valueToJson: (v) => v.toJsonForProtocol()),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _NearbyImpl extends Nearby {
|
||||
_NearbyImpl({
|
||||
_iz6lll64.Place? spot,
|
||||
required List<_iz6lll64.Place> places,
|
||||
}) : super._(
|
||||
spot: spot,
|
||||
places: places,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [Nearby]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
Nearby copyWith({
|
||||
Object? spot = _Undefined,
|
||||
List<_iz6lll64.Place>? places,
|
||||
}) {
|
||||
return Nearby(
|
||||
spot: spot is _iz6lll64.Place? ? spot : this.spot?.copyWith(),
|
||||
places: places ?? this.places.map((e0) => e0.copyWith()).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue