feat(train): other apps' workouts read from Health Connect (ADR 0030, D31)

Read from other apps, off until turned on, asks for reading with the
history; the apps that wrote sessions are listed, each off. One turned
on brings its sessions, earlier ones at once and later ones through the
changes token as the app opens and comes to the front: each a workout
of Train's own store, sealed and synced, its origin in its payload, its
heart rate, pauses and a row's power as series, named by its app in the
list and on its page. A double of a workout Train has brings at most its
heart rate; one deleted in Train stays out; a track comes only when
asked for on the page, Health Connect asking for consent. What came from
Health Connect is never written back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-28 17:17:59 +01:00
commit 8fb2dbf35e
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -39,6 +39,12 @@ class MemoryWorkoutGateway() implements WorkoutGateway {
..addAll(series.map((row) => row.envelope));
}
@override
Future<void> insertSeries(List<SeriesRow> series) async {
seriesRows.addAll(series);
written.addAll(series.map((row) => row.envelope));
}
@override
Future<void> update(String id, Envelope envelope) async {
if (workoutRows.containsKey(id)) {