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.

Update legal consent dialog

Durganshubca118353d1c
diff --git a/app/src/main/java/com/gotcha/LegalConsentDialog.kt b/app/src/main/java/com/gotcha/LegalConsentDialog.kt
index 7eaeda1..ca1ec1a 100644
--- a/app/src/main/java/com/gotcha/LegalConsentDialog.kt
+++ b/app/src/main/java/com/gotcha/LegalConsentDialog.kt
@@ -44,7 +44,8 @@ import com.gotcha.ui.theme.SkinAlertDialog
* "I agree" button. All three legal documents (Terms, Disclaimer, Data
* 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. The button stays disabled until that checkbox is ticked.
+ * having read them, followed by an "I am at least 18" checkbox. The button
+ * stays disabled until both are ticked.
*
* Re-prompted by [com.gotcha.MainActivity] whenever the stored
* [com.gotcha.data.Settings.legalAcceptedVersion] doesn't match the current
@@ -57,6 +58,7 @@ fun LegalConsentDialog(
) {
val context = LocalContext.current
var accepted by remember { mutableStateOf(false) }
+ var ageConfirmed by remember { mutableStateOf(false) }
var termsText by remember { mutableStateOf<String?>(null) }
var disclaimerText by remember { mutableStateOf<String?>(null) }
var privacyText by remember { mutableStateOf<String?>(null) }
@@ -135,40 +137,26 @@ fun LegalConsentDialog(
HorizontalDivider(thickness = 1.dp)
- // The acceptance row, last so it comes after the user has had
- // the chance to read everything above it. Whole row is
- // clickable so the user can hit anywhere on the label, not
- // just the small checkbox target.
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .toggleable(
- value = accepted,
- role = Role.Checkbox,
- onValueChange = { accepted = it }
- )
- .padding(vertical = 4.dp)
- .testTag("legal_consent_toggle_row"),
- verticalAlignment = Alignment.CenterVertically,
- horizontalArrangement = Arrangement.spacedBy(8.dp)
- ) {
- Checkbox(
- checked = accepted,
- onCheckedChange = null,
- modifier = Modifier.testTag("legal_consent_toggle_checkbox")
- )
- Text(
- text = stringResource(R.string.legal_consent_toggle_label),
- style = MaterialTheme.typography.bodyMedium,
- modifier = Modifier.weight(1f)
- )
- }
+ // The acceptance rows, last so they come after the user has
+ // had the chance to read everything above them.
+ ConsentToggleRow(
+ checked = accepted,
+ onCheckedChange = { accepted = it },
+ label = stringResource(R.string.legal_consent_toggle_label),
+ tag = "legal_consent_toggle"
+ )
+ ConsentToggleRow(
+ checked = ageConfirmed,
+ onCheckedChange = { ageConfirmed = it },
+ label = stringResource(R.string.legal_consent_age_label),
+ tag = "legal_consent_age"
+ )
}
},
confirmButton = {
TextButton(
onClick = onAgree,
- enabled = accepted,
+ enabled = accepted && ageConfirmed,
modifier = Modifier.testTag("legal_consent_agree_button")
) { Text(stringResource(R.string.legal_consent_agree)) }
}
@@ -176,6 +164,43 @@ fun LegalConsentDialog(
)
}
+/**
+ * A checkbox with its label. The whole row is clickable so the user can hit
+ * anywhere on the label, not just the small checkbox target.
+ */
+@Composable
+private fun ConsentToggleRow(
+ checked: Boolean,
+ onCheckedChange: (Boolean) -> Unit,
+ label: String,
+ tag: String
+) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .toggleable(
+ value = checked,
+ role = Role.Checkbox,
+ onValueChange = onCheckedChange
+ )
+ .padding(vertical = 4.dp)
+ .testTag("${tag}_row"),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(8.dp)
+ ) {
+ Checkbox(
+ checked = checked,
+ onCheckedChange = null,
+ modifier = Modifier.testTag("${tag}_checkbox")
+ )
+ Text(
+ text = label,
+ style = MaterialTheme.typography.bodyMedium,
+ modifier = Modifier.weight(1f)
+ )
+ }
+}
+
/**
* One legal document inline: a tappable header (title + chevron) that
* expands to reveal the rendered Markdown body. Starts collapsed — these
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5fe8942..17e39f2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -8,6 +8,7 @@
<string name="legal_consent_title" translatable="false">Before you continue</string>
<string name="legal_consent_intro" translatable="false">Gotcha is an AI assistant that can take real, sometimes irreversible actions on your device. By tapping "I agree" you accept the Terms and Conditions, the Disclaimer and Declaration, and the Data Retention and Privacy Policy. You must be at least 18 years old.</string>
<string name="legal_consent_toggle_label" translatable="false">I have read and accept the full Terms and Conditions, Disclaimer, and Data Retention Policy.</string>
+ <string name="legal_consent_age_label" translatable="false">I confirm that I am at least 18 years old.</string>
<string name="legal_consent_agree" translatable="false">I agree</string>
<string name="legal_consent_section_terms" translatable="false">Terms and Conditions</string>
<string name="legal_consent_section_disclaimer" translatable="false">Disclaimer and Declaration</string>