feat(train): reminders to move and workouts suggested from the steps (ADR 0037)
Settings' Moving more, on Android: a reminder to get up after an idle time, and a suggested walk or run, each off until turned on (then every 30 minutes, weekdays 9:00 to 18:00, not 12:00 to 13:00, each value the person's), turning on asking for the activity and notification permissions. A WorkManager job every 15 minutes reads the phone's step counter and keeps two hours of readings. It reminds where fewer than 50 steps came over the idle time, all of it within the hours and outside the break, on the person's days, never while Train records or the phone is in a car (Android's car mode, or a car's Bluetooth audio or hands-free). It suggests a walk or a run where the last span averaged a walking or running cadence, once an hour; tapped, the Record sheet for it opens. The decisions are pure Kotlin (Movement.kt), tested on the JVM; the notifications' words are the app's, written into the job's configuration as the person's app opens. Polar's SDK sets neither the band's inactivity alert nor tells of one without an all-day connection, hence the phone's steps (ADR 0037). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
3f7b409e80
commit
e4585b478d
1 changed files with 1882 additions and 30 deletions
|
|
@ -0,0 +1,26 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:halkyon_train_flutter/src/feature/movement/data/movement_platform.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/workout/model/workout.dart';
|
||||
|
||||
/// The phone's side of Moving more as a test wants it (ADR 0037): whether
|
||||
/// it counts steps, each configuration the job got, and suggestions tapped
|
||||
/// by [tap].
|
||||
class FakeMovementPlatform({var bool counts = true})
|
||||
implements MovementPlatform {
|
||||
final configured = <Map<String, Object?>?>[];
|
||||
final _openings = StreamController<Activity>.broadcast();
|
||||
|
||||
/// A suggestion of [activity] tapped.
|
||||
void tap(Activity activity) => _openings.add(activity);
|
||||
|
||||
@override
|
||||
Future<bool> available() async => counts;
|
||||
|
||||
@override
|
||||
Future<void> configure(Map<String, Object?>? config) async =>
|
||||
configured.add(config);
|
||||
|
||||
@override
|
||||
Stream<Activity> openings() => _openings.stream;
|
||||
}
|
||||
Loading…
Reference in a new issue