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, failed,
/// This platform has no foreground services (Linux desktop, tests). /// 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. /// Starting, feeding and stopping the recording's foreground service.

View File

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

View File

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