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:
parent
09f61c3b0a
commit
8fb2dbf35e
2 changed files with 1304 additions and 111 deletions
|
|
@ -137,4 +137,12 @@ void main() {
|
|||
expect(blank.every((row) => row[1] == null && row[2] == null), isTrue);
|
||||
}
|
||||
});
|
||||
|
||||
test('a series added later is kept with its workout (D31)', () async {
|
||||
final id = await workouts.save(ride, positions.take(1).toList());
|
||||
|
||||
await workouts.addSeries(id, positions.skip(1).toList());
|
||||
|
||||
expect(await workouts.series(id), positions);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,21 @@ void main() {
|
|||
);
|
||||
expect(decodeWorkout(ByteData(0)), isNull);
|
||||
});
|
||||
|
||||
test('an imported workout keeps the app it came from, and its name and '
|
||||
'notes edited', () {
|
||||
final imported = WorkoutContent(
|
||||
activity: Activity.indoorRowing,
|
||||
startedAt: run.startedAt,
|
||||
endedAt: run.endedAt,
|
||||
origin: const WorkoutOrigin(
|
||||
app: 'com.vescape.christopeit',
|
||||
appName: 'Christopeit Connect',
|
||||
sessionId: 'hc-1',
|
||||
),
|
||||
);
|
||||
|
||||
expect(decodeWorkout(encodeWorkout(imported)), imported);
|
||||
expect(imported.withText(name: 'Intervals').origin, imported.origin);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue