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.

refactor: make About Us a hub over About Samosa AI and Legal

Durganshu Mishraebe05e824280
diff --git a/app/src/main/java/com/gotcha/ui/AboutScreen.kt b/app/src/main/java/com/gotcha/ui/AboutScreen.kt
index e49bac5..3eed7f0 100644
--- a/app/src/main/java/com/gotcha/ui/AboutScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AboutScreen.kt
@@ -23,8 +23,33 @@ import androidx.compose.ui.unit.dp
import com.gotcha.tools.CompanyInfoTool
/**
- * The About Us page: who Samosa AI is, what else they make, how to reach them,
- * and the way through to the Legal documents.
+ * About Us: the hub for everything about who made this app and what using it
+ * commits you to. Shaped like the settings home list rather than a content page,
+ * so the two things underneath it — the company and the agreements — stay
+ * separate reads instead of one long scroll.
+ */
+@Composable
+fun AboutScreen(
+ onBack: () -> Unit,
+ onOpenPage: (SettingsPage) -> Unit
+) {
+ val overlay = rememberSettingsOverlayState()
+
+ SettingsScaffold(title = SettingsPage.ABOUT.title, onBack = onBack, overlay = overlay) {
+ listOf(SettingsPage.ABOUT_SAMOSA, SettingsPage.LEGAL).forEach { page ->
+ HorizontalDivider(thickness = 1.dp)
+ SettingsNavRow(
+ page = page,
+ onClick = { onOpenPage(page) },
+ modifier = Modifier.testTag(page.testTag)
+ )
+ }
+ HorizontalDivider(thickness = 1.dp)
+ }
+}
+
+/**
+ * The company page: who Samosa AI is, what else they make, and how to reach them.
*
* The body is the same bundled asset the `about_samosa_ai` tool reads
* ([CompanyInfoTool.ABOUT_ASSET]), so what the agent says about the company and
@@ -32,10 +57,9 @@ import com.gotcha.tools.CompanyInfoTool
* Markdown pass the Legal page uses.
*/
@Composable
-fun AboutScreen(
+fun AboutSamosaScreen(
context: Context,
- onBack: () -> Unit,
- onOpenPage: (SettingsPage) -> Unit
+ onBack: () -> Unit
) {
val overlay = rememberSettingsOverlayState()
val uriHandler = LocalUriHandler.current
@@ -46,7 +70,7 @@ fun AboutScreen(
aboutText = readAsset(context, CompanyInfoTool.ABOUT_ASSET)
}
- SettingsScaffold(title = SettingsPage.ABOUT.title, onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = SettingsPage.ABOUT_SAMOSA.title, onBack = onBack, overlay = overlay) {
Text(
text = renderLegalMarkdown(aboutText ?: "(loading…)"),
style = MaterialTheme.typography.bodyMedium
@@ -63,14 +87,6 @@ fun AboutScreen(
LinkRow(label = label, url = url, onOpen = uriHandler::openUri)
}
}
-
- HorizontalDivider(thickness = 1.dp)
-
- SettingsNavRow(
- page = SettingsPage.LEGAL,
- onClick = { onOpenPage(SettingsPage.LEGAL) },
- modifier = Modifier.testTag(SettingsPage.LEGAL.testTag)
- )
}
}
diff --git a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
index 2654794..c184d1c 100644
--- a/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
+++ b/app/src/main/java/com/gotcha/ui/SettingsCommon.kt
@@ -63,12 +63,23 @@ import kotlinx.coroutines.delay
* first — who it thinks you are, which model it runs, what it may touch — and
* the page about how the app presents itself sits at the end.
*
- * [LEGAL] is the one entry the home list does not show: it is reached from
- * inside [ABOUT], which is where a user looking for who made this app and what
- * they agreed to actually goes. It stays a full page here because it is still
- * routed to and deep-linked like any other. See `SettingsHome`.
+ * Most pages hang directly off the home list. The exceptions declare a [parent]:
+ * they are full pages, routed and titled like any other, but reached from inside
+ * that parent instead of from the home list. [ABOUT] is the only such hub today,
+ * collecting "who made this app and what did I agree to" into one row.
*/
-enum class SettingsPage(val title: String, val summary: String, val testTag: String) {
+enum class SettingsPage(
+ val title: String,
+ val summary: String,
+ val testTag: String,
+ /**
+ * The page this one is reached from, or null for the home list. Doubles as
+ * the Back target, so a nested page returns to its hub rather than skipping
+ * out to the home list. Declared lazily because an enum entry cannot name a
+ * later one in its own constructor call.
+ */
+ val parentPage: () -> SettingsPage? = { null }
+) {
PERSONAL_INFO(
"Personal Info",
"Who you are, language, currency, reply style",
@@ -119,11 +130,23 @@ enum class SettingsPage(val title: String, val summary: String, val testTag: Str
"Samosa AI, other products, legal, contact",
"settings_about_row"
),
+ ABOUT_SAMOSA(
+ "About Samosa AI",
+ "Mission, products, pricing, developers",
+ "settings_about_samosa_row",
+ { ABOUT }
+ ),
LEGAL(
"Legal",
"Terms, disclaimer, data retention",
- "settings_legal_row"
- )
+ "settings_legal_row",
+ { ABOUT }
+ );
+
+ /** Pages the home list shows: everything that isn't nested inside a hub. */
+ companion object {
+ val topLevel: List<SettingsPage> get() = entries.filter { it.parentPage() == null }
+ }
}
/**
diff --git a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt b/app/src/main/java/com/gotcha/ui/SettingsScreen.kt
index 697fe0f..1adcaf0 100644
--- a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/SettingsScreen.kt
@@ -100,9 +100,10 @@ fun SettingsScreen(
page: SettingsPage? = null,
onPageChange: (SettingsPage?) -> Unit = {}
) {
- val backToHome = { onPageChange(null) }
+ // Back leaves the sub-page for whatever it hangs off — its hub if it has one,
+ // the home list otherwise. Only the list itself exits Settings.
+ val backToHome = { onPageChange(page?.parentPage?.invoke()) }
- // Back leaves the sub-page for the list; only the list itself exits Settings.
if (page != null) BackHandler(onBack = backToHome)
when (page) {
@@ -163,10 +164,13 @@ fun SettingsScreen(
onSyncServerMessages = onSyncServerMessages
)
SettingsPage.ABOUT -> AboutScreen(
- context = androidx.compose.ui.platform.LocalContext.current,
onBack = backToHome,
onOpenPage = onPageChange
)
+ SettingsPage.ABOUT_SAMOSA -> AboutSamosaScreen(
+ context = androidx.compose.ui.platform.LocalContext.current,
+ onBack = backToHome
+ )
SettingsPage.LEGAL -> LegalScreen(
context = androidx.compose.ui.platform.LocalContext.current,
load = load,
@@ -193,11 +197,7 @@ private fun SettingsHome(
val overlay = rememberSettingsOverlayState()
SettingsScaffold(title = "Settings", onBack = onBack, overlay = overlay) {
- SettingsPage.entries.forEach { entry ->
- // Legal is reached from inside About Us rather than from here, so the
- // top level keeps one row for "who made this and what did I agree to".
- if (entry == SettingsPage.LEGAL) return@forEach
-
+ SettingsPage.topLevel.forEach { entry ->
HorizontalDivider(thickness = 1.dp)
SettingsNavRow(
page = entry,