Merge branch 'train-days' into integration

# Conflicts:
#	apps/train/halkyon_train_flutter/lib/src/app/train_paths.dart
#	docs/adr/0030-halkyon-train.md
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-03 23:14:02 +01:00
commit 81adeb91cc
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 25705 additions and 410 deletions

View file

@ -135,6 +135,20 @@ class FakeHealthPlatform({
@override
Future<List<Fix>?> route(String sessionId) async => routes[sessionId];
/// Other apps' weights (D64).
final otherWeights = <HealthWeight>[];
@override
Future<List<HealthWeight>> weights({required DateTime from}) async {
if (!grantedNow.contains(HealthAccess.weight)) {
throw HealthRefused();
}
return [
for (final weight in otherWeights)
if (!weight.at.isBefore(from)) weight,
];
}
/// How many times Health Connect's settings were opened.
int settingsOpened = 0;

View file

@ -0,0 +1,36 @@
import 'dart:async';
import 'package:halkyon_app/halkyon_app.dart';
import 'package:halkyon_train_flutter/src/feature/weight/data/weight_gateway.dart';
/// [WeightGateway] in memory, whose rows a test changes as an instance could.
class MemoryWeightGateway() implements WeightGateway {
final rows = <String, Envelope>{};
final _remote = StreamController<void>.broadcast();
/// As a sync bringing others' changes.
void bringRemoteChanges() => _remote.add(null);
@override
Future<List<WeightRow>> weights() async => [
for (final MapEntry(:key, :value) in rows.entries)
(id: key, envelope: value),
];
@override
Future<void> insert(WeightRow weight) async =>
rows[weight.id] = weight.envelope;
@override
Future<void> update(String id, Envelope envelope) async {
if (rows.containsKey(id)) {
rows[id] = envelope;
}
}
@override
Future<void> delete(String id) async => rows.remove(id);
@override
Stream<void> get remoteChanges => _remote.stream;
}