From e141e1ef46ebb2a61f452122201a77527a5a1c9e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Apr 2026 09:02:46 +0000 Subject: fix+feat: CI build fixes and hardware source feature flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../org/terst/nav/settings/HardwareSource.kt | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test-runner/src/main/kotlin/org/terst/nav/settings/HardwareSource.kt (limited to 'test-runner/src/main') 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() + + 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 + } +} -- cgit v1.2.3