Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

fix(legal): state that the age checkbox is for new installs only

Durganshufa344b8f6994
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f362f79..a38cc1e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,10 @@ All notable changes to Gotcha are documented here.
offers RUB as the preferred currency, and prices in roubles, such as
`1 234,56 ₽` or `990 руб.`, are found on screen and converted with the
right amount. Saved language and currency choices are kept.
+- **Age confirmation on first launch.** The legal consent dialog on a new
+ install now also asks you to confirm you are at least 18; "I agree" stays
+ off until both boxes are ticked. If you already accepted, you aren't asked
+ again.
### Changed
- **Choose Android Built-in's speech engines, and see what runs where** (#122).
diff --git a/app/src/androidTest/java/com/gotcha/LegalConsentDialogTest.kt b/app/src/androidTest/java/com/gotcha/LegalConsentDialogTest.kt
new file mode 100644
index 0000000..09715fe
--- /dev/null
+++ b/app/src/androidTest/java/com/gotcha/LegalConsentDialogTest.kt
@@ -0,0 +1,69 @@
+package com.gotcha
+
+import androidx.compose.ui.test.assertIsEnabled
+import androidx.compose.ui.test.assertIsNotEnabled
+import androidx.compose.ui.test.assertIsOff
+import androidx.compose.ui.test.assertIsOn
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.performClick
+import androidx.compose.ui.test.performScrollTo
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.gotcha.ui.theme.GotchaTheme
+import org.junit.Assert.assertEquals
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+/** The consent gate: "I agree" needs both the accept and the age checkbox (#136 review). */
+@RunWith(AndroidJUnit4::class)
+class LegalConsentDialogTest {
+
+ @get:Rule
+ val composeRule = createComposeRule()
+
+ private var agreed = 0
+
+ @Before
+ fun setUp() {
+ composeRule.setContent {
+ GotchaTheme { LegalConsentDialog(onAgree = { agreed++ }) }
+ }
+ }
+
+ private fun tap(tag: String) {
+ composeRule.onNodeWithTag(tag).performScrollTo().performClick()
+ }
+
+ private fun agreeButton() = composeRule.onNodeWithTag("legal_consent_agree_button")
+
+ @Test
+ fun agreeStaysOffUntilBothBoxesAreTicked() {
+ agreeButton().assertIsNotEnabled()
+
+ tap("legal_consent_toggle_row")
+ agreeButton().assertIsNotEnabled()
+
+ tap("legal_consent_toggle_row")
+ tap("legal_consent_age_row")
+ agreeButton().assertIsNotEnabled()
+
+ tap("legal_consent_toggle_row")
+ agreeButton().assertIsEnabled().performClick()
+ composeRule.runOnIdle { assertEquals(1, agreed) }
+ }
+
+ @Test
+ fun tappingARowTogglesItsOwnCheckbox() {
+ composeRule.onNodeWithTag("legal_consent_toggle_row").assertIsOff()
+ composeRule.onNodeWithTag("legal_consent_age_row").assertIsOff()
+
+ tap("legal_consent_age_row")
+ composeRule.onNodeWithTag("legal_consent_age_row").assertIsOn()
+ composeRule.onNodeWithTag("legal_consent_toggle_row").assertIsOff()
+
+ tap("legal_consent_age_row")
+ composeRule.onNodeWithTag("legal_consent_age_row").assertIsOff()
+ }
+}
diff --git a/app/src/main/java/com/gotcha/LegalConsentDialog.kt b/app/src/main/java/com/gotcha/LegalConsentDialog.kt
index ca1ec1a..2937ab9 100644
--- a/app/src/main/java/com/gotcha/LegalConsentDialog.kt
+++ b/app/src/main/java/com/gotcha/LegalConsentDialog.kt
@@ -45,7 +45,9 @@ import com.gotcha.ui.theme.SkinAlertDialog
* Retention) are shown inline up front, and the "I have read and accept…"
* checkbox sits at the very end, after the documents, since it attests to
* having read them, followed by an "I am at least 18" checkbox. The button
- * stays disabled until both are ticked.
+ * stays disabled until both are ticked. The age checkbox reaches new installs
+ * only: it came without a [com.gotcha.data.LEGAL_VERSION] bump, so users who
+ * had already accepted aren't shown the dialog again for it.
*
* Re-prompted by [com.gotcha.MainActivity] whenever the stored
* [com.gotcha.data.Settings.legalAcceptedVersion] doesn't match the current
diff --git a/app/src/main/java/com/gotcha/data/SettingsRepository.kt b/app/src/main/java/com/gotcha/data/SettingsRepository.kt
index d51cbbc..ff071ee 100644
--- a/app/src/main/java/com/gotcha/data/SettingsRepository.kt
+++ b/app/src/main/java/com/gotcha/data/SettingsRepository.kt
@@ -983,5 +983,9 @@ class SettingsRepository(context: Context) : SettingsStore {
* dialog re-prompts whenever the stored accepted version is older than this
* constant, so non-material edits (typo fixes, formatting) should leave it
* unchanged.
+ *
+ * The dialog's "I am at least 18" checkbox was added without a bump, on
+ * purpose: it applies to new installs only, and users who already accepted
+ * version 2 are not asked again. A later bump will ask everyone for it.
*/
const val LEGAL_VERSION: String = "2"