From feab4b4e964edfcdfece74965ed9b7bf00f29314 Mon Sep 17 00:00:00 2001 From: Seb3thehacker Date: Sat, 24 Oct 2026 16:36:23 -0700 Subject: [PATCH] debug: a switch to hide the car screen's DEBUG BUILD badge, for screenshots --- .../app/seb3thehacker/gearslip/car/CarSettings.kt | 11 +++++++++++ .../main/java/app/seb3thehacker/gearslip/car/CarUi.kt | 3 ++- .../app/seb3thehacker/gearslip/ui/SettingsScreen.kt | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt index a597672..fe812b2 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt @@ -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_CAR_SENSORS = "car_sensors_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_UNITS = "car_units" 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 carSensorsFlow = MutableStateFlow(false) private val adaptiveVideoFlow = MutableStateFlow(false) + private val debugBadgeFlow = MutableStateFlow(true) private val seenSafetyWarningFlow = MutableStateFlow(false) private val unitsFlow = MutableStateFlow(Units.AUTO) @@ -280,6 +282,14 @@ private const val KEY_LOCATION_WARNING = "car_location_warning" */ val adaptiveVideoEnabled: StateFlow = adaptiveVideoFlow + /** Debug builds only: the car screen's DEBUG BUILD badge, which screenshots for the README leave out. */ + val debugBadge: StateFlow = 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 * 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" carSensorsFlow.value = AppSettings.getString(app, KEY_CAR_SENSORS, "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" unitsFlow.value = runCatching { Units.valueOf(AppSettings.getString(app, KEY_UNITS, Units.AUTO.name)) diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt index b773721..1daccb9 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarUi.kt @@ -317,7 +317,8 @@ fun CarUi() { VoiceHelpOverlay(Modifier.align(Alignment.Center)) CallOverlay() 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 // something in the top-right (settings, search, a Liked Songs // shortcut) and this badge used to sit right on top of it, hiding diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt index 485062c..644e93c 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/SettingsScreen.kt @@ -200,6 +200,14 @@ private fun DebugSection() { subtitle = "Posts a message notification to read on the car", 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) }, + ) } }