summaryrefslogtreecommitdiff
path: root/test-runner/src/main
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-04-22 09:02:46 +0000
committerClaude <noreply@anthropic.com>2026-04-22 09:02:46 +0000
commite141e1ef46ebb2a61f452122201a77527a5a1c9e (patch)
tree3f19528a27b243a5574e7b7ed6d629db9f0b6cb8 /test-runner/src/main
parentce555a54b47c5bbb8df3eb9dd9ac69bd6a65be24 (diff)
fix+feat: CI build fixes and hardware source feature flags
CI fixes: - ParticleWindView: bounds.lonEast → bounds.northEast.longitude (MapLibre 13.x API; lonEast not available as property) - VesselRegistryFragment: Vessel(id="") and CrewMember(id="") → include required name="" so copy() compiles Hardware source feature flags: - HardwareSource enum: AIS_RECEIVER, NMEA_INSTRUMENTS - FeatureFlags: SharedPreferences-backed; all sources default OFF (app works phone-only out of the box) - NavApplication: exposes featureFlags singleton - SafetyFragment: "HARDWARE DATA SOURCES" card with two MaterialSwitch toggles; reads initial state from FeatureFlags; calls SafetyListener.onHardwareSourceChanged on change - AIS_RECEIVER flag: - MainViewModel.processAisSentence() / refreshAisFromInternet() skip when disabled; onHardwareSourceChanged() clears targets + cpaAlerts - NMEA_INSTRUMENTS flag: - LocationService skips nmeaStreamManager.start() on service launch when disabled - New ACTION_START_NMEA / ACTION_STOP_NMEA intents allow live toggle - MainActivity.onHardwareSourceChanged() sends the appropriate intent Tests: 102 total, all GREEN (+7 FeatureFlagsTest) https://claude.ai/code/session_011h2dXbgXg3PesQMmQUNTCW
Diffstat (limited to 'test-runner/src/main')
-rw-r--r--test-runner/src/main/kotlin/org/terst/nav/settings/HardwareSource.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/test-runner/src/main/kotlin/org/terst/nav/settings/HardwareSource.kt b/test-runner/src/main/kotlin/org/terst/nav/settings/HardwareSource.kt
new file mode 100644
index 0000000..b44cb66
--- /dev/null
+++ b/test-runner/src/main/kotlin/org/terst/nav/settings/HardwareSource.kt
@@ -0,0 +1,23 @@
+package org.terst.nav.settings
+
+enum class HardwareSource(val prefKey: String, val label: String) {
+ AIS_RECEIVER("hw_ais_receiver", "AIS Receiver"),
+ NMEA_INSTRUMENTS("hw_nmea_instruments", "NMEA Instruments")
+}
+
+/** Minimal in-memory implementation for JVM tests. */
+class InMemoryFeatureFlags {
+ private val state = mutableMapOf<HardwareSource, Boolean>()
+
+ fun isEnabled(source: HardwareSource): Boolean = state[source] ?: false
+
+ fun setEnabled(source: HardwareSource, enabled: Boolean) {
+ state[source] = enabled
+ }
+
+ fun toggle(source: HardwareSource): Boolean {
+ val next = !isEnabled(source)
+ setEnabled(source, next)
+ return next
+ }
+}