debug: a switch to hide the car screen's DEBUG BUILD badge, for screenshots

This commit is contained in:
Seb3thehacker committed 2026-10-24 16:36:23 -07:00
1 parent 88e871c65e
commit feab4b4e96
3 files changed
+21 -1

No files matched your search

@@ -72,6 +72,7 @@ private const val KEY_LOCATION_WARNING = "car_location_warning"
private const val KEY_SYSTEM_SPEECH = "car_system_speech" private const val KEY_SYSTEM_SPEECH = "car_system_speech"
private const val KEY_CAR_SENSORS = "car_sensors_enabled" private const val KEY_CAR_SENSORS = "car_sensors_enabled"
private const val KEY_ADAPTIVE_VIDEO = "adaptive_video_enabled" private const val KEY_ADAPTIVE_VIDEO = "adaptive_video_enabled"
private const val KEY_DEBUG_BADGE = "debug_badge"
private const val KEY_SEEN_SAFETY_WARNING = "car_seen_safety_warning" private const val KEY_SEEN_SAFETY_WARNING = "car_seen_safety_warning"
private const val KEY_UNITS = "car_units" private const val KEY_UNITS = "car_units"
private const val KEY_NAV_BAR = "car_nav_bar" private const val KEY_NAV_BAR = "car_nav_bar"
@@ -115,6 +116,7 @@ private const val KEY_LOCATION_WARNING = "car_location_warning"
private val systemSpeechFlow = MutableStateFlow(false) private val systemSpeechFlow = MutableStateFlow(false)
private val carSensorsFlow = MutableStateFlow(false) private val carSensorsFlow = MutableStateFlow(false)
private val adaptiveVideoFlow = MutableStateFlow(false) private val adaptiveVideoFlow = MutableStateFlow(false)
private val debugBadgeFlow = MutableStateFlow(true)
private val seenSafetyWarningFlow = MutableStateFlow(false) private val seenSafetyWarningFlow = MutableStateFlow(false)
private val unitsFlow = MutableStateFlow(Units.AUTO) private val unitsFlow = MutableStateFlow(Units.AUTO)
@@ -280,6 +282,14 @@ private const val KEY_LOCATION_WARNING = "car_location_warning"
*/ */
val adaptiveVideoEnabled: StateFlow<Boolean> = adaptiveVideoFlow val adaptiveVideoEnabled: StateFlow<Boolean> = adaptiveVideoFlow
/** Debug builds only: the car screen's DEBUG BUILD badge, which screenshots for the README leave out. */
val debugBadge: StateFlow<Boolean> = debugBadgeFlow
fun setDebugBadge(on: Boolean) {
debugBadgeFlow.value = on
AppSettings.putString(app, KEY_DEBUG_BADGE, on.toString())
}
/** /**
* Whether the car screen's own "drive safely" warning has already been shown and dismissed * Whether the car screen's own "drive safely" warning has already been shown and dismissed
* once, from this same install. Separate from the phone side's own compat/safety dialogs - * once, from this same install. Separate from the phone side's own compat/safety dialogs -
@@ -323,6 +333,7 @@ private const val KEY_LOCATION_WARNING = "car_location_warning"
systemSpeechFlow.value = AppSettings.getString(app, KEY_SYSTEM_SPEECH, "false") == "true" systemSpeechFlow.value = AppSettings.getString(app, KEY_SYSTEM_SPEECH, "false") == "true"
carSensorsFlow.value = AppSettings.getString(app, KEY_CAR_SENSORS, "false") == "true" carSensorsFlow.value = AppSettings.getString(app, KEY_CAR_SENSORS, "false") == "true"
adaptiveVideoFlow.value = AppSettings.getString(app, KEY_ADAPTIVE_VIDEO, "false") == "true" adaptiveVideoFlow.value = AppSettings.getString(app, KEY_ADAPTIVE_VIDEO, "false") == "true"
debugBadgeFlow.value = AppSettings.getString(app, KEY_DEBUG_BADGE, "true") == "true"
seenSafetyWarningFlow.value = AppSettings.getString(app, KEY_SEEN_SAFETY_WARNING, "false") == "true" seenSafetyWarningFlow.value = AppSettings.getString(app, KEY_SEEN_SAFETY_WARNING, "false") == "true"
unitsFlow.value = runCatching { unitsFlow.value = runCatching {
Units.valueOf(AppSettings.getString(app, KEY_UNITS, Units.AUTO.name)) Units.valueOf(AppSettings.getString(app, KEY_UNITS, Units.AUTO.name))
@@ -317,7 +317,8 @@ fun CarUi() {
VoiceHelpOverlay(Modifier.align(Alignment.Center)) VoiceHelpOverlay(Modifier.align(Alignment.Center))
CallOverlay() CallOverlay()
AssistantOverlay(Modifier.align(Alignment.BottomCenter).padding(bottom = homeInset)) AssistantOverlay(Modifier.align(Alignment.BottomCenter).padding(bottom = homeInset))
if (app.seb3thehacker.gearslip.BuildConfig.DEBUG) { val badge by CarSettings.debugBadge.collectAsState()
if (app.seb3thehacker.gearslip.BuildConfig.DEBUG && badge) {
// Bottom corner, not top: a screen's own header almost always puts // Bottom corner, not top: a screen's own header almost always puts
// something in the top-right (settings, search, a Liked Songs // something in the top-right (settings, search, a Liked Songs
// shortcut) and this badge used to sit right on top of it, hiding // shortcut) and this badge used to sit right on top of it, hiding
@@ -200,6 +200,14 @@ private fun DebugSection() {
subtitle = "Posts a message notification to read on the car", subtitle = "Posts a message notification to read on the car",
icon = Icons.AutoMirrored.Filled.Send, icon = Icons.AutoMirrored.Filled.Send,
) )
SettingsDivider()
val badge by CarSettings.debugBadge.collectAsState()
SettingsRow(
"Debug badge on the car screen",
Modifier.clickable { CarSettings.setDebugBadge(!badge) },
subtitle = "Turn it off for screenshots",
trailing = { Switch(checked = badge, onCheckedChange = null) },
)
} }
} }