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(i18n): chat screen, starters, personas, greetings and tour in resources

Durganshu445421813961
diff --git a/app/src/androidTest/java/com/gotcha/ChatRoundTripTest.kt b/app/src/androidTest/java/com/gotcha/ChatRoundTripTest.kt
index 407e4be..face419 100644
--- a/app/src/androidTest/java/com/gotcha/ChatRoundTripTest.kt
+++ b/app/src/androidTest/java/com/gotcha/ChatRoundTripTest.kt
@@ -15,6 +15,7 @@ import androidx.compose.ui.test.longClick
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.platform.app.InstrumentationRegistry
import com.gotcha.testutil.MOCK_REPLY_OK
import com.gotcha.testutil.MockLlm
import com.gotcha.testutil.TestSeed
@@ -115,7 +116,9 @@ class ChatRoundTripTest {
// Filled, not sent: the template is in the composer, the transcript is
// still empty, and nothing went to the LLM.
- composeRule.onNodeWithTag("chat_input").assert(hasText(shown.template))
+ composeRule.onNodeWithTag("chat_input").assert(
+ hasText(InstrumentationRegistry.getInstrumentation().targetContext.getString(shown.template))
+ )
assertTrue(
"tapping a starter must not open the transcript",
composeRule.onAllNodes(hasTestTag("message_list")).fetchSemanticsNodes().isEmpty()
diff --git a/app/src/main/java/com/gotcha/ui/ChatScreen.kt b/app/src/main/java/com/gotcha/ui/ChatScreen.kt
index accf692..f09d624 100644
--- a/app/src/main/java/com/gotcha/ui/ChatScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/ChatScreen.kt
@@ -18,8 +18,8 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
-import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.offset
+import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
@@ -36,15 +36,14 @@ import androidx.compose.material.icons.automirrored.rounded.VolumeUp
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.Mic
-import androidx.compose.material.icons.filled.Notifications
import androidx.compose.material.icons.filled.MoreVert
+import androidx.compose.material.icons.filled.Notifications
import androidx.compose.material.icons.filled.Stop
import androidx.compose.material.icons.filled.TouchApp
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.Notifications
import androidx.compose.material.icons.outlined.Visibility
import androidx.compose.material3.Badge
-import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.BadgedBox
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
@@ -52,6 +51,7 @@ import androidx.compose.material3.Checkbox
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
@@ -77,8 +77,12 @@ import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.pluralStringResource
+import androidx.compose.ui.res.stringArrayResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@@ -204,7 +208,7 @@ fun ChatScreen(
val persona = personaById(state.activePersonaId)
if (persona != null) {
Text(
- persona.label,
+ stringResource(persona.name),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1,
@@ -216,7 +220,7 @@ fun ChatScreen(
},
navigationIcon = {
IconButton(onClick = onOpenDrawer) {
- Icon(Icons.Default.Menu, contentDescription = "Open menu")
+ Icon(Icons.Default.Menu, contentDescription = stringResource(R.string.chat_open_menu))
}
},
actions = {
@@ -264,16 +268,18 @@ fun ChatScreen(
) {
Icon(
if (isOperator) Icons.Filled.TouchApp else Icons.Outlined.Visibility,
- contentDescription = if (isOperator) {
- "Operator mode — tap to switch to Monitor"
- } else {
- "Monitor mode — tap to switch to Operator"
- },
+ contentDescription = stringResource(
+ if (isOperator) {
+ R.string.chat_operator_mode_tap_to_switch
+ } else {
+ R.string.chat_monitor_mode_tap_to_switch
+ }
+ ),
modifier = Modifier.size(15.dp)
)
Spacer(modifier = Modifier.width(5.dp))
Text(
- if (isOperator) "Operator" else "Monitor",
+ stringResource(if (isOperator) R.string.chat_operator else R.string.chat_monitor),
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Bold
)
@@ -283,7 +289,7 @@ fun ChatScreen(
IconButton(onClick = onStopSpeaking) {
Icon(
Icons.AutoMirrored.Rounded.VolumeOff,
- contentDescription = "Stop reading aloud",
+ contentDescription = stringResource(R.string.chat_stop_reading_aloud),
tint = MaterialTheme.colorScheme.error
)
}
@@ -308,7 +314,10 @@ fun ChatScreen(
ContextMeter(fraction = state.contextUsagePercent)
}
if (isHome) {
- val greeting = rememberSaveable(state.activeSessionId) { HOME_GREETINGS.random() }
+ // Gender-neutral greetings; the index is saved, so a language change re-reads it.
+ val greetings = stringArrayResource(R.array.home_greetings)
+ val greetingIndex = rememberSaveable(state.activeSessionId) { greetings.indices.random() }
+ val greeting = greetings[greetingIndex.coerceIn(greetings.indices)]
// `heightIn(min = maxHeight)` inside a scroller keeps the column
// centred exactly as before whenever it fits, and lets it scroll
// once it doesn't — which the persona row made reachable on a
@@ -328,7 +337,7 @@ fun ChatScreen(
// The in-app mark, not the launcher icon: @mipmap/ic_launcher_round
// is an adaptive-icon XML, which painterResource cannot load.
painter = painterResource(R.drawable.gotcha_logo),
- contentDescription = "Gotcha logo",
+ contentDescription = stringResource(R.string.chat_gotcha_logo),
modifier = Modifier.size(96.dp).clip(CircleShape)
)
Spacer(modifier = Modifier.height(24.dp))
@@ -378,12 +387,13 @@ fun ChatScreen(
}
if (starters.isNotEmpty()) {
Spacer(modifier = Modifier.height(24.dp))
+ val context = LocalContext.current
StarterPromptRow(
prompts = starters,
onPick = { prompt ->
// Fill, never send: the template is a draft the
// user is expected to edit first.
- input = prompt.template
+ input = context.getString(prompt.template)
inputWasVoice = false
}
)
@@ -527,7 +537,7 @@ fun ChatScreen(
onClick = onOpenSettings,
modifier = Modifier.fillMaxWidth()
) {
- Text("Set your API key in settings to start chatting →")
+ Text(stringResource(R.string.chat_set_your_api_key_in))
}
}
@@ -549,7 +559,10 @@ fun ChatScreen(
)
Spacer(modifier = Modifier.width(8.dp))
Text(
- "⚡ Agent working in “${state.runningSessionTitle ?: "another chat"}” — you can leave Gotcha; tap to return",
+ stringResource(
+ R.string.chat_agent_working_elsewhere,
+ state.runningSessionTitle ?: stringResource(R.string.chat_another_chat)
+ ),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSecondaryContainer,
maxLines = 2,
@@ -588,14 +601,14 @@ fun ChatScreen(
)
Spacer(modifier = Modifier.width(8.dp))
Text(
- "Reading aloud…",
+ stringResource(R.string.chat_reading_aloud),
style = MaterialTheme.typography.bodySmall,
fontWeight = FontWeight.Medium
)
}
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
- "Stop",
+ stringResource(R.string.chat_stop),
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Bold,
color = MaterialTheme.colorScheme.error
@@ -603,7 +616,7 @@ fun ChatScreen(
Spacer(modifier = Modifier.width(4.dp))
Icon(
Icons.Default.Stop,
- contentDescription = "Stop speaking",
+ contentDescription = stringResource(R.string.chat_stop_speaking),
modifier = Modifier.size(16.dp),
tint = MaterialTheme.colorScheme.error
)
@@ -634,7 +647,7 @@ fun ChatScreen(
)
Spacer(modifier = Modifier.width(8.dp))
Text(
- "Editing message — sending will rewrite the conversation from here",
+ stringResource(R.string.chat_editing_message_sending_will_rewrite),
style = MaterialTheme.typography.bodySmall,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
@@ -648,7 +661,7 @@ fun ChatScreen(
inputWasVoice = false
}
) {
- Text("Cancel")
+ Text(stringResource(R.string.chat_transfer_cancel))
}
}
}
@@ -685,11 +698,13 @@ fun ChatScreen(
shape = RoundedCornerShape(24.dp),
placeholder = {
Text(
- when {
- state.isTranscribing -> "Transcribing…"
- otherChatRunning -> "Finish the running chat first…"
- else -> "Let's Go"
- }
+ stringResource(
+ when {
+ state.isTranscribing -> R.string.chat_transcribing
+ otherChatRunning -> R.string.chat_finish_the_running_chat_first
+ else -> R.string.chat_let_s_go
+ }
+ )
)
},
enabled = !state.isBusy && !state.isTranscribing && state.isConfigured && !otherChatRunning,
@@ -719,7 +734,7 @@ fun ChatScreen(
) {
Icon(
Icons.Default.Stop,
- contentDescription = "Stop",
+ contentDescription = stringResource(R.string.chat_stop),
modifier = Modifier.size(20.dp)
)
}
@@ -748,7 +763,7 @@ fun ChatScreen(
) {
Icon(
Icons.Default.Stop,
- contentDescription = "Stop recording",
+ contentDescription = stringResource(R.string.chat_stop_recording),
modifier = Modifier.size(20.dp),
tint = Color.White
)
@@ -769,7 +784,10 @@ fun ChatScreen(
modifier = Modifier.size(40.dp),
enabled = state.isConfigured && !otherChatRunning
) {
- Icon(Icons.Default.Mic, contentDescription = "Voice input")
+ Icon(
+ Icons.Default.Mic,
+ contentDescription = stringResource(R.string.chat_voice_input)
+ )
}
}
else -> {
@@ -790,7 +808,10 @@ fun ChatScreen(
enabled = state.isConfigured && !otherChatRunning &&
(input.isNotBlank() || pendingAttachments.isNotEmpty())
) {
- Icon(Icons.AutoMirrored.Filled.Send, contentDescription = "Send")
+ Icon(
+ Icons.AutoMirrored.Filled.Send,
+ contentDescription = stringResource(R.string.chat_send)
+ )
}
}
}
@@ -803,18 +824,18 @@ fun ChatScreen(
state.pendingConfirmation?.let { pending ->
SkinAlertDialog(
onDismissRequest = { onConfirm(false) },
- title = { Text("Allow these actions?") },
+ title = { Text(stringResource(R.string.chat_allow_these_actions)) },
text = {
Text(
- "The assistant wants to run:\n\n${pending.description}",
+ stringResource(R.string.chat_wants_to_run, pending.description),
style = MaterialTheme.typography.bodyMedium
)
},
confirmButton = {
- Button(onClick = { onConfirm(true) }) { Text("Allow") }
+ Button(onClick = { onConfirm(true) }) { Text(stringResource(R.string.chat_allow)) }
},
dismissButton = {
- TextButton(onClick = { onConfirm(false) }) { Text("Deny") }
+ TextButton(onClick = { onConfirm(false) }) { Text(stringResource(R.string.chat_deny)) }
}
)
}
@@ -845,11 +866,10 @@ fun ChatScreen(
if (pendingRevert != null) {
SkinAlertDialog(
onDismissRequest = { pendingRevertId = null },
- title = { Text("Revert to this message?") },
+ title = { Text(stringResource(R.string.chat_revert_to_this_message)) },
text = {
Text(
- "This will delete all messages after this one, " +
- "then let you continue the conversation from here.",
+ stringResource(R.string.chat_this_will_delete_all_messages),
style = MaterialTheme.typography.bodyMedium
)
},
@@ -860,10 +880,10 @@ fun ChatScreen(
pendingRevertId = null
onRevertMessage(id)
}
- ) { Text("Revert") }
+ ) { Text(stringResource(R.string.chat_revert)) }
},
dismissButton = {
- TextButton(onClick = { pendingRevertId = null }) { Text("Cancel") }
+ TextButton(onClick = { pendingRevertId = null }) { Text(stringResource(R.string.chat_transfer_cancel)) }
}
)
}
@@ -890,7 +910,11 @@ private fun InboxButton(unread: Int, onClick: () -> Unit) {
) {
Icon(
if (unread > 0) Icons.Filled.Notifications else Icons.Outlined.Notifications,
- contentDescription = if (unread > 0) "Notifications, $unread unread" else "Notifications",
+ contentDescription = if (unread > 0) {
+ pluralStringResource(R.plurals.chat_notifications_unread, unread, unread)
+ } else {
+ stringResource(R.string.chat_notifications)
+ },
tint = MaterialTheme.colorScheme.onSurface
)
}
@@ -937,23 +961,27 @@ private fun ChatOptionsMenu(
BadgedBox(
badge = {
if (unreadNotifications > 0) {
- UnreadBadge(count = unreadNotifications, showCount = false, modifier = Modifier.offset(x = (-2).dp, y = 2.dp))
+ UnreadBadge(
+ count = unreadNotifications,
+ showCount = false,
+ modifier = Modifier.offset(x = (-2).dp, y = 2.dp)
+ )
}
}
) {
Icon(
Icons.Default.MoreVert,
contentDescription = if (unreadNotifications > 0) {
- "Chat options, $unreadNotifications unread notifications"
+ pluralStringResource(R.plurals.chat_options_unread, unreadNotifications, unreadNotifications)
} else {
- "Chat options"
+ stringResource(R.string.chat_options)
}
)
}
}
SkinDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {
DropdownMenuItem(
- text = { Text("Notifications") },
+ text = { Text(stringResource(R.string.chat_notifications)) },
leadingIcon = {
Icon(
if (unreadNotifications > 0) Icons.Filled.Notifications else Icons.Outlined.Notifications,
@@ -971,7 +999,7 @@ private fun ChatOptionsMenu(
)
HorizontalDivider()
DropdownMenuItem(
- text = { Text("Export chat") },
+ text = { Text(stringResource(R.string.chat_export_chat)) },
enabled = shareEnabled,
onClick = {
expanded = false
@@ -979,7 +1007,7 @@ private fun ChatOptionsMenu(
}
)
DropdownMenuItem(
- text = { Text("Back up chat") },
+ text = { Text(stringResource(R.string.chat_back_up_chat)) },
enabled = shareEnabled,
onClick = {
expanded = false
@@ -988,7 +1016,7 @@ private fun ChatOptionsMenu(
modifier = Modifier.testTag("chat_backup")
)
DropdownMenuItem(
- text = { Text("Create share card") },
+ text = { Text(stringResource(R.string.chat_create_share_card)) },
enabled = shareEnabled,
onClick = {
expanded = false
@@ -996,7 +1024,7 @@ private fun ChatOptionsMenu(
}
)
DropdownMenuItem(
- text = { Text("Keep out of notifications") },
+ text = { Text(stringResource(R.string.chat_keep_out_of_notifications)) },
trailingIcon = { Checkbox(checked = keptOutOfNotifications, onCheckedChange = null) },
onClick = { onSetKeptOutOfNotifications(!keptOutOfNotifications) },
modifier = Modifier.testTag("chat_keep_out_of_notifications")
@@ -1017,7 +1045,7 @@ private fun AgentModeSelector(
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text(
- "Agent",
+ stringResource(R.string.chat_agent),
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -1027,14 +1055,14 @@ private fun AgentModeSelector(
modifier = Modifier.fillMaxWidth()
) {
AgentModeOption(
- label = "Monitor",
+ label = stringResource(R.string.chat_monitor),
icon = Icons.Outlined.Visibility,
selected = selected == AgentMode.MONITOR,
onClick = { onSelect(AgentMode.MONITOR) },
modifier = Modifier.weight(1f)
)
AgentModeOption(
- label = "Operator",
+ label = stringResource(R.string.chat_operator),
icon = Icons.Filled.TouchApp,
selected = selected == AgentMode.OPERATOR,
onClick = { onSelect(AgentMode.OPERATOR) },
@@ -1043,11 +1071,13 @@ private fun AgentModeSelector(
}
Spacer(modifier = Modifier.height(6.dp))
Text(
- if (selected == AgentMode.MONITOR) {
- "Read-only — observes but cannot change your device."
- } else {
- "Full control — can make changes to your device."
- },
+ stringResource(
+ if (selected == AgentMode.MONITOR) {
+ R.string.chat_read_only_observes_but_cannot
+ } else {
+ R.string.chat_full_control_can_make_changes
+ }
+ ),
style = MaterialTheme.typography.bodySmall,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant
@@ -1155,8 +1185,7 @@ private fun SampleChatNotice() {
.testTag("sample_chat_notice")
) {
Text(
- "Sample chat — this one ships with Gotcha to show what it can do. " +
- "Carry it on, or delete it from the drawer.",
+ stringResource(R.string.chat_sample_chat_this_one_ships),
style = MaterialTheme.typography.labelMedium,
modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp)
)
diff --git a/app/src/main/java/com/gotcha/ui/Greetings.kt b/app/src/main/java/com/gotcha/ui/Greetings.kt
deleted file mode 100644
index ae081d9..0000000
--- a/app/src/main/java/com/gotcha/ui/Greetings.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.gotcha.ui
-
-/** Gender-neutral greetings for the empty home screen; one is chosen per new session. */
-internal val HOME_GREETINGS = listOf(
- "Hello, how can I help you?",
- "What can I do for you today?",
- "Ready when you are.",
- "What's on your mind?",
- "How can I make your day easier?",
- "Need a hand with something?",
- "Let's get something done.",
- "What would you like to do?",
- "I'm all ears — what do you need?",
- "Where should we start?",
- "Got a task for me?",
- "Happy to help — what's up?",
- "What shall we tackle first?",
- "Ask me anything.",
- "Here to help, whenever you're ready.",
- "What's next on your list?",
- "Let's make something happen.",
- "How can I assist you right now?",
- "Tell me what you need.",
- "At your service — what can I do?"
-)
diff --git a/app/src/main/java/com/gotcha/ui/Persona.kt b/app/src/main/java/com/gotcha/ui/Persona.kt
index 804868b..4c5449c 100644
--- a/app/src/main/java/com/gotcha/ui/Persona.kt
+++ b/app/src/main/java/com/gotcha/ui/Persona.kt
@@ -1,5 +1,6 @@
package com.gotcha.ui
+import androidx.annotation.StringRes
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
@@ -22,9 +23,11 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.compositeOver
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
+import com.gotcha.R
import com.gotcha.tools.AgentMode
import com.gotcha.ui.theme.motionSpec
@@ -51,7 +54,9 @@ import com.gotcha.ui.theme.motionSpec
*/
data class Persona(
val id: String,
+ /** English name, as the model is told it; [name] is what the user sees. */
val label: String,
+ @StringRes val name: Int,
val defaultAgent: AgentMode,
val systemPrompt: String,
val starters: List<StarterPrompt> = emptyList()
@@ -77,6 +82,8 @@ internal val PERSONAS = listOf(
Persona(
id = "doctor",
label = "Doctor",
+
+ name = R.string.persona_doctor,
defaultAgent = AgentMode.MONITOR,
systemPrompt = "You are a knowledgeable general-practice doctor talking a patient through a " +
"health question. Ask about the symptoms that would change your answer before giving one, " +
@@ -89,30 +96,32 @@ internal val PERSONAS = listOf(
"thoughts). Never give dosing instructions for prescription medication.",
starters = listOf(
StarterPrompt(
- label = "Check a symptom",
- template = "I've had … for … days. What could be causing it?"
+ label = R.string.starter_check_a_symptom,
+ template = R.string.starter_check_a_symptom_template
),
StarterPrompt(
- label = "Is this urgent?",
- template = "I have … — should I see a doctor today, or can it wait?"
+ label = R.string.starter_is_this_urgent,
+ template = R.string.starter_is_this_urgent_template
),
StarterPrompt(
- label = "Explain a result",
- template = "Can you explain what this test result means: …"
+ label = R.string.starter_explain_a_result,
+ template = R.string.starter_explain_a_result_template
),
StarterPrompt(
- label = "Sleep better",
- template = "I keep waking up in the night. What usually helps?"
+ label = R.string.starter_sleep_better,
+ template = R.string.starter_sleep_better_template
),
StarterPrompt(
- label = "Cold or flu?",
- template = "I have a sore throat and a temperature. Is it a cold or the flu?"
+ label = R.string.starter_cold_or_flu,
+ template = R.string.starter_cold_or_flu_template
)
)
),
Persona(
id = "chef",
label = "Chef",
+
+ name = R.string.persona_chef,
defaultAgent = AgentMode.MONITOR,
systemPrompt = "You are a working chef helping someone cook. Start from what they actually have " +
"and how much time they have, and give recipes as short numbered steps with real quantities " +
@@ -121,30 +130,32 @@ internal val PERSONAS = listOf(
"advice (cooking temperatures, storage times, reheating) accurate rather than relaxed.",
starters = listOf(
StarterPrompt(
- label = "Cook from my fridge",
- template = "I have … in the fridge. What can I make in 30 minutes?"
+ label = R.string.starter_cook_from_my_fridge,
+ template = R.string.starter_cook_from_my_fridge_template
),
StarterPrompt(
- label = "Plan a dinner",
- template = "Plan a dinner for … people, one of them vegetarian"
+ label = R.string.starter_plan_a_dinner,
+ template = R.string.starter_plan_a_dinner_template
),
StarterPrompt(
- label = "Swap an ingredient",
- template = "What can I use instead of … in …?"
+ label = R.string.starter_swap_an_ingredient,
+ template = R.string.starter_swap_an_ingredient_template
),
StarterPrompt(
- label = "Quick breakfast",
- template = "Give me three breakfasts I can make in under 10 minutes"
+ label = R.string.starter_quick_breakfast,
+ template = R.string.starter_quick_breakfast_template
),
StarterPrompt(
- label = "Fix a dish",
- template = "My … came out too … — what went wrong?"
+ label = R.string.starter_fix_a_dish,
+ template = R.string.starter_fix_a_dish_template
)
)
),
Persona(
id = "fitness_coach",
label = "Fitness Coach",
+
+ name = R.string.persona_fitness_coach,
defaultAgent = AgentMode.MONITOR,
systemPrompt = "You are a personal trainer. Ask about experience level, available equipment and " +
"any injuries before programming anything, then give concrete sessions — exercises, sets, " +
@@ -153,30 +164,32 @@ internal val PERSONAS = listOf(
"them to a professional for anything that hurts rather than working around it.",
starters = listOf(
StarterPrompt(
- label = "Plan my week",
- template = "Plan three workouts a week for a beginner with no equipment"
+ label = R.string.starter_plan_my_week,
+ template = R.string.starter_plan_my_week_template
),
StarterPrompt(
- label = "Start running",
- template = "Give me a plan to run 5 km without stopping"
+ label = R.string.starter_start_running,
+ template = R.string.starter_start_running_template
),
StarterPrompt(
- label = "Check my form",
- template = "How do I squat with good form?"
+ label = R.string.starter_check_my_form,
+ template = R.string.starter_check_my_form_template
),
StarterPrompt(
- label = "Stretch routine",
- template = "Give me a 10-minute stretch for after sitting all day"
+ label = R.string.starter_stretch_routine,
+ template = R.string.starter_stretch_routine_template
),
StarterPrompt(
- label = "Build strength",
- template = "I can go to a gym twice a week. Build me a strength plan"
+ label = R.string.starter_build_strength,
+ template = R.string.starter_build_strength_template
)
)
),
Persona(
id = "tutor",
label = "Tutor",
+
+ name = R.string.persona_tutor,
defaultAgent = AgentMode.MONITOR,
systemPrompt = "You are a patient tutor. Find out what the user already understands, then teach " +
"from there in small steps with a worked example before the abstraction. Ask them to try the " +
@@ -186,30 +199,32 @@ internal val PERSONAS = listOf(
"produce an answer to copy.",
starters = listOf(
StarterPrompt(
- label = "Explain a topic",
- template = "Explain … to me like I'm new to it"
+ label = R.string.starter_explain_a_topic,
+ template = R.string.starter_explain_a_topic_template
),
StarterPrompt(
- label = "Quiz me",
- template = "Quiz me on … one question at a time"
+ label = R.string.starter_quiz_me,
+ template = R.string.starter_quiz_me_template
),
StarterPrompt(
- label = "Help with a problem",
- template = "I'm stuck on this problem: …"
+ label = R.string.starter_help_with_a_problem,
+ template = R.string.starter_help_with_a_problem_template
),
StarterPrompt(
- label = "Check my answer",
- template = "Here's my working for …. Where did I go wrong?"
+ label = R.string.starter_check_my_answer,
+ template = R.string.starter_check_my_answer_template
),
StarterPrompt(
- label = "Make a study plan",
- template = "I have an exam on … in two weeks. Help me plan my revision"
+ label = R.string.starter_make_a_study_plan,
+ template = R.string.starter_make_a_study_plan_template
)
)
),
Persona(
id = "travel_planner",
label = "Travel Planner",
+
+ name = R.string.persona_travel_planner,
defaultAgent = AgentMode.MONITOR,
systemPrompt = "You are a well-travelled trip planner. Pin down dates, budget, pace and who is " +
"travelling before proposing anything, then give day-by-day itineraries that account for " +
@@ -219,30 +234,32 @@ internal val PERSONAS = listOf(
"travel advisories must be checked against official sources.",
starters = listOf(
StarterPrompt(
- label = "Plan a weekend",
- template = "Plan a weekend in … for two on a mid-range budget"
+ label = R.string.starter_plan_a_weekend,
+ template = R.string.starter_plan_a_weekend_template
),
StarterPrompt(
- label = "Build an itinerary",
- template = "Build a 5-day itinerary for … in …"
+ label = R.string.starter_build_an_itinerary,
+ template = R.string.starter_build_an_itinerary_template
),
StarterPrompt(
- label = "Packing list",
- template = "What should I pack for a week in … in …?"
+ label = R.string.starter_packing_list,
+ template = R.string.starter_packing_list_template
),
StarterPrompt(
- label = "Best time to go",
- template = "When is the best time of year to visit …?"
+ label = R.string.starter_best_time_to_go,
+ template = R.string.starter_best_time_to_go_template
),
StarterPrompt(
- label = "Trip on a budget",
- template = "Where can I go for a week from … on a budget of …?"
+ label = R.string.starter_trip_on_a_budget,
+ template = R.string.starter_trip_on_a_budget_template
)
)
),
Persona(
id = "handyman",
label = "Handyman",
+
+ name = R.string.persona_handyman,
defaultAgent = AgentMode.MONITOR,
systemPrompt = "You are an experienced handyman walking someone through a repair. Work out what " +
"the thing actually is and what tools they own, then give ordered steps with the tools and " +
@@ -251,24 +268,24 @@ internal val PERSONAS = listOf(
"electrician, plumber or gas fitter, and do not talk the user through it anyway.",
starters = listOf(
StarterPrompt(
- label = "Fix a leaky tap",
- template = "My tap keeps dripping. How do I fix it?"
+ label = R.string.starter_fix_a_leaky_tap,
+ template = R.string.starter_fix_a_leaky_tap_template
),
StarterPrompt(
- label = "Hang a shelf",
- template = "How do I hang a heavy shelf on a … wall?"
+ label = R.string.starter_hang_a_shelf,
+ template = R.string.starter_hang_a_shelf_template
),
StarterPrompt(
- label = "Unblock a drain",
- template = "My sink drains slowly. How do I clear it?"
+ label = R.string.starter_unblock_a_drain,
+ template = R.string.starter_unblock_a_drain_template
),
StarterPrompt(
- label = "Patch a wall",
- template = "How do I fill a hole in plasterboard?"
+ label = R.string.starter_patch_a_wall,
+ template = R.string.starter_patch_a_wall_template
),
StarterPrompt(
- label = "Squeaky door",
- template = "How do I stop a door from squeaking?"
+ label = R.string.starter_squeaky_door,
+ template = R.string.starter_squeaky_door_template
)
)
)
@@ -308,7 +325,7 @@ internal fun PersonaRow(
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
- "Persona",
+ stringResource(R.string.persona_persona),
style = MaterialTheme.typography.labelMedium,
color = scheme.onSurfaceVariant
)
@@ -367,7 +384,7 @@ private fun PersonaChip(
modifier = Modifier.testTag("persona_${persona.id}")
) {
Text(
- persona.label,
+ stringResource(persona.name),
style = MaterialTheme.typography.labelLarge,
fontWeight = if (selected) FontWeight.Bold else FontWeight.Normal,
textAlign = TextAlign.Center,
diff --git a/app/src/main/java/com/gotcha/ui/StarterPrompt.kt b/app/src/main/java/com/gotcha/ui/StarterPrompt.kt
index 573db5c..0be9423 100644
--- a/app/src/main/java/com/gotcha/ui/StarterPrompt.kt
+++ b/app/src/main/java/com/gotcha/ui/StarterPrompt.kt
@@ -1,5 +1,6 @@
package com.gotcha.ui
+import androidx.annotation.StringRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@@ -19,8 +20,10 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
+import com.gotcha.R
/**
* One tap-to-fill suggestion on the empty home screen.
@@ -33,7 +36,7 @@ import androidx.compose.ui.unit.dp
*
* Public only because [Persona] carries its own list of them.
*/
-data class StarterPrompt(val label: String, val template: String)
+data class StarterPrompt(@StringRes val label: Int, @StringRes val template: Int)
/**
* The default starters, offered on an empty chat with no persona picked (or a
@@ -52,32 +55,32 @@ data class StarterPrompt(val label: String, val template: String)
*/
internal val STARTER_PROMPTS = listOf(
StarterPrompt(
- label = "Turn on Wi-Fi",
- template = "Open settings and turn on Wi-Fi"
+ label = R.string.starter_turn_on_wi_fi,
+ template = R.string.starter_turn_on_wi_fi_template
),
StarterPrompt(
- label = "Set an alarm",
- template = "Set an alarm for 7am tomorrow"
+ label = R.string.starter_set_an_alarm,
+ template = R.string.starter_set_an_alarm_template
),
StarterPrompt(
- label = "Read my screen",
- template = "What's on my screen?"
+ label = R.string.starter_read_my_screen,
+ template = R.string.starter_read_my_screen_template
),
StarterPrompt(
- label = "Find big files",
- template = "Find the largest files in my Downloads folder and tell me what's safe to delete"
+ label = R.string.starter_find_big_files,
+ template = R.string.starter_find_big_files_template
),
StarterPrompt(
- label = "Summarise a PDF",
- template = "Read the most recent PDF in my Downloads and summarise it"
+ label = R.string.starter_summarise_a_pdf,
+ template = R.string.starter_summarise_a_pdf_template
),
StarterPrompt(
- label = "Send a WhatsApp",
- template = "Send a WhatsApp to … saying …"
+ label = R.string.starter_send_a_whatsapp,
+ template = R.string.starter_send_a_whatsapp_template
),
StarterPrompt(
- label = "Catch me up",
- template = "Catch me up on my unread notifications"
+ label = R.string.starter_catch_me_up,
+ template = R.string.starter_catch_me_up_template
)
)
@@ -102,7 +105,7 @@ internal fun startersFor(persona: Persona?): List<StarterPrompt> =
* drops out, and the row is refilled from [pool] so a stale save never shows
* fewer than [STARTER_PROMPT_COUNT] chips.
*/
-internal fun starterPromptLabelsSaver(pool: List<StarterPrompt>) = listSaver<List<StarterPrompt>, String>(
+internal fun starterPromptLabelsSaver(pool: List<StarterPrompt>) = listSaver<List<StarterPrompt>, Int>(
save = { prompts -> prompts.map { it.label } },
restore = { labels ->
val restored = labels.mapNotNull { label -> pool.firstOrNull { it.label == label } }
@@ -133,7 +136,7 @@ internal fun StarterPromptRow(
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
- "Try",
+ stringResource(R.string.starter_try),
style = MaterialTheme.typography.labelMedium,
color = scheme.onSurfaceVariant
)
@@ -153,7 +156,7 @@ internal fun StarterPromptRow(
modifier = Modifier.testTag("starter_prompt_${prompt.label}")
) {
Text(
- prompt.label,
+ stringResource(prompt.label),
style = MaterialTheme.typography.labelLarge,
textAlign = TextAlign.Center,
modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp)
diff --git a/app/src/main/java/com/gotcha/ui/tour/TourOverlay.kt b/app/src/main/java/com/gotcha/ui/tour/TourOverlay.kt
index 344aaba..edef0cd 100644
--- a/app/src/main/java/com/gotcha/ui/tour/TourOverlay.kt
+++ b/app/src/main/java/com/gotcha/ui/tour/TourOverlay.kt
@@ -261,7 +261,7 @@ private fun Pulse(spotlight: Rect) {
animation = tween(durationMillis = 1800, easing = LinearEasing),
repeatMode = RepeatMode.Restart
),
- label = stringResource(R.string.tour_tour_pulse_progress)
+ label = "tour_pulse_progress"
).value
} else {
0f
@@ -311,18 +311,18 @@ private fun CoachCard(
color = MaterialTheme.colorScheme.primary
)
Text(
- text = step.title,
+ text = stringResource(step.title),
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.SemiBold
)
Text(
- text = step.body,
+ text = stringResource(step.body),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
step.hint?.let {
Text(
- text = it,
+ text = stringResource(it),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -339,7 +339,7 @@ private fun CoachCard(
.fillMaxWidth()
.padding(top = 4.dp)
.testTag("tour_action")
- ) { Text(action.label) }
+ ) { Text(stringResource(action.label)) }
}
Row(
modifier = Modifier.fillMaxWidth(),
@@ -354,7 +354,7 @@ private fun CoachCard(
TextButton(
onClick = { controller.acknowledge() },
modifier = Modifier.testTag("tour_ack")
- ) { Text(step.ackLabel) }
+ ) { Text(stringResource(step.ackLabel)) }
} else {
Text(
text = stringResource(R.string.tour_waiting_for_you),
diff --git a/app/src/main/java/com/gotcha/ui/tour/TourStep.kt b/app/src/main/java/com/gotcha/ui/tour/TourStep.kt
index 6bdf836..fc36507 100644
--- a/app/src/main/java/com/gotcha/ui/tour/TourStep.kt
+++ b/app/src/main/java/com/gotcha/ui/tour/TourStep.kt
@@ -1,6 +1,8 @@
package com.gotcha.ui.tour
import android.content.Context
+import androidx.annotation.StringRes
+import com.gotcha.R
import com.gotcha.data.Settings
import com.gotcha.tools.ToolResult
import com.gotcha.ui.isAccessibilityGranted
@@ -33,7 +35,7 @@ enum class TourPlace {
* the app. [marker] is one of [com.gotcha.tools.ToolResult]'s special-access
* markers, resolved through the same intent table the Permissions screen uses.
*/
-data class TourAction(val label: String, val marker: String)
+data class TourAction(@StringRes val label: Int, val marker: String)
/**
* One instruction in the guided setup.
@@ -66,13 +68,13 @@ data class TourAction(val label: String, val marker: String)
data class TourStep(
val id: String,
val place: TourPlace,
- val title: String,
- val body: String,
+ @StringRes val title: Int,
+ @StringRes val body: Int,
val autoNavigate: Boolean = true,
val anchor: TourAnchor? = null,
- val hint: String? = null,
+ @StringRes val hint: Int? = null,
val requiresAnchor: Boolean = false,
- val ackLabel: String? = null,
+ @StringRes val ackLabel: Int? = null,
val action: TourAction? = null,
val isDone: (Settings, Context) -> Boolean = { _, _ -> false }
)
@@ -94,53 +96,51 @@ private fun brainSteps(): List<TourStep> = listOf(
id = "open_settings",
place = TourPlace.CHAT_DRAWER,
anchor = TourAnchor.DRAWER_SETTINGS,
- title = "Everything lives behind here",
- body = "Swipe in from the left edge any time to reach this menu. Tap Settings to start.",
- hint = "Tip: the same swipe works from anywhere in the chat."
+ title = R.string.tour_open_settings_title,
+ body = R.string.tour_open_settings_body,
+ hint = R.string.tour_open_settings_hint
),
TourStep(
id = "open_ai",
place = TourPlace.SETTINGS_HOME,
autoNavigate = false,
anchor = TourAnchor.SETTINGS_AI,
- title = "Start with AI",
- body = "Everything Gotcha thinks, hears and says with is behind this row. Open it."
+ title = R.string.tour_open_ai_title,
+ body = R.string.tour_open_ai_body
),
TourStep(
id = "open_ai_config",
place = TourPlace.AI_HUB,
autoNavigate = false,
anchor = TourAnchor.SETTINGS_AI_CONFIG,
- title = "Give Gotcha a brain",
- body = "AI Configuration is where the model lives. Open it — you'll come back here to " +
- "change models later, and to pick a voice."
+ title = R.string.tour_open_ai_config_title,
+ body = R.string.tour_open_ai_config_body
),
TourStep(
id = "choose_provider",
place = TourPlace.AI_CONFIG,
anchor = TourAnchor.AI_PROVIDER,
- title = "Pick who does the thinking",
- body = "Samosa AI gives you a model, speech and transcription on a free daily allowance — " +
- "no keys to paste. Choose OpenAI-compatible instead if you'd rather bring your own.",
- ackLabel = "Next"
+ title = R.string.tour_choose_provider_title,
+ body = R.string.tour_choose_provider_body,
+ ackLabel = R.string.tour_next
),
TourStep(
id = "samosa_sign_in",
place = TourPlace.AI_CONFIG,
anchor = TourAnchor.AI_SAMOSA_SIGN_IN,
requiresAnchor = true,
- title = "Sign in once",
- body = "One Google account covers the model, the voice and the transcription.",
- ackLabel = "Next",
+ title = R.string.tour_samosa_sign_in_title,
+ body = R.string.tour_samosa_sign_in_body,
+ ackLabel = R.string.tour_next,
isDone = { settings, _ -> settings.isSamosaAuthenticated }
),
TourStep(
id = "save_ai_config",
place = TourPlace.AI_CONFIG,
anchor = TourAnchor.AI_SAVE,
- title = "Save it",
- body = "Nothing on this page takes effect until you do.",
- ackLabel = "Next",
+ title = R.string.tour_save_ai_config_title,
+ body = R.string.tour_save_ai_config_body,
+ ackLabel = R.string.tour_next,
isDone = { settings, _ -> settings.hasUsableModel }
)
)
@@ -151,29 +151,26 @@ private fun permissionSteps(): List<TourStep> = listOf(
id = "open_permissions",
place = TourPlace.SETTINGS_HOME,
anchor = TourAnchor.SETTINGS_PERMISSIONS,
- title = "Now decide what it may touch",
- body = "Open Permissions. Two of them are worth granting now; the rest can wait."
+ title = R.string.tour_open_permissions_title,
+ body = R.string.tour_open_permissions_body
),
TourStep(
id = "grant_accessibility",
place = TourPlace.PERMISSIONS,
- title = "Accessibility is the important one",
- body = "It's what lets Gotcha read the screen and tap for you. Without it the assistant " +
- "can answer questions but cannot do anything. The switch is Android's, not ours.",
- hint = "Look for Gotcha in the list. On some phones it lives under Settings › " +
- "Additional settings › Accessibility › Installed apps.",
- ackLabel = "Next",
- action = TourAction("Open Android settings", ToolResult.ACCESSIBILITY_ACCESS),
+ title = R.string.tour_grant_accessibility_title,
+ body = R.string.tour_grant_accessibility_body,
+ hint = R.string.tour_grant_accessibility_hint,
+ ackLabel = R.string.tour_next,
+ action = TourAction(R.string.tour_open_android_settings, ToolResult.ACCESSIBILITY_ACCESS),
isDone = { _, context -> isAccessibilityGranted(context) }
),
TourStep(
id = "grant_overlay",
place = TourPlace.PERMISSIONS,
- title = "And one for the floating ball",
- body = "\"Display over other apps\" lets the assistive ball and Screen Lens appear on " +
- "top of whatever you're using.",
- ackLabel = "Next",
- action = TourAction("Open Android settings", ToolResult.OVERLAY_ACCESS),
+ title = R.string.tour_grant_overlay_title,
+ body = R.string.tour_grant_overlay_body,
+ ackLabel = R.string.tour_next,
+ action = TourAction(R.string.tour_open_android_settings, ToolResult.OVERLAY_ACCESS),
isDone = { _, context -> isOverlayGranted(context) }
)
)
@@ -184,34 +181,31 @@ private fun profileSteps(): List<TourStep> = listOf(
id = "open_personal_info",
place = TourPlace.SETTINGS_HOME,
anchor = TourAnchor.SETTINGS_PERSONAL_INFO,
- title = "Last thing: who are you?",
- body = "Open Personal Info. What you put here reaches every reply — your language, your " +
- "units, your currency."
+ title = R.string.tour_open_personal_info_title,
+ body = R.string.tour_open_personal_info_body
),
TourStep(
id = "fill_personal_info",
place = TourPlace.PERSONAL_INFO,
anchor = TourAnchor.PERSONAL_NAME,
- title = "Tell it your name",
- body = "Type whatever you'd like to be called. Everything on this page is optional, and " +
- "all of it makes the answers fit you better.",
- ackLabel = "Next"
+ title = R.string.tour_fill_personal_info_title,
+ body = R.string.tour_fill_personal_info_body,
+ ackLabel = R.string.tour_next
),
TourStep(
id = "save_personal_info",
place = TourPlace.PERSONAL_INFO,
anchor = TourAnchor.PERSONAL_SAVE,
- title = "Save it",
- body = "Same as before — nothing on the page counts until you do.",
- ackLabel = "Next",
+ title = R.string.tour_save_personal_info_title,
+ body = R.string.tour_save_personal_info_body,
+ ackLabel = R.string.tour_next,
isDone = { settings, _ -> settings.userName.isNotBlank() }
),
TourStep(
id = "finish",
place = TourPlace.CHAT,
- title = "That's the tour",
- body = "Anything you skipped is waiting in Settings, and Feature Tour there replays this " +
- "whenever you want it.",
- ackLabel = "Start using Gotcha"
+ title = R.string.tour_finish_title,
+ body = R.string.tour_finish_body,
+ ackLabel = R.string.tour_start_using
)
)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5805df7..0f70892 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -807,7 +807,6 @@
<!-- TourOverlay -->
<string name="tour_skip_tour">Skip tour</string>
- <string name="tour_tour_pulse_progress">tour_pulse_progress</string>
<string name="tour_waiting_for_you">Waiting for you…</string>
<!-- Screen companion panel -->
@@ -911,4 +910,202 @@
<string name="attachment_document">document</string>
<string name="attachment_truncated"> · truncated</string>
<string name="tour_step_of">STEP %1$d OF %2$d</string>
+
+ <!-- Starter prompts -->
+ <string name="starter_turn_on_wi_fi">Turn on Wi-Fi</string>
+ <string name="starter_turn_on_wi_fi_template">Open settings and turn on Wi-Fi</string>
+ <string name="starter_set_an_alarm">Set an alarm</string>
+ <string name="starter_set_an_alarm_template">Set an alarm for 7am tomorrow</string>
+ <string name="starter_read_my_screen">Read my screen</string>
+ <string name="starter_read_my_screen_template">What\'s on my screen?</string>
+ <string name="starter_find_big_files">Find big files</string>
+ <string name="starter_find_big_files_template">Find the largest files in my Downloads folder and tell me what\'s safe to delete</string>
+ <string name="starter_summarise_a_pdf">Summarise a PDF</string>
+ <string name="starter_summarise_a_pdf_template">Read the most recent PDF in my Downloads and summarise it</string>
+ <string name="starter_send_a_whatsapp">Send a WhatsApp</string>
+ <string name="starter_send_a_whatsapp_template">Send a WhatsApp to … saying …</string>
+ <string name="starter_catch_me_up">Catch me up</string>
+ <string name="starter_catch_me_up_template">Catch me up on my unread notifications</string>
+ <string name="starter_check_a_symptom">Check a symptom</string>
+ <string name="starter_check_a_symptom_template">I\'ve had … for … days. What could be causing it?</string>
+ <string name="starter_is_this_urgent">Is this urgent?</string>
+ <string name="starter_is_this_urgent_template">I have … — should I see a doctor today, or can it wait?</string>
+ <string name="starter_explain_a_result">Explain a result</string>
+ <string name="starter_explain_a_result_template">Can you explain what this test result means: …</string>
+ <string name="starter_sleep_better">Sleep better</string>
+ <string name="starter_sleep_better_template">I keep waking up in the night. What usually helps?</string>
+ <string name="starter_cold_or_flu">Cold or flu?</string>
+ <string name="starter_cold_or_flu_template">I have a sore throat and a temperature. Is it a cold or the flu?</string>
+ <string name="starter_cook_from_my_fridge">Cook from my fridge</string>
+ <string name="starter_cook_from_my_fridge_template">I have … in the fridge. What can I make in 30 minutes?</string>
+ <string name="starter_plan_a_dinner">Plan a dinner</string>
+ <string name="starter_plan_a_dinner_template">Plan a dinner for … people, one of them vegetarian</string>
+ <string name="starter_swap_an_ingredient">Swap an ingredient</string>
+ <string name="starter_swap_an_ingredient_template">What can I use instead of … in …?</string>
+ <string name="starter_quick_breakfast">Quick breakfast</string>
+ <string name="starter_quick_breakfast_template">Give me three breakfasts I can make in under 10 minutes</string>
+ <string name="starter_fix_a_dish">Fix a dish</string>
+ <string name="starter_fix_a_dish_template">My … came out too … — what went wrong?</string>
+ <string name="starter_plan_my_week">Plan my week</string>
+ <string name="starter_plan_my_week_template">Plan three workouts a week for a beginner with no equipment</string>
+ <string name="starter_start_running">Start running</string>
+ <string name="starter_start_running_template">Give me a plan to run 5 km without stopping</string>
+ <string name="starter_check_my_form">Check my form</string>
+ <string name="starter_check_my_form_template">How do I squat with good form?</string>
+ <string name="starter_stretch_routine">Stretch routine</string>
+ <string name="starter_stretch_routine_template">Give me a 10-minute stretch for after sitting all day</string>
+ <string name="starter_build_strength">Build strength</string>
+ <string name="starter_build_strength_template">I can go to a gym twice a week. Build me a strength plan</string>
+ <string name="starter_explain_a_topic">Explain a topic</string>
+ <string name="starter_explain_a_topic_template">Explain … to me like I\'m new to it</string>
+ <string name="starter_quiz_me">Quiz me</string>
+ <string name="starter_quiz_me_template">Quiz me on … one question at a time</string>
+ <string name="starter_help_with_a_problem">Help with a problem</string>
+ <string name="starter_help_with_a_problem_template">I\'m stuck on this problem: …</string>
+ <string name="starter_check_my_answer">Check my answer</string>
+ <string name="starter_check_my_answer_template">Here\'s my working for …. Where did I go wrong?</string>
+ <string name="starter_make_a_study_plan">Make a study plan</string>
+ <string name="starter_make_a_study_plan_template">I have an exam on … in two weeks. Help me plan my revision</string>
+ <string name="starter_plan_a_weekend">Plan a weekend</string>
+ <string name="starter_plan_a_weekend_template">Plan a weekend in … for two on a mid-range budget</string>
+ <string name="starter_build_an_itinerary">Build an itinerary</string>
+ <string name="starter_build_an_itinerary_template">Build a 5-day itinerary for … in …</string>
+ <string name="starter_packing_list">Packing list</string>
+ <string name="starter_packing_list_template">What should I pack for a week in … in …?</string>
+ <string name="starter_best_time_to_go">Best time to go</string>
+ <string name="starter_best_time_to_go_template">When is the best time of year to visit …?</string>
+ <string name="starter_trip_on_a_budget">Trip on a budget</string>
+ <string name="starter_trip_on_a_budget_template">Where can I go for a week from … on a budget of …?</string>
+ <string name="starter_fix_a_leaky_tap">Fix a leaky tap</string>
+ <string name="starter_fix_a_leaky_tap_template">My tap keeps dripping. How do I fix it?</string>
+ <string name="starter_hang_a_shelf">Hang a shelf</string>
+ <string name="starter_hang_a_shelf_template">How do I hang a heavy shelf on a … wall?</string>
+ <string name="starter_unblock_a_drain">Unblock a drain</string>
+ <string name="starter_unblock_a_drain_template">My sink drains slowly. How do I clear it?</string>
+ <string name="starter_patch_a_wall">Patch a wall</string>
+ <string name="starter_patch_a_wall_template">How do I fill a hole in plasterboard?</string>
+ <string name="starter_squeaky_door">Squeaky door</string>
+ <string name="starter_squeaky_door_template">How do I stop a door from squeaking?</string>
+
+ <!-- Personas -->
+ <string name="persona_doctor">Doctor</string>
+ <string name="persona_chef">Chef</string>
+ <string name="persona_fitness_coach">Fitness Coach</string>
+ <string name="persona_tutor">Tutor</string>
+ <string name="persona_travel_planner">Travel Planner</string>
+ <string name="persona_handyman">Handyman</string>
+
+ <!-- Starter row -->
+ <string name="starter_try">Try</string>
+
+ <!-- Persona -->
+ <string name="persona_persona">Persona</string>
+
+ <!-- Home screen greetings; one is picked per new chat. Gender-neutral. -->
+ <string-array name="home_greetings">
+ <item>Hello, how can I help you?</item>
+ <item>What can I do for you today?</item>
+ <item>Ready when you are.</item>
+ <item>What\'s on your mind?</item>
+ <item>How can I make your day easier?</item>
+ <item>Need a hand with something?</item>
+ <item>Let\'s get something done.</item>
+ <item>What would you like to do?</item>
+ <item>I\'m all ears — what do you need?</item>
+ <item>Where should we start?</item>
+ <item>Got a task for me?</item>
+ <item>Happy to help — what\'s up?</item>
+ <item>What shall we tackle first?</item>
+ <item>Ask me anything.</item>
+ <item>Here to help, whenever you\'re ready.</item>
+ <item>What\'s next on your list?</item>
+ <item>Let\'s make something happen.</item>
+ <item>How can I assist you right now?</item>
+ <item>Tell me what you need.</item>
+ <item>At your service — what can I do?</item>
+ </string-array>
+
+ <!-- ChatScreen -->
+ <string name="chat_set_your_api_key_in">Set your API key in settings to start chatting →</string>
+ <string name="chat_allow_these_actions">Allow these actions?</string>
+ <string name="chat_allow">Allow</string>
+ <string name="chat_deny">Deny</string>
+ <string name="chat_revert_to_this_message">Revert to this message?</string>
+ <string name="chat_revert">Revert</string>
+ <string name="chat_notifications">Notifications</string>
+ <string name="chat_export_chat">Export chat</string>
+ <string name="chat_back_up_chat">Back up chat</string>
+ <string name="chat_create_share_card">Create share card</string>
+ <string name="chat_keep_out_of_notifications">Keep out of notifications</string>
+ <string name="chat_stop_reading_aloud">Stop reading aloud</string>
+ <string name="chat_gotcha_logo">Gotcha logo</string>
+ <string name="chat_stop_speaking">Stop speaking</string>
+ <string name="chat_stop">Stop</string>
+ <string name="chat_stop_recording">Stop recording</string>
+ <string name="chat_monitor">Monitor</string>
+ <string name="chat_operator">Operator</string>
+ <string name="chat_reading_aloud">Reading aloud…</string>
+ <string name="chat_editing_message_sending_will_rewrite">Editing message — sending will rewrite the conversation from here</string>
+ <string name="chat_this_will_delete_all_messages">This will delete all messages after this one, then let you continue the conversation from here.</string>
+ <string name="chat_agent">Agent</string>
+ <string name="chat_sample_chat_this_one_ships">Sample chat — this one ships with Gotcha to show what it can do. Carry it on, or delete it from the drawer.</string>
+ <string name="chat_operator_mode_tap_to_switch">Operator mode — tap to switch to Monitor</string>
+ <string name="chat_monitor_mode_tap_to_switch">Monitor mode — tap to switch to Operator</string>
+ <string name="chat_read_only_observes_but_cannot">Read-only — observes but cannot change your device.</string>
+ <string name="chat_full_control_can_make_changes">Full control — can make changes to your device.</string>
+
+ <!-- Chat screen -->
+ <string name="chat_open_menu">Open menu</string>
+ <string name="chat_another_chat">another chat</string>
+ <string name="chat_agent_working_elsewhere">⚡ Agent working in “%1$s” — you can leave Gotcha; tap to return</string>
+ <string name="chat_voice_input">Voice input</string>
+ <string name="chat_send">Send</string>
+ <string name="chat_wants_to_run">The assistant wants to run:\n\n%1$s</string>
+ <string name="chat_options">Chat options</string>
+ <string name="chat_transcribing">Transcribing…</string>
+ <string name="chat_finish_the_running_chat_first">Finish the running chat first…</string>
+ <string name="chat_let_s_go">Let\'s Go</string>
+ <plurals name="chat_notifications_unread">
+ <item quantity="one">Notifications, %1$d unread</item>
+ <item quantity="other">Notifications, %1$d unread</item>
+ </plurals>
+ <plurals name="chat_options_unread">
+ <item quantity="one">Chat options, %1$d unread notification</item>
+ <item quantity="other">Chat options, %1$d unread notifications</item>
+ </plurals>
+
+ <!-- Feature tour -->
+ <string name="tour_open_settings_title">Everything lives behind here</string>
+ <string name="tour_open_settings_body">Swipe in from the left edge any time to reach this menu. Tap Settings to start.</string>
+ <string name="tour_open_settings_hint">Tip: the same swipe works from anywhere in the chat.</string>
+ <string name="tour_open_ai_title">Start with AI</string>
+ <string name="tour_open_ai_body">Everything Gotcha thinks, hears and says with is behind this row. Open it.</string>
+ <string name="tour_open_ai_config_title">Give Gotcha a brain</string>
+ <string name="tour_open_ai_config_body">AI Configuration is where the model lives. Open it — you\'ll come back here to change models later, and to pick a voice.</string>
+ <string name="tour_choose_provider_title">Pick who does the thinking</string>
+ <string name="tour_choose_provider_body">Samosa AI gives you a model, speech and transcription on a free daily allowance — no keys to paste. Choose OpenAI-compatible instead if you\'d rather bring your own.</string>
+ <string name="tour_samosa_sign_in_title">Sign in once</string>
+ <string name="tour_samosa_sign_in_body">One Google account covers the model, the voice and the transcription.</string>
+ <string name="tour_save_ai_config_title">Save it</string>
+ <string name="tour_save_ai_config_body">Nothing on this page takes effect until you do.</string>
+ <string name="tour_open_permissions_title">Now decide what it may touch</string>
+ <string name="tour_open_permissions_body">Open Permissions. Two of them are worth granting now; the rest can wait.</string>
+ <string name="tour_grant_accessibility_title">Accessibility is the important one</string>
+ <string name="tour_grant_accessibility_body">It\'s what lets Gotcha read the screen and tap for you. Without it the assistant can answer questions but cannot do anything. The switch is Android\'s, not ours.</string>
+ <string name="tour_grant_accessibility_hint">Look for Gotcha in the list. On some phones it lives under Settings › Additional settings › Accessibility › Installed apps.</string>
+ <string name="tour_grant_overlay_title">And one for the floating ball</string>
+ <string name="tour_grant_overlay_body">\"Display over other apps\" lets the assistive ball and Screen Lens appear on top of whatever you\'re using.</string>
+ <string name="tour_open_personal_info_title">Last thing: who are you?</string>
+ <string name="tour_open_personal_info_body">Open Personal Info. What you put here reaches every reply — your language, your units, your currency.</string>
+ <string name="tour_fill_personal_info_title">Tell it your name</string>
+ <string name="tour_fill_personal_info_body">Type whatever you\'d like to be called. Everything on this page is optional, and all of it makes the answers fit you better.</string>
+ <string name="tour_save_personal_info_title">Save it</string>
+ <string name="tour_save_personal_info_body">Same as before — nothing on the page counts until you do.</string>
+ <string name="tour_finish_title">That\'s the tour</string>
+ <string name="tour_finish_body">Anything you skipped is waiting in Settings, and Feature Tour there replays this whenever you want it.</string>
+ <string name="tour_next">Next</string>
+ <string name="tour_open_android_settings">Open Android settings</string>
+
+ <!-- Feature tour: finish -->
+ <string name="tour_start_using">Start using Gotcha</string>
</resources>
diff --git a/app/src/test/java/com/gotcha/ui/StarterPromptsTest.kt b/app/src/test/java/com/gotcha/ui/StarterPromptsTest.kt
index b923e44..76e9ed7 100644
--- a/app/src/test/java/com/gotcha/ui/StarterPromptsTest.kt
+++ b/app/src/test/java/com/gotcha/ui/StarterPromptsTest.kt
@@ -1,18 +1,26 @@
package com.gotcha.ui
+import android.content.Context
import androidx.compose.runtime.saveable.SaverScope
+import androidx.test.core.app.ApplicationProvider
import org.junit.Assert.assertEquals
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Test
+import org.junit.runner.RunWith
+import org.robolectric.RobolectricTestRunner
/**
* [STARTER_PROMPTS] and each persona's starters are hand-edited lists that the
* home screen draws from blindly. These are the invariants that drawing relies
- * on, checked for every pool the screen can draw from.
+ * on, checked for every pool the screen can draw from. The text is string
+ * resources, read here in English.
*/
+@RunWith(RobolectricTestRunner::class)
class StarterPromptsTest {
+ private val context: Context = ApplicationProvider.getApplicationContext()
+
/** The default list plus every persona's own, by a name for failure messages. */
private val pools: Map<String, List<StarterPrompt>> =
mapOf("default" to STARTER_PROMPTS) +
@@ -34,12 +42,13 @@ class StarterPromptsTest {
fun `every starter has a label and a template`() {
pools.forEach { (name, pool) ->
pool.forEach { prompt ->
- assertTrue("Blank label in $name: $prompt", prompt.label.isNotBlank())
- assertTrue("Blank template in $name: $prompt", prompt.template.isNotBlank())
+ val label = context.getString(prompt.label)
+ assertTrue("Blank label in $name: $prompt", label.isNotBlank())
+ assertTrue("Blank template in $name: $prompt", context.getString(prompt.template).isNotBlank())
// The chip has to sit three to a row on a phone.
assertTrue(
- "Label too long to fit a chip in $name: '${prompt.label}'",
- prompt.label.length <= 20
+ "Label too long to fit a chip in $name: '$label'",
+ label.length <= 20
)
}
}
@@ -71,7 +80,7 @@ class StarterPromptsTest {
fun `saver refills a stale save from its own pool`() {
val pool = requireNotNull(personaById("doctor")).starters
val restored = requireNotNull(
- starterPromptLabelsSaver(pool).restore(listOf(pool.first().label, "A starter since removed"))
+ starterPromptLabelsSaver(pool).restore(listOf(pool.first().label, -1))
)
assertEquals(STARTER_PROMPT_COUNT, restored.size)
assertEquals(pool.first(), restored.first())
diff --git a/app/src/test/java/com/gotcha/ui/tour/TourControllerTest.kt b/app/src/test/java/com/gotcha/ui/tour/TourControllerTest.kt
index 45541f9..bf57927 100644
--- a/app/src/test/java/com/gotcha/ui/tour/TourControllerTest.kt
+++ b/app/src/test/java/com/gotcha/ui/tour/TourControllerTest.kt
@@ -1,6 +1,7 @@
package com.gotcha.ui.tour
import android.content.Context
+import com.gotcha.R
import com.gotcha.data.LlmProvider
import com.gotcha.data.Settings
import io.mockk.mockk
@@ -25,22 +26,22 @@ class TourControllerTest {
TourStep(
id = "first",
place = TourPlace.SETTINGS_HOME,
- title = "First",
- body = ""
+ title = R.string.tour_next,
+ body = R.string.tour_next
),
TourStep(
id = "second",
place = TourPlace.AI_CONFIG,
- title = "Second",
- body = "",
+ title = R.string.tour_next,
+ body = R.string.tour_next,
isDone = { settings, _ -> settings.isSamosaAuthenticated }
),
TourStep(
id = "third",
place = TourPlace.AI_CONFIG,
- title = "Third",
- body = "",
- ackLabel = "Got it"
+ title = R.string.tour_next,
+ body = R.string.tour_next,
+ ackLabel = R.string.tour_next
)
)
@@ -183,12 +184,12 @@ class TourControllerTest {
TourStep(
id = "optional_branch",
place = TourPlace.AI_CONFIG,
- title = "Sign in",
- body = "",
+ title = R.string.tour_next,
+ body = R.string.tour_next,
anchor = TourAnchor.AI_SAMOSA_SIGN_IN,
requiresAnchor = true
),
- TourStep(id = "after", place = TourPlace.AI_CONFIG, title = "After", body = "")
+ TourStep(id = "after", place = TourPlace.AI_CONFIG, title = R.string.tour_next, body = R.string.tour_next)
)
val controller = TourController(branching)
controller.start()
@@ -218,8 +219,8 @@ class TourControllerTest {
TourStep(
id = "tap_it_yourself",
place = TourPlace.SETTINGS_HOME,
- title = "Tap it",
- body = "",
+ title = R.string.tour_next,
+ body = R.string.tour_next,
autoNavigate = false
)
)