screen-locker/stronglift_replacement/workout_app/lib/services/run_phase.dart
Krzysztof kuhy Rudnicki 48d21bfafc One-mode run, pace target, idle map
Remove the run/walk toggle: every recording uses the 25 km/h running
filter and writes a Running TCX; decodeTcx still reads walking files.
Add the optional pace target (stepper, 30 s current pace, band,
throttled cues, persisted). The idle map follows the user's fix; refused
location shows only the red icon, no map and no start.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZ9CKZsNxtD5Jr9bYD
2026-11-10 18:47:53 +01:00

58 lines
1.5 KiB
Dart

/// The phases and problems of a GPS recording.
library;
import 'package:workout_app/services/position_source.dart';
/// Where a recording stands.
enum RunPhase {
/// Nothing recorded yet.
idle,
/// Fixes are being kept and credited.
recording,
/// Fixes are ignored; nothing is credited until [RunRecorder.resume].
paused,
/// Over; [RunRecorder.finish] has returned the track.
finished;
/// True from start to finish: recording or paused.
bool get isActive => this == recording || this == paused;
}
/// What is wrong with the recording right now (shown as an icon, logged).
enum RunIssue {
/// Nothing.
none,
/// Location permission refused; asking again may work.
denied,
/// Location permission refused for good; only system settings can fix it.
deniedForever,
/// The device's location switch is off.
serviceOff,
/// The newest fix came from a mock-location provider and was dropped.
mockedLocation,
/// The location stream reported an error.
streamError,
/// Finished with too few usable fixes to make a track; nothing was saved.
tooShort;
/// The issue a refused [access] raises (never [none]; a grant has none).
static RunIssue forAccess(LocationAccess access) => switch (access) {
LocationAccess.deniedForever => deniedForever,
LocationAccess.serviceOff => serviceOff,
_ => denied,
};
/// Whether this is a refused location access (no map, no start).
bool get isAccess =>
this == denied || this == deniedForever || this == serviceOff;
}