From f1a6901fbc055f1f0cc3d7c717085cb65ab2eb99 Mon Sep 17 00:00:00 2001 From: Seb3thehacker Date: Tue, 13 Oct 2026 16:11:43 -0700 Subject: [PATCH] usage notes: ask after the first good drive only if setup never asked --- .../app/seb3thehacker/gearslip/stats/WorkedPrompt.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/stats/WorkedPrompt.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/stats/WorkedPrompt.kt index 6278f09..ac4f487 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/stats/WorkedPrompt.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/stats/WorkedPrompt.kt @@ -8,8 +8,8 @@ import kotlinx.coroutines.flow.StateFlow import org.json.JSONObject /** - * The one-time "Gearslip worked with your car. Share that?" ask, for drivers who don't share - * usage notes. It comes after the first drive that worked, when a driver is happiest to help, as + * The one-time "Gearslip worked with your car. Share that?" ask, for drivers who never answered + * the usage notes question in setup, either way. It comes after the first drive that worked, when a driver is happiest to help, as * a card on Home. Answering it clears it, and it never comes back. * * Saying yes turns on the same usage notes switch as Settings, and that drive's car goes in the @@ -30,7 +30,7 @@ object WorkedPrompt { fun pending(context: Context): StateFlow { if (!loaded) { loaded = true - flow.value = saved(context)?.let(::carName) + flow.value = saved(context)?.takeUnless { UsageStats.asked(context) }?.let(::carName) } return flow } @@ -38,7 +38,8 @@ object WorkedPrompt { /** A drive that reached the car's screen ended cleanly. Asks, if it's never asked before. */ fun onDriveWorked(context: Context, info: ServiceDiscovery.HeadUnitInfo?, protocol: String, screen: String, dpi: Int) { val p = prefs(context) - if (UsageStats.enabled(context) || p.getBoolean(KEY_DONE, false) || p.contains(KEY_CAR)) return + // Asked once only: a driver who answered in setup already said yes or no. + if (UsageStats.asked(context) || p.getBoolean(KEY_DONE, false) || p.contains(KEY_CAR)) return val car = JSONObject() .put("name", info?.headUnitName.orEmpty()) .put("car", info?.carModel.orEmpty())