Give enum-only run files covered members

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWZ9CKZsNxtD5Jr9bYD
This commit is contained in:
Krzysztof Rudnicki 2026-11-10 17:40:13 +01:00
parent 0ec8cfddec
commit 2998bd5353
4 changed files with 12 additions and 10 deletions

View File

@ -16,7 +16,10 @@ enum RunServiceState {
failed,
/// This platform has no foreground services (Linux desktop, tests).
unsupported,
unsupported;
/// True while a service is up, notification shown or not.
bool get isUp => this == running || this == runningHidden;
}
/// Starting, feeding and stopping the recording's foreground service.

View File

@ -54,8 +54,7 @@ class RunController extends ChangeNotifier {
bool get saving => _saving;
/// True from start to finish: the screen must not be left meanwhile.
bool get active =>
recorder.phase == RunPhase.recording || recorder.phase == RunPhase.paused;
bool get active => recorder.phase.isActive;
/// Asks for access, starts the service, begins recording.
Future<void> start() async {
@ -129,10 +128,7 @@ class RunController extends ChangeNotifier {
}
Future<void> _stopService() async {
if (_serviceState != RunServiceState.running &&
_serviceState != RunServiceState.runningHidden) {
return;
}
if (!_serviceState.isUp) return;
await _service.stop();
_serviceState = RunServiceState.none;
notifyListeners();

View File

@ -13,7 +13,10 @@ enum RunPhase {
paused,
/// Over; [RunRecorder.finish] has returned the track.
finished,
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).

View File

@ -117,7 +117,7 @@ class RunRecorder extends ChangeNotifier {
/// Ends the recording and returns the track, or null when there were too
/// few usable fixes (then [issue] is [RunIssue.tooShort]).
Future<RunTrack?> finish() async {
if (_phase != RunPhase.recording && _phase != RunPhase.paused) return null;
if (!_phase.isActive) return null;
await _sub?.cancel();
_sub = null;
_phase = RunPhase.finished;
@ -217,7 +217,7 @@ class RunRecorder extends ChangeNotifier {
}
void _onDone() {
if (_phase != RunPhase.recording && _phase != RunPhase.paused) return;
if (!_phase.isActive) return;
log(
'RunRecorder: the location stream ended while still recording; '
'finish the run to save what was captured.',