From e68212991935d33a4baca77d88cd20a82fbcf6a6 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 25 Mar 2026 18:23:54 +0000 Subject: refactor: address simplify review findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TrackRepository.addPoint() now returns Boolean (true if point was added). MainViewModel.addGpsPoint() only updates _trackPoints StateFlow when a point is actually appended — eliminates ~3,600 no-op flow emissions per hour when not recording. MainActivity: loadedStyle promoted from nullable field to MutableStateFlow; trackPoints observer uses filterNotNull + combine so no track points are silently dropped if the style loads after the first GPS fix. Smoke tests: replaced 11× ActivityScenario.launch().use{} with a single @get:Rule ActivityScenarioRule — same isolation, less boilerplate. CI: removed redundant app-debug artifact upload (app-debug.apk is already included inside the test-apks artifact). Removed stale/placeholder comments from MainActivity. Co-Authored-By: Claude Sonnet 4.6 --- android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'android-app/app/src/main/kotlin/org/terst/nav/ui') diff --git a/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt b/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt index 33decbe..0efff52 100644 --- a/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt +++ b/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt @@ -71,8 +71,9 @@ class MainViewModel( windSpeedKnots = 0.0, windAngleDeg = 0.0, isTrueWind = false, timestampMs = System.currentTimeMillis() ) - trackRepository.addPoint(point) - _trackPoints.value = trackRepository.getPoints() + if (trackRepository.addPoint(point)) { + _trackPoints.value = trackRepository.getPoints() + } } private val aisHubApi: AisHubApiService by lazy { -- cgit v1.2.3