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): skills, Termux, about, legal, permissions and connectors in resources

Durganshu26ca45d6d85c
diff --git a/app/src/main/java/com/gotcha/MainActivity.kt b/app/src/main/java/com/gotcha/MainActivity.kt
index b959818..b0fc4d1 100644
--- a/app/src/main/java/com/gotcha/MainActivity.kt
+++ b/app/src/main/java/com/gotcha/MainActivity.kt
@@ -83,6 +83,7 @@ import com.gotcha.ui.SharePosterSheet
import com.gotcha.ui.SharePosterState
import com.gotcha.ui.rememberChatTransfer
import com.gotcha.ui.runtimePermissionAsk
+import com.gotcha.ui.stringLookup
import com.gotcha.ui.theme.GotchaTheme
import com.gotcha.ui.theme.SkinBackdrop
import com.gotcha.ui.theme.Skins
@@ -311,7 +312,7 @@ class MainActivity : ComponentActivity() {
if (granted) {
chatViewModel.startListening()
} else if (!shouldShowRequestPermissionRationale(android.Manifest.permission.RECORD_AUDIO)) {
- blockedPermissionAsk = runtimePermissionAsk(android.Manifest.permission.RECORD_AUDIO)
+ blockedPermissionAsk = runtimePermissionAsk(android.Manifest.permission.RECORD_AUDIO, [email protected]())
}
}
@@ -1230,7 +1231,7 @@ class MainActivity : ComponentActivity() {
// on the answer — including across a rotation, since the ask lives in
// the view model rather than here.
state.pendingPermission?.let { permission ->
- val ask = remember(permission) { runtimePermissionAsk(permission) }
+ val ask = remember(permission) { runtimePermissionAsk(permission, [email protected]()) }
PermissionRationaleDialog(
ask = ask,
onAllow = { requestRuntimePermission(ask) },
@@ -1239,7 +1240,13 @@ class MainActivity : ComponentActivity() {
}
if (state.askNotificationPermission) {
- val ask = remember { runtimePermissionAsk(android.Manifest.permission.POST_NOTIFICATIONS) }
+ val ask =
+ remember {
+ runtimePermissionAsk(
+ android.Manifest.permission.POST_NOTIFICATIONS,
+ )
+ }
PermissionRationaleDialog(
ask = ask,
onAllow = { notificationPermissionLauncher.launch(ask.permission) },
@@ -1248,7 +1255,13 @@ class MainActivity : ComponentActivity() {
}
if (askMicPermission) {
- val ask = remember { runtimePermissionAsk(android.Manifest.permission.RECORD_AUDIO) }
+ val ask =
+ remember {
+ runtimePermissionAsk(
+ android.Manifest.permission.RECORD_AUDIO,
+ )
+ }
PermissionRationaleDialog(
ask = ask,
onAllow = {
diff --git a/app/src/main/java/com/gotcha/ui/AboutScreen.kt b/app/src/main/java/com/gotcha/ui/AboutScreen.kt
index e29364c..ef5f559 100644
--- a/app/src/main/java/com/gotcha/ui/AboutScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/AboutScreen.kt
@@ -29,6 +29,7 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import com.gotcha.BuildConfig
+import com.gotcha.R
import com.gotcha.tools.CompanyInfoTool
import com.gotcha.updater.AppUpdateManager
import com.gotcha.updater.UpdateStatus
@@ -86,7 +87,7 @@ fun AboutSamosaScreen(
SettingsScaffold(title = stringResource(SettingsPage.ABOUT_SAMOSA.title), onBack = onBack, overlay = overlay) {
Text(
- text = renderLegalMarkdown(aboutText ?: "(loading…)"),
+ text = renderLegalMarkdown(aboutText ?: stringResource(R.string.loading)),
style = MaterialTheme.typography.bodyMedium
)
@@ -94,11 +95,11 @@ fun AboutSamosaScreen(
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
- text = "Open in your browser",
+ text = stringResource(R.string.about_open_in_your_browser),
style = MaterialTheme.typography.titleMedium
)
LINKS.forEach { (label, url) ->
- LinkRow(label = label, url = url, onOpen = uriHandler::openUri)
+ LinkRow(label = stringResource(label), url = url, onOpen = uriHandler::openUri)
}
}
}
@@ -124,14 +125,14 @@ private fun LinkRow(label: String, url: String, onOpen: (String) -> Unit) {
* links whenever the copy is reworded.
*/
private val LINKS = listOf(
- "Samosa AI website" to "https://samosa-ai.com",
- "About us" to "https://samosa-ai.com/about-us",
- "Gotcha" to "https://samosa-ai.com/gotcha",
- "Gotcha documentation" to "https://samosa-ai.com/gotcha/docs",
- "Pricing" to "https://samosa-ai.com/pricing",
- "Blog" to "https://blog.samosa-ai.com",
- "GitHub" to "https://github.com/samosa-ai-com/Gotcha",
+ R.string.about_link_website to "https://samosa-ai.com",
+ R.string.about_link_about_us to "https://samosa-ai.com/about-us",
+ R.string.about_link_gotcha to "https://samosa-ai.com/gotcha",
+ R.string.about_link_docs to "https://samosa-ai.com/gotcha/docs",
+ R.string.about_link_pricing to "https://samosa-ai.com/pricing",
+ R.string.about_link_blog to "https://blog.samosa-ai.com",
+ R.string.about_link_github to "https://github.com/samosa-ai-com/Gotcha",
+ R.string.about_link_email to "mailto:[email protected]"
)
@Composable
@@ -166,11 +167,11 @@ fun AppUpdateSection() {
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
- text = "App Version & Updates",
+ text = stringResource(R.string.about_app_version_updates),
style = MaterialTheme.typography.titleMedium
)
Text(
- text = "Gotcha v${BuildConfig.VERSION_NAME} (build ${BuildConfig.VERSION_CODE})",
+ text = stringResource(R.string.about_version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE),
style = MaterialTheme.typography.bodyMedium
)
@@ -188,18 +189,18 @@ fun AppUpdateSection() {
}
}
}) {
- Text("Check for Updates")
+ Text(stringResource(R.string.about_check_for_updates))
}
}
is UpdateStatus.Checking -> {
Text(
- text = "Checking for updates...",
+ text = stringResource(R.string.about_checking_for_updates),
style = MaterialTheme.typography.bodySmall
)
}
is UpdateStatus.UpToDate -> {
Text(
- text = "Gotcha is up to date (v${currentStatus.currentVersion}).",
+ text = stringResource(R.string.about_up_to_date, currentStatus.currentVersion),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.primary
)
@@ -207,7 +208,7 @@ fun AppUpdateSection() {
is UpdateStatus.Available -> {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
- text = "New update available: v${currentStatus.info.versionName}",
+ text = stringResource(R.string.about_update_available, currentStatus.info.versionName),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.primary
)
@@ -226,14 +227,14 @@ fun AppUpdateSection() {
res.onSuccess { apkFile ->
status = UpdateStatus.ReadyToInstall(apkFile)
}.onFailure { err ->
- status = UpdateStatus.Error(err.message ?: "Download failed")
+ status = UpdateStatus.Error(err.message ?: context.getString(R.string.about_download_failed))
}
} finally {
busy = false
}
}
}) {
- Text("Download Update")
+ Text(stringResource(R.string.about_download_update))
}
if (currentStatus.info.releaseNotes.isNotEmpty()) {
ReleaseNotes(currentStatus.info.releaseNotes)
@@ -242,7 +243,7 @@ fun AppUpdateSection() {
}
is UpdateStatus.Downloading -> {
Text(
- text = "Downloading update: ${currentStatus.progressPercent}%",
+ text = stringResource(R.string.about_downloading, currentStatus.progressPercent),
style = MaterialTheme.typography.bodySmall
)
}
@@ -250,32 +251,32 @@ fun AppUpdateSection() {
Button(onClick = {
if (!updateManager.installUpdate(context, currentStatus.apkFile)) {
status = if (updateManager.canInstall(context)) {
- UpdateStatus.Error("Could not launch the installer.")
+ UpdateStatus.Error(context.getString(R.string.about_installer_failed))
} else {
UpdateStatus.NeedsInstallPermission(currentStatus.apkFile)
}
}
}) {
- Text("Install Update")
+ Text(stringResource(R.string.about_install_update))
}
}
is UpdateStatus.NeedsInstallPermission -> {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
- text = "Allow Gotcha to install updates from this source, then return here.",
+ text = stringResource(R.string.about_allow_gotcha_to_install_updates),
style = MaterialTheme.typography.bodySmall
)
Button(onClick = {
updateManager.openInstallPermissionSettings(context)
}) {
- Text("Grant Install Permission")
+ Text(stringResource(R.string.about_grant_install_permission))
}
}
}
is UpdateStatus.Error -> {
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
- text = "Error: ${currentStatus.message}",
+ text = stringResource(R.string.about_update_error, currentStatus.message),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.error
)
@@ -291,7 +292,7 @@ fun AppUpdateSection() {
}
}
}) {
- Text("Retry Check")
+ Text(stringResource(R.string.about_retry_check))
}
}
}
diff --git a/app/src/main/java/com/gotcha/ui/ConnectorCards.kt b/app/src/main/java/com/gotcha/ui/ConnectorCards.kt
index 8d703f6..3cd62dc 100644
--- a/app/src/main/java/com/gotcha/ui/ConnectorCards.kt
+++ b/app/src/main/java/com/gotcha/ui/ConnectorCards.kt
@@ -29,12 +29,15 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
+import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.unit.dp
+import com.gotcha.R
import com.gotcha.connectors.oauth.OAuthConnectFlow
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
@@ -89,15 +92,19 @@ private fun ConnectorHeader(
Text(status, style = MaterialTheme.typography.bodySmall)
}
if (showSwitch) {
+ val enableDescription = stringResource(R.string.connector_cards_enable, title)
Switch(
checked = enabled,
onCheckedChange = onEnabledChange,
- modifier = Modifier.semantics { contentDescription = "Enable $title" }
+ modifier = Modifier.semantics { contentDescription = enableDescription }
)
}
Icon(
imageVector = Icons.Filled.KeyboardArrowDown,
- contentDescription = if (expanded) "Collapse $title" else "Expand $title",
+ contentDescription = stringResource(
+ if (expanded) R.string.connector_cards_collapse else R.string.connector_cards_expand,
+ title
+ ),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.graphicsLayer { rotationZ = rotation }
)
@@ -125,13 +132,15 @@ private fun EnabledRow(
modifier = Modifier.fillMaxWidth()
) {
Column(modifier = Modifier.weight(1f)) {
- Text("Enabled", style = MaterialTheme.typography.bodyMedium)
+ Text(stringResource(R.string.connector_cards_enabled), style = MaterialTheme.typography.bodyMedium)
Text(
- if (enabled) {
- "The assistant can use this connector's tools."
- } else {
- "Switched off — tools hidden, sign-in kept."
- },
+ stringResource(
+ if (enabled) {
+ R.string.connector_cards_the_assistant_can_use_this
+ } else {
+ R.string.connector_cards_switched_off_tools_hidden_sign
+ }
+ ),
style = MaterialTheme.typography.bodySmall
)
}
@@ -143,8 +152,9 @@ private fun EnabledRow(
* The status line a collapsed card shows for a connector that has no saved
* credentials yet — the "tap to set up" affordance hint.
*/
+@Composable
private fun disconnectedHint(status: String): String =
- if (status == "Not connected") "Not connected — tap to set up" else status
+ if (status == "Not connected") stringResource(R.string.connector_cards_not_connected_hint) else status
/**
* Shared "Refresh tools" / "Refresh connection" button for a connected connector
@@ -198,6 +208,7 @@ fun TokenConnectorCard(
headerTestTag: String = "connector_header_$title"
) {
val scope = rememberCoroutineScope()
+ val context = LocalContext.current
// Bumped after connect/disconnect so statusLine() is re-read.
var refreshTick by remember { mutableStateOf(0) }
var busy by remember { mutableStateOf(false) }
@@ -258,15 +269,21 @@ fun TokenConnectorCard(
},
enabled = !busy && canConnect(),
modifier = Modifier.fillMaxWidth()
- ) { Text(if (busy) "Connecting…" else "Connect") }
+ ) {
+ Text(
+ stringResource(
+ if (busy) R.string.connector_cards_connecting else R.string.connector_cards_connect
+ )
+ )
+ }
} else {
if (onEnabledChange != null) EnabledRow(enabled, onEnabledChange, showSwitch = false)
if (onRefresh != null) {
ConnectorRefreshButton(
busy = busy,
setBusy = { busy = it },
- idleLabel = "Refresh tools",
- busyLabel = "Refreshing tools…",
+ idleLabel = stringResource(R.string.connector_cards_refresh_tools),
+ busyLabel = stringResource(R.string.connector_cards_refreshing_tools),
scope = scope,
onRefresh = onRefresh,
onResult = {
@@ -279,11 +296,11 @@ fun TokenConnectorCard(
onClick = {
onDisconnect()
fields.filter { it.secret }.forEach { it.value = "" }
- status = "Disconnected."
+ status = context.getString(R.string.connector_cards_disconnected)
refreshTick++
},
modifier = Modifier.fillMaxWidth()
- ) { Text("Disconnect") }
+ ) { Text(stringResource(R.string.connector_cards_disconnect)) }
}
}
}
@@ -314,6 +331,7 @@ fun OAuthConnectorCard(
headerTestTag: String = "connector_header_$title"
) {
val scope = rememberCoroutineScope()
+ val context = LocalContext.current
var refreshTick by remember { mutableStateOf(0) }
var clientId by remember { mutableStateOf(initialClientId) }
var clientSecret by remember { mutableStateOf(initialClientSecret.orEmpty()) }
@@ -326,7 +344,7 @@ fun OAuthConnectorCard(
fun apply(outcome: OAuthConnectFlow.Outcome) {
status = when (outcome) {
- is OAuthConnectFlow.Outcome.Connected -> "Connected as ${outcome.account}."
+ is OAuthConnectFlow.Outcome.Connected -> context.getString(R.string.connector_cards_connected_as, outcome.account)
is OAuthConnectFlow.Outcome.Failed -> outcome.message
}
busy = false
@@ -363,7 +381,7 @@ fun OAuthConnectorCard(
OutlinedTextField(
value = clientId,
onValueChange = { clientId = it },
- label = { Text("Client ID") },
+ label = { Text(stringResource(R.string.connector_cards_client_id)) },
singleLine = true,
modifier = Modifier.fillMaxWidth()
)
@@ -371,7 +389,7 @@ fun OAuthConnectorCard(
OutlinedTextField(
value = clientSecret,
onValueChange = { clientSecret = it },
- label = { Text("Client secret") },
+ label = { Text(stringResource(R.string.connector_cards_client_secret)) },
singleLine = true,
visualTransformation = PasswordVisualTransformation(),
modifier = Modifier.fillMaxWidth()
@@ -381,29 +399,37 @@ fun OAuthConnectorCard(
Button(
onClick = {
busy = true
- status = "Opening sign-in…"
+ status = context.getString(R.string.connector_cards_opening_sign_in)
scope.launch {
apply(flow.connect(clientId, clientSecret.takeIf { usesSecret }))
}
},
enabled = !busy && clientId.isNotBlank() && (!usesSecret || clientSecret.isNotBlank()),
modifier = Modifier.fillMaxWidth()
- ) { Text(if (busy) "Waiting for sign-in…" else "Connect") }
+ ) {
+ Text(
+ stringResource(
+ if (busy) R.string.connector_cards_waiting_for_sign_in else R.string.connector_cards_connect
+ )
+ )
+ }
TextButton(onClick = { showPasteFallback = !showPasteFallback }) {
Text(
- if (showPasteFallback) {
- "Hide paste-URL fallback"
- } else {
- "Browser didn't return? Paste redirect URL"
- }
+ stringResource(
+ if (showPasteFallback) {
+ R.string.connector_cards_hide_paste_url_fallback
+ } else {
+ R.string.connector_cards_browser_didn_t_return_paste
+ }
+ )
)
}
if (showPasteFallback) {
OutlinedTextField(
value = pastedUrl,
onValueChange = { pastedUrl = it },
- label = { Text("Pasted redirect URL") },
+ label = { Text(stringResource(R.string.connector_cards_pasted_redirect_url)) },
singleLine = true,
modifier = Modifier.fillMaxWidth()
)
@@ -422,7 +448,7 @@ fun OAuthConnectorCard(
},
enabled = !busy && pastedUrl.isNotBlank(),
modifier = Modifier.fillMaxWidth()
- ) { Text("Finish sign-in with pasted URL") }
+ ) { Text(stringResource(R.string.connector_cards_finish_sign_in_with_pasted)) }
}
} else {
if (onEnabledChange != null) EnabledRow(enabled, onEnabledChange, showSwitch = false)
@@ -430,8 +456,8 @@ fun OAuthConnectorCard(
ConnectorRefreshButton(
busy = busy,
setBusy = { busy = it },
- idleLabel = "Refresh connection",
- busyLabel = "Refreshing…",
+ idleLabel = stringResource(R.string.connector_cards_refresh_connection),
+ busyLabel = stringResource(R.string.connector_cards_refreshing),
scope = scope,
onRefresh = onRefresh,
onResult = {
@@ -444,11 +470,11 @@ fun OAuthConnectorCard(
onClick = {
onDisconnect()
clientSecret = ""
- status = "Disconnected."
+ status = context.getString(R.string.connector_cards_disconnected)
refreshTick++
},
modifier = Modifier.fillMaxWidth()
- ) { Text("Disconnect") }
+ ) { Text(stringResource(R.string.connector_cards_disconnect)) }
}
}
}
diff --git a/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt b/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt
index 49bc0c2..a08dbbf 100644
--- a/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt
+++ b/app/src/main/java/com/gotcha/ui/ConnectorsSection.kt
@@ -23,9 +23,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.pluralStringResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
+import com.gotcha.R
import com.gotcha.connectors.ConnectorRefreshScheduler
import com.gotcha.connectors.ConnectorRegistry
import com.gotcha.connectors.google.GoogleConnector
@@ -174,6 +177,7 @@ private fun AutoRefreshHeader(
onRefreshAll: suspend () -> Map<String, String>
) {
val scope = rememberCoroutineScope()
+ val context = LocalContext.current
var isRefreshing by remember { mutableStateOf(false) }
var syncFeedback by remember { mutableStateOf("") }
var tick by remember { mutableStateOf(0) }
@@ -199,7 +203,11 @@ private fun AutoRefreshHeader(
verticalAlignment = Alignment.CenterVertically
) {
Column(modifier = Modifier.weight(1f)) {
- Text("Auto Tool Sync", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.Medium)
+ Text(
+ stringResource(R.string.connectors_auto_tool_sync),
+ style = MaterialTheme.typography.titleMedium,
+ fontWeight = FontWeight.Medium
+ )
// Accessing `tick` forces recomposition when time passes
val minutesAgo = if (lastRefreshedAt > 0 && tick >= 0) {
((System.currentTimeMillis() - lastRefreshedAt) / 60_000L).coerceAtLeast(0)
@@ -208,10 +216,14 @@ private fun AutoRefreshHeader(
}
Text(
- if (minutesAgo != null) {
- if (minutesAgo == 0L) "Last sync: Just now" else "Last sync: $minutesAgo min ago"
- } else {
- "Last sync: Never"
+ when (minutesAgo) {
+ null -> stringResource(R.string.connectors_last_sync_never)
+ 0L -> stringResource(R.string.connectors_last_sync_just_now)
+ else -> pluralStringResource(
+ R.plurals.connectors_last_sync_minutes,
+ minutesAgo.toInt(),
+ minutesAgo
+ )
},
style = MaterialTheme.typography.bodySmall
)
@@ -225,16 +237,21 @@ private fun AutoRefreshHeader(
val results = onRefreshAll()
isRefreshing = false
syncFeedback = if (results.isEmpty()) {
- "All active connectors are up to date."
+ context.getString(R.string.connectors_all_up_to_date)
} else {
- "Refreshed ${results.size} connector(s): ${results.keys.joinToString(", ")}"
+ context.resources.getQuantityString(
+ R.plurals.connectors_refreshed,
+ results.size,
+ results.size,
+ results.keys.joinToString(", ")
+ )
}
}
}
},
enabled = !isRefreshing
) {
- Text(if (isRefreshing) "Syncing…" else "Refresh All")
+ Text(stringResource(if (isRefreshing) R.string.connectors_syncing else R.string.connectors_refresh_all))
}
}
@@ -252,9 +269,11 @@ private fun AutoRefreshHeader(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
- Text("Interval", style = MaterialTheme.typography.bodyMedium)
+ Text(stringResource(R.string.connectors_interval), style = MaterialTheme.typography.bodyMedium)
Text(
- AUTO_REFRESH_INTERVALS[sliderIndex].second,
+ AUTO_REFRESH_INTERVALS[sliderIndex].let { (minutes, label) ->
+ if (minutes == 0) stringResource(R.string.connectors_interval_off) else label
+ },
style = MaterialTheme.typography.bodyMedium,
fontWeight = FontWeight.Bold
)
@@ -292,29 +311,24 @@ private fun HomeAssistantCard(
) {
val saved = homeAssistant.credentials()
val url = rememberTokenField(
- "Home Assistant URL",
+ stringResource(R.string.connectors_home_assistant_url),
saved?.baseUrl ?: "",
keyboard = KeyboardType.Uri
)
- val token = rememberTokenField("Long-lived access token", "", secret = true)
+ val token = rememberTokenField(stringResource(R.string.connectors_long_lived_access_token), "", secret = true)
TokenConnectorCard(
- title = "Home Assistant",
+ title = stringResource(R.string.connectors_home_assistant),
statusLine = homeAssistant::statusLine,
isConnected = homeAssistant::isConnected,
fields = listOf(url, token),
headerTestTag = "connector_header_homeassistant",
- blurb = "Control and query your smart home through Home Assistant's Model Context " +
- "Protocol server. Its tools are defined by your server and scoped to the entities " +
- "you expose to Assist.",
+ blurb = stringResource(R.string.connectors_control_and_query_your_smart),
steps = listOf(
- "1. In Home Assistant, add the \"Model Context Protocol Server\" integration " +
- "(Settings ▸ Devices & services ▸ Add integration).",
- "2. Create a long-lived access token: your profile ▸ Security ▸ Long-lived " +
- "access tokens ▸ Create token.",
- "3. Paste your Home Assistant URL (e.g. http://192.168.1.10:8123) and the token below.",
- "4. Expose the devices you want the assistant to control: Settings ▸ Voice " +
- "assistants ▸ Expose entities."
+ stringResource(R.string.connectors_1_in_home_assistant_add),
+ stringResource(R.string.connectors_2_create_a_long_lived),
+ stringResource(R.string.connectors_3_paste_your_home_assistant),
+ stringResource(R.string.connectors_4_expose_the_devices_you)
),
onConnect = { homeAssistant.connect(url.value, token.value) },
onDisconnect = homeAssistant::disconnect,
@@ -330,22 +344,20 @@ private fun NotionCard(
enabled: Boolean,
onEnabledChange: (Boolean) -> Unit
) {
- val token = rememberTokenField("Internal integration token", "", secret = true)
+ val token = rememberTokenField(stringResource(R.string.connectors_internal_integration_token), "", secret = true)
TokenConnectorCard(
- title = "Notion",
+ title = stringResource(R.string.connectors_notion),
statusLine = notion::statusLine,
isConnected = notion::isConnected,
fields = listOf(token),
headerTestTag = "connector_header_notion",
- blurb = "Search, read and write Notion pages using an internal integration in your own " +
- "workspace — no OAuth app to register.",
+ blurb = stringResource(R.string.connectors_search_read_and_write_notion),
steps = listOf(
- "1. Go to notion.so/my-integrations ▸ New integration, in your workspace.",
- "2. Give it Read, Insert and Update content capabilities.",
- "3. Copy the Internal Integration Secret and paste it below.",
- "4. Important: open each page you want reachable and use ⋯ ▸ Connections ▸ " +
- "add the integration. Pages that are not shared stay invisible to it."
+ stringResource(R.string.connectors_1_go_to_notion_so),
+ stringResource(R.string.connectors_2_give_it_read_insert),
+ stringResource(R.string.connectors_3_copy_the_internal_integration),
+ stringResource(R.string.connectors_4_important_open_each_page)
),
onConnect = { notion.connect(token.value) },
onDisconnect = notion::disconnect,
@@ -362,26 +374,42 @@ private fun ImapCard(
onEnabledChange: (Boolean) -> Unit
) {
val saved = imap.credentials()
- val email = rememberTokenField("Email address", saved?.email ?: "", keyboard = KeyboardType.Email)
- val appPassword = rememberTokenField("App password", "", secret = true)
- val imapHost = rememberTokenField("IMAP host", saved?.imapHost ?: "imap.gmail.com")
- val imapPort = rememberTokenField("IMAP port", (saved?.imapPort ?: 993).toString(), keyboard = KeyboardType.Number)
- val smtpHost = rememberTokenField("SMTP host", saved?.smtpHost ?: "smtp.gmail.com")
- val smtpPort = rememberTokenField("SMTP port", (saved?.smtpPort ?: 465).toString(), keyboard = KeyboardType.Number)
+ val context = LocalContext.current
+ val email =
+ rememberTokenField(
+ stringResource(R.string.connectors_email_address),
+ saved?.email ?: "",
+ keyboard = KeyboardType.Email
+ )
+ val appPassword = rememberTokenField(stringResource(R.string.connectors_app_password), "", secret = true)
+ val imapHost =
+ rememberTokenField(stringResource(R.string.connectors_imap_host), saved?.imapHost ?: "imap.gmail.com")
+ val imapPort =
+ rememberTokenField(
+ stringResource(R.string.connectors_imap_port),
+ (saved?.imapPort ?: 993).toString(),
+ keyboard = KeyboardType.Number
+ )
+ val smtpHost =
+ rememberTokenField(stringResource(R.string.connectors_smtp_host), saved?.smtpHost ?: "smtp.gmail.com")
+ val smtpPort =
+ rememberTokenField(
+ stringResource(R.string.connectors_smtp_port),
+ (saved?.smtpPort ?: 465).toString(),
+ keyboard = KeyboardType.Number
+ )
val fields = listOf(email, appPassword, imapHost, imapPort, smtpHost, smtpPort)
TokenConnectorCard(
- title = "Email (IMAP)",
+ title = stringResource(R.string.connectors_email_imap),
statusLine = imap::statusLine,
isConnected = imap::isConnected,
fields = fields,
headerTestTag = "connector_header_imap",
steps = listOf(
- "Needs an app password, not your regular password. Requires " +
- "2-Step Verification to be enabled first.",
- "Generate one at myaccount.google.com/apppasswords, or via " +
- "Google Account ▸ Security ▸ 2-Step Verification ▸ App passwords.",
- "Other providers: check their IMAP app-password documentation."
+ stringResource(R.string.connectors_needs_an_app_password_not),
+ stringResource(R.string.connectors_generate_one_at_myaccount_google),
+ stringResource(R.string.connectors_other_providers_check_their_imap)
),
belowFields = {
TextButton(onClick = {
@@ -389,7 +417,7 @@ private fun ImapCard(
imapPort.value = "993"
smtpHost.value = "smtp.gmail.com"
smtpPort.value = "465"
- }) { Text("Use Gmail preset") }
+ }) { Text(stringResource(R.string.connectors_use_gmail_preset)) }
},
onConnect = {
imap.connect(
@@ -402,7 +430,7 @@ private fun ImapCard(
smtpPort = smtpPort.value.toIntOrNull() ?: 465
)
)
- "Saved. Credentials are verified on first use."
+ context.getString(R.string.connectors_imap_saved)
},
onDisconnect = imap::disconnect,
onRefresh = imap::refreshTools,
@@ -442,7 +470,7 @@ private fun GoogleCard(
}
OAuthConnectorCard(
- title = "Google (Gmail, Calendar)",
+ title = stringResource(R.string.connectors_google_gmail_calendar),
statusLine = google::statusLine,
isConnected = google::isConnected,
needsReconnect = google::needsReconnect,
@@ -454,29 +482,26 @@ private fun GoogleCard(
onRefresh = google::refreshTools,
enabled = enabled,
onEnabledChange = onEnabledChange,
- blurb = "Full read/write Gmail and Google Calendar access using your own Google Cloud " +
- "OAuth client — no shared app, no verification wait.",
+ blurb = stringResource(R.string.connectors_full_read_write_gmail_and),
steps = listOf(
- "1. Create a Google Cloud project.",
- "2. Enable the Gmail API and/or the Google Calendar API — whichever you tick below.",
- "3. Configure the OAuth consent screen (External, add yourself as a " +
- "test user — or publish it to skip weekly reconnects).",
- "4. Create a Desktop app OAuth client.",
- "5. Paste its Client ID and secret below.",
- "6. Tap Connect."
+ stringResource(R.string.connectors_1_create_a_google_cloud),
+ stringResource(R.string.connectors_2_enable_the_gmail_api),
+ stringResource(R.string.connectors_3_configure_the_oauth_consent),
+ stringResource(R.string.connectors_4_create_a_desktop_app),
+ stringResource(R.string.connectors_5_paste_its_client_id),
+ stringResource(R.string.connectors_6_tap_connect)
),
extraFields = {
- Text("Services to authorise:", style = MaterialTheme.typography.bodySmall)
+ Text(stringResource(R.string.connectors_services_to_authorise), style = MaterialTheme.typography.bodySmall)
Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(checked = wantGmail, onCheckedChange = { wantGmail = it })
- Text("Gmail", style = MaterialTheme.typography.bodyMedium)
+ Text(stringResource(R.string.connectors_gmail), style = MaterialTheme.typography.bodyMedium)
Spacer(Modifier.width(16.dp))
Checkbox(checked = wantCalendar, onCheckedChange = { wantCalendar = it })
- Text("Calendar", style = MaterialTheme.typography.bodyMedium)
+ Text(stringResource(R.string.connectors_calendar), style = MaterialTheme.typography.bodyMedium)
}
Text(
- "Changing this needs a reconnect — the saved sign-in only carries the scopes " +
- "granted at consent time.",
+ stringResource(R.string.connectors_changing_this_needs_a_reconnect),
style = MaterialTheme.typography.bodySmall
)
}
@@ -504,7 +529,7 @@ private fun MicrosoftCard(
}
OAuthConnectorCard(
- title = "Microsoft (Outlook, Calendar, To Do)",
+ title = stringResource(R.string.connectors_microsoft_outlook_calendar_to_do),
statusLine = microsoft::statusLine,
isConnected = microsoft::isConnected,
needsReconnect = microsoft::needsReconnect,
@@ -517,22 +542,19 @@ private fun MicrosoftCard(
onRefresh = microsoft::refreshTools,
enabled = enabled,
onEnabledChange = onEnabledChange,
- blurb = "Outlook mail, calendar and To Do using your own Entra app registration. " +
- "One sign-in covers all three.",
+ blurb = stringResource(R.string.connectors_outlook_mail_calendar_and_to),
steps = listOf(
- "1. Go to portal.azure.com ▸ Microsoft Entra ID ▸ App registrations ▸ New.",
- "2. Under \"Redirect URI\" pick \"Public client/native\" and enter http://localhost.",
- "3. In API permissions add delegated Microsoft Graph permissions: " +
- "offline_access, User.Read, Mail.ReadWrite, Mail.Send, Calendars.ReadWrite, " +
- "Tasks.ReadWrite.",
- "4. Copy the Application (client) ID from the Overview page.",
- "5. Paste it below and tap Connect. Leave Tenant as \"common\" for personal accounts."
+ stringResource(R.string.connectors_1_go_to_portal_azure),
+ stringResource(R.string.connectors_2_under_redirect_uri_pick),
+ stringResource(R.string.connectors_3_in_api_permissions_add),
+ stringResource(R.string.connectors_4_copy_the_application_client),
+ stringResource(R.string.connectors_5_paste_it_below_and)
),
extraFields = {
OutlinedTextField(
value = tenant,
onValueChange = { tenant = it },
- label = { Text("Tenant (common, or your organisation's tenant ID)") },
+ label = { Text(stringResource(R.string.connectors_tenant_common_or_your_organisation)) },
singleLine = true,
modifier = Modifier.fillMaxWidth()
)
diff --git a/app/src/main/java/com/gotcha/ui/LegalScreen.kt b/app/src/main/java/com/gotcha/ui/LegalScreen.kt
index 41ceee1..bf60685 100644
--- a/app/src/main/java/com/gotcha/ui/LegalScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/LegalScreen.kt
@@ -28,6 +28,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
+import com.gotcha.R
import com.gotcha.data.LEGAL_VERSION
import com.gotcha.data.Settings
@@ -63,22 +64,23 @@ fun LegalScreen(
SettingsScaffold(title = stringResource(SettingsPage.LEGAL.title), onBack = onBack, overlay = overlay) {
Text(
- "By using Gotcha you accept these documents.",
+ stringResource(R.string.legal_by_using_gotcha_you_accept),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
- LegalSection(label = "Terms and Conditions", markdown = termsText)
- LegalSection(label = "Disclaimer and Declaration", markdown = disclaimerText)
- LegalSection(label = "Data Retention and Privacy Policy", markdown = privacyText)
+ LegalSection(label = stringResource(R.string.legal_consent_section_terms), markdown = termsText)
+ LegalSection(label = stringResource(R.string.legal_consent_section_disclaimer), markdown = disclaimerText)
+ LegalSection(label = stringResource(R.string.legal_consent_section_privacy), markdown = privacyText)
HorizontalDivider(thickness = 1.dp)
+ val accepted = stringResource(R.string.legal_accepted_toast)
AcceptBlock(
acceptedVersion = initial.legalAcceptedVersion,
onAccept = {
onSave { it.copy(legalAcceptedVersion = LEGAL_VERSION) }
- overlay.show("Accepted. You won't see this gate again until the legal copy changes.")
+ overlay.show(accepted)
}
)
}
@@ -97,7 +99,7 @@ private fun LegalSection(label: String, markdown: String?) {
.fillMaxWidth()
.padding(vertical = 4.dp)
) {
- val body = markdown ?: "(loading…)"
+ val body = markdown ?: stringResource(R.string.loading)
Text(text = renderLegalMarkdown(body), style = MaterialTheme.typography.bodyMedium)
}
}
@@ -111,8 +113,7 @@ private fun ColumnScope.AcceptBlock(
val currentVersion = LEGAL_VERSION
if (acceptedVersion == currentVersion) {
Text(
- text = "You've accepted version $currentVersion. You'll be asked again " +
- "only if the legal copy changes.",
+ text = stringResource(R.string.legal_accepted_current, currentVersion),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Start
@@ -124,14 +125,12 @@ private fun ColumnScope.AcceptBlock(
modifier = Modifier
.fillMaxWidth()
.testTag("settings_legal_accept_button")
- ) { Text("I agree") }
+ ) { Text(stringResource(R.string.legal_consent_agree)) }
Text(
text = if (acceptedVersion.isBlank()) {
- "You haven't accepted yet. The first-launch dialog will keep showing " +
- "until you tap I agree."
+ stringResource(R.string.legal_not_accepted, stringResource(R.string.legal_consent_agree))
} else {
- "You accepted an earlier version ($acceptedVersion). The current " +
- "version is $currentVersion."
+ stringResource(R.string.legal_accepted_earlier, acceptedVersion, currentVersion)
},
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
diff --git a/app/src/main/java/com/gotcha/ui/PermissionAsk.kt b/app/src/main/java/com/gotcha/ui/PermissionAsk.kt
index 2e6bb56..92d52ee 100644
--- a/app/src/main/java/com/gotcha/ui/PermissionAsk.kt
+++ b/app/src/main/java/com/gotcha/ui/PermissionAsk.kt
@@ -6,6 +6,8 @@ import android.net.Uri
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
+import androidx.compose.ui.res.stringResource
+import com.gotcha.R
import com.gotcha.ui.theme.SkinAlertDialog
import android.provider.Settings as AndroidSettings
@@ -33,47 +35,39 @@ data class PermissionAsk(
* that reports one this table has never heard of still gets a usable sentence
* from the Settings catalog — see [runtimePermissionAsk].
*/
-private val RUNTIME_RATIONALES: Map<String, String> = mapOf(
+private val RUNTIME_RATIONALES: Map<String, Int> = mapOf(
android.Manifest.permission.CALL_PHONE to
- "Gotcha needs the Phone permission to dial the number you asked it to call. " +
- "It only places calls you ask for, and the dialer stays on screen while it does.",
+ R.string.permission_rationale_call_phone,
android.Manifest.permission.SEND_SMS to
- "Gotcha needs the SMS permission to send the message you asked for. " +
- "Nothing is sent that you haven't asked it to send.",
+ R.string.permission_rationale_send_sms,
android.Manifest.permission.READ_SMS to
- "Gotcha needs to read your inbox to answer this — for example to find a code " +
- "or a message someone sent you. Messages stay on the device unless you " +
- "ask Gotcha to do something with them.",
+ R.string.permission_rationale_read_sms,
android.Manifest.permission.READ_CALL_LOG to
- "Gotcha needs your call history to answer questions about who called and when.",
+ R.string.permission_rationale_read_call_log,
android.Manifest.permission.READ_CONTACTS to
- "Gotcha needs your contacts to turn a name into a number — so \"call Priya\" " +
- "reaches the right Priya.",
+ R.string.permission_rationale_read_contacts,
android.Manifest.permission.WRITE_CONTACTS to
- "Gotcha needs permission to save this contact to your address book.",
+ R.string.permission_rationale_write_contacts,
android.Manifest.permission.READ_CALENDAR to
- "Gotcha needs your calendar to see what's on your schedule.",
+ R.string.permission_rationale_read_calendar,
android.Manifest.permission.WRITE_CALENDAR to
- "Gotcha needs calendar access to create or change the event you asked for.",
+ R.string.permission_rationale_write_calendar,
android.Manifest.permission.CAMERA to
- "Gotcha needs the camera to take the photo you asked for.",
+ R.string.permission_rationale_camera,
android.Manifest.permission.RECORD_AUDIO to
- "Gotcha needs the microphone to hear you — for voice input, recording, and " +
- "the \"Hey Gotcha\" wake word.",
+ R.string.permission_rationale_record_audio,
android.Manifest.permission.ACCESS_FINE_LOCATION to
- "Gotcha needs your location to answer this — weather, what's nearby, or where " +
- "you are right now.",
+ R.string.permission_rationale_access_fine_location,
android.Manifest.permission.ACCESS_COARSE_LOCATION to
- "Gotcha needs an approximate location to answer this.",
+ R.string.permission_rationale_access_coarse_location,
android.Manifest.permission.READ_MEDIA_IMAGES to
- "Gotcha needs access to your photos to open the image you pointed it at.",
+ R.string.permission_rationale_read_media_images,
android.Manifest.permission.READ_EXTERNAL_STORAGE to
- "Gotcha needs storage access to open the file you pointed it at.",
+ R.string.permission_rationale_read_external_storage,
android.Manifest.permission.POST_NOTIFICATIONS to
- "Gotcha needs notification permission to alert you when a reply or a message arrives.",
+ R.string.permission_rationale_post_notifications,
android.Manifest.permission.READ_PHONE_STATE to
- "On a dual-SIM phone, Gotcha needs to read the phone state to pick which SIM " +
- "places the call or sends the message."
+ R.string.permission_rationale_read_phone_state
)
/**
@@ -84,16 +78,18 @@ private val RUNTIME_RATIONALES: Map<String, String> = mapOf(
* sentence for still produces a dialog that names something recognisable rather
* than a bare `android.permission.*` string.
*/
-fun runtimePermissionAsk(permission: String): PermissionAsk {
+fun runtimePermissionAsk(permission: String, text: StringLookup): PermissionAsk {
val item = allPermissionGroups()
.flatMap { it.items }
.firstOrNull { it.androidPermission == permission || permission in it.extraPermissions }
return PermissionAsk(
permission = permission,
- title = item?.name ?: shortPermissionName(permission),
- rationale = RUNTIME_RATIONALES[permission]
- ?: item?.description?.let { "Gotcha needs this permission to ${it.replaceFirstChar(Char::lowercase)}." }
- ?: "Gotcha needs the ${shortPermissionName(permission)} permission to do what you asked."
+ title = item?.name?.let { text(it) } ?: shortPermissionName(permission),
+ rationale = RUNTIME_RATIONALES[permission]?.let { text(it) }
+ ?: item?.description?.let {
+ text(R.string.permission_rationale_from_description, text(it).replaceFirstChar(Char::lowercase))
+ }
+ ?: text(R.string.permission_rationale_generic, shortPermissionName(permission))
)
}
@@ -117,13 +113,13 @@ fun PermissionRationaleDialog(
) {
SkinAlertDialog(
onDismissRequest = onDeny,
- title = { Text("${ask.title} permission needed") },
+ title = { Text(stringResource(R.string.permission_ask_needed, ask.title)) },
text = { Text(ask.rationale) },
confirmButton = {
- TextButton(onClick = onAllow) { Text("Continue") }
+ TextButton(onClick = onAllow) { Text(stringResource(R.string.permission_ask_continue)) }
},
dismissButton = {
- TextButton(onClick = onDeny) { Text("Not now") }
+ TextButton(onClick = onDeny) { Text(stringResource(R.string.permission_ask_not_now)) }
}
)
}
@@ -142,12 +138,10 @@ fun PermissionBlockedDialog(
val context = androidx.compose.ui.platform.LocalContext.current
SkinAlertDialog(
onDismissRequest = onDismiss,
- title = { Text("${ask.title} is turned off") },
+ title = { Text(stringResource(R.string.permission_ask_turned_off, ask.title)) },
text = {
Text(
- "Android won't ask again once a permission has been turned off. " +
- "You can switch it back on in Settings › Apps › Gotcha › Permissions, " +
- "then ask Gotcha again."
+ stringResource(R.string.permission_ask_android_won_t_ask_again)
)
},
confirmButton = {
@@ -156,10 +150,10 @@ fun PermissionBlockedDialog(
onDismiss()
openAppPermissionSettings(context, packageName)
}
- ) { Text("Open app settings") }
+ ) { Text(stringResource(R.string.permission_ask_open_app_settings)) }
},
dismissButton = {
- TextButton(onClick = onDismiss) { Text("Not now") }
+ TextButton(onClick = onDismiss) { Text(stringResource(R.string.permission_ask_not_now)) }
}
)
}
diff --git a/app/src/main/java/com/gotcha/ui/PermissionItems.kt b/app/src/main/java/com/gotcha/ui/PermissionItems.kt
index 015839e..5d0a59e 100644
--- a/app/src/main/java/com/gotcha/ui/PermissionItems.kt
+++ b/app/src/main/java/com/gotcha/ui/PermissionItems.kt
@@ -7,19 +7,21 @@ import android.content.Context
import android.os.Build
import android.os.Environment
import android.provider.Settings
+import androidx.annotation.StringRes
import androidx.core.content.ContextCompat
+import com.gotcha.R
import com.gotcha.service.GotchaDeviceAdminReceiver
import com.gotcha.tools.HealthPermissionState
import com.gotcha.tools.ToolResult
data class PermissionGroup(
- val name: String,
+ @StringRes val name: Int,
val items: List<PermissionItem>
)
data class PermissionItem(
- val name: String,
- val description: String,
+ @StringRes val name: Int,
+ @StringRes val description: Int,
val androidPermission: String?,
val specialMarker: String?,
val isGranted: (Context) -> Boolean,
@@ -39,32 +41,32 @@ data class PermissionItem(
@Suppress("LongMethod")
fun allPermissionGroups(): List<PermissionGroup> = listOf(
PermissionGroup(
- "Communications",
+ R.string.permission_group_communications,
listOf(
PermissionItem(
- "Phone",
- "Place calls directly",
+ R.string.permission_phone,
+ R.string.permission_phone_description,
android.Manifest.permission.CALL_PHONE,
null,
{ c -> checkPerm(c, android.Manifest.permission.CALL_PHONE) }
),
PermissionItem(
- "SMS",
- "Send text messages",
+ R.string.permission_sms,
+ R.string.permission_sms_description,
android.Manifest.permission.SEND_SMS,
null,
{ c -> checkPerm(c, android.Manifest.permission.SEND_SMS) }
),
PermissionItem(
- "Read SMS",
- "Read inbox messages",
+ R.string.permission_read_sms,
+ R.string.permission_read_sms_description,
android.Manifest.permission.READ_SMS,
null,
{ c -> checkPerm(c, android.Manifest.permission.READ_SMS) }
),
PermissionItem(
- "Call Log",
- "Read recent call history",
+ R.string.permission_call_log,
+ R.string.permission_call_log_description,
android.Manifest.permission.READ_CALL_LOG,
null,
{ c -> checkPerm(c, android.Manifest.permission.READ_CALL_LOG) }
@@ -72,11 +74,11 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "Contacts",
+ R.string.permission_group_contacts,
listOf(
PermissionItem(
- "Contacts",
- "Read and create contacts",
+ R.string.permission_contacts,
+ R.string.permission_contacts_description,
android.Manifest.permission.READ_CONTACTS,
null,
{ c ->
@@ -88,11 +90,11 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "Calendar",
+ R.string.permission_group_calendar,
listOf(
PermissionItem(
- "Calendar",
- "Read and create calendar events",
+ R.string.permission_calendar,
+ R.string.permission_calendar_description,
android.Manifest.permission.READ_CALENDAR,
null,
{ c ->
@@ -104,25 +106,25 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "Media & Storage",
+ R.string.permission_group_media_storage,
listOf(
PermissionItem(
- "Camera",
- "Take photos",
+ R.string.permission_camera,
+ R.string.permission_camera_description,
android.Manifest.permission.CAMERA,
null,
{ c -> checkPerm(c, android.Manifest.permission.CAMERA) }
),
PermissionItem(
- "Microphone",
- "Record audio",
+ R.string.permission_microphone,
+ R.string.permission_microphone_description,
android.Manifest.permission.RECORD_AUDIO,
null,
{ c -> checkPerm(c, android.Manifest.permission.RECORD_AUDIO) }
),
PermissionItem(
- "Storage Read",
- "Read files from shared storage",
+ R.string.permission_storage_read,
+ R.string.permission_storage_read_description,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
android.Manifest.permission.READ_MEDIA_IMAGES
} else {
@@ -139,16 +141,16 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
}
),
PermissionItem(
- "Storage Write",
- "Write files to shared storage",
+ R.string.permission_storage_write,
+ R.string.permission_storage_write_description,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
null,
// API 30+ uses MANAGE_EXTERNAL_STORAGE instead; nothing to request here.
{ true }
),
PermissionItem(
- "All Files Access",
- "Full access to all files on device",
+ R.string.permission_all_files_access,
+ R.string.permission_all_files_access_description,
null,
"special:all_files_access",
{ Environment.isExternalStorageManager() }
@@ -156,11 +158,11 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "Location",
+ R.string.permission_group_location,
listOf(
PermissionItem(
- "Location",
- "Get device location",
+ R.string.permission_location,
+ R.string.permission_location_description,
android.Manifest.permission.ACCESS_FINE_LOCATION,
null,
{ c -> checkPerm(c, android.Manifest.permission.ACCESS_FINE_LOCATION) }
@@ -168,18 +170,18 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "Device Control",
+ R.string.permission_group_device_control,
listOf(
PermissionItem(
- "Write Settings",
- "Modify system settings (brightness)",
+ R.string.permission_write_settings,
+ R.string.permission_write_settings_description,
null,
"special:write_settings",
{ c -> Settings.System.canWrite(c) }
),
PermissionItem(
- "Do Not Disturb",
- "Silence/vibrate mode and DND",
+ R.string.permission_do_not_disturb,
+ R.string.permission_do_not_disturb_description,
null,
"special:dnd_access",
{ c ->
@@ -188,8 +190,8 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
}
),
PermissionItem(
- "Usage Access",
- "Read app usage and data stats",
+ R.string.permission_usage_access,
+ R.string.permission_usage_access_description,
null,
"special:usage_access",
{ c ->
@@ -205,18 +207,16 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
// isRelevant. The allow-external-apps half has to be done inside Termux either way;
// the Guided setup link (PermissionsScreen → PermissionsSection) walks through it.
PermissionItem(
- "Termux Commands (Optional)",
- "Run shell commands and install packages in Termux. Also needs " +
- "`allow-external-apps=true` in Termux's ~/.termux/termux.properties — use the " +
- "Guided setup link for step-by-step help.",
+ R.string.permission_termux_commands_optional,
+ R.string.permission_termux_commands_optional_description,
com.gotcha.tools.TermuxTool.PERMISSION_RUN_COMMAND,
null,
{ c -> checkPerm(c, com.gotcha.tools.TermuxTool.PERMISSION_RUN_COMMAND) },
isRelevant = { c -> com.gotcha.tools.DeviceCapabilities.termuxUsable(c) }
),
PermissionItem(
- "Device Admin (Optional)",
- "DANGEROUS: Lock screen, enforce password policy. Only enable if you really need these.",
+ R.string.permission_device_admin_optional,
+ R.string.permission_device_admin_optional_description,
null,
"special:device_admin",
{ c ->
@@ -227,11 +227,11 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "Notifications",
+ R.string.permission_group_notifications,
listOf(
PermissionItem(
- "Show Notifications",
- "Display server messages and reply alerts in the status bar",
+ R.string.permission_show_notifications,
+ R.string.permission_show_notifications_description,
android.Manifest.permission.POST_NOTIFICATIONS,
null,
// Below Android 13 (API 33) the permission is granted at install
@@ -244,18 +244,18 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "System Access",
+ R.string.permission_group_system_access,
listOf(
PermissionItem(
- "Accessibility",
- "Read screen, tap, swipe, type",
+ R.string.permission_accessibility,
+ R.string.permission_accessibility_description,
null,
"special:accessibility_access",
::isAccessibilityGranted
),
PermissionItem(
- "Notification Listener",
- "Read and dismiss notifications, media control",
+ R.string.permission_notification_listener,
+ R.string.permission_notification_listener_description,
null,
"special:notification_listener_access",
{ c ->
@@ -267,8 +267,8 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
}
),
PermissionItem(
- "Display Over Apps",
- "Show floating overlays",
+ R.string.permission_display_over_apps,
+ R.string.permission_display_over_apps_description,
null,
"special:overlay_access",
::isOverlayGranted
@@ -276,11 +276,11 @@ fun allPermissionGroups(): List<PermissionGroup> = listOf(
)
),
PermissionGroup(
- "Health",
+ R.string.permission_group_health,
listOf(
PermissionItem(
- "Health Connect",
- "Read steps, sleep, heart rate, weight and workouts",
+ R.string.permission_health_connect,
+ R.string.permission_health_connect_description,
null,
ToolResult.HEALTH_CONNECT,
// Health Connect only reports grants from a suspend call, so this
diff --git a/app/src/main/java/com/gotcha/ui/PermissionsSection.kt b/app/src/main/java/com/gotcha/ui/PermissionsSection.kt
index 141d3dc..ad1b3f0 100644
--- a/app/src/main/java/com/gotcha/ui/PermissionsSection.kt
+++ b/app/src/main/java/com/gotcha/ui/PermissionsSection.kt
@@ -30,10 +30,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
+import com.gotcha.R
import com.gotcha.service.GotchaDeviceAdminReceiver
import com.gotcha.tools.HealthPermissionState
import com.gotcha.tools.TermuxTool
@@ -50,7 +52,7 @@ fun PermissionsSection(
) {
val context = LocalContext.current
val groups = remember { allPermissionGroups() }
- var userToggledGroups by remember { mutableStateOf<Map<String, Boolean>>(emptyMap()) }
+ var userToggledGroups by remember { mutableStateOf<Map<Int, Boolean>>(emptyMap()) }
// Trigger recomposition on every activity resume so permission state is re-read from Android
val lifecycleOwner = LocalLifecycleOwner.current
@@ -78,10 +80,7 @@ fun PermissionsSection(
// No "Permissions" heading: PermissionsScreen's top bar already says it.
Text(
- "Nothing here is required up front — the assistant asks for a permission when it first " +
- "needs one, and says why. This page is for granting them ahead of time, seeing what " +
- "is on, and turning anything back off. Runtime permissions show a system dialog when " +
- "toggled on; special-access permissions open a Settings screen for one-time setup.",
+ stringResource(R.string.permissions_nothing_here_is_required_up),
style = MaterialTheme.typography.bodySmall
)
@@ -105,7 +104,7 @@ fun PermissionsSection(
style = MaterialTheme.typography.bodyMedium
)
Text(
- text = group.name,
+ text = stringResource(group.name),
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium
)
@@ -166,16 +165,18 @@ private fun PermissionRow(
verticalAlignment = Alignment.CenterVertically
) {
Column(modifier = Modifier.weight(1f)) {
- Text(item.name, style = MaterialTheme.typography.bodyMedium)
+ Text(stringResource(item.name), style = MaterialTheme.typography.bodyMedium)
Text(
- item.description,
+ stringResource(item.description),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
// The switch says granted or not; this says it in words, so a row
// read aloud by a screen reader still answers "is this on?".
Text(
- if (granted) "Granted" else "Not granted — asked for when first needed",
+ stringResource(
+ if (granted) R.string.permissions_granted else R.string.permissions_not_granted_asked_for_when
+ ),
style = MaterialTheme.typography.labelSmall,
color = if (granted) {
MaterialTheme.colorScheme.primary
@@ -189,7 +190,7 @@ private fun PermissionRow(
contentPadding = PaddingValues(0.dp)
) {
Text(
- "Guided setup ›",
+ stringResource(R.string.permissions_guided_setup),
style = MaterialTheme.typography.bodySmall
)
}
@@ -226,18 +227,17 @@ private fun PermissionRow(
if (showRevokeDialog) {
SkinAlertDialog(
onDismissRequest = { showRevokeDialog = false },
- title = { Text("Turn off ${item.name}?") },
+ title = { Text(stringResource(R.string.permissions_revoke_title, stringResource(item.name))) },
text = {
Text(
- if (item.specialMarker != null) {
- "${item.name} is switched on in the system's own settings screen, and " +
- "only that screen can switch it back off. Gotcha stops using it the " +
- "moment you do."
- } else {
- "Only Android can take a permission back. Open Gotcha's app settings, " +
- "go to Permissions, and deny ${item.name} there — anything that " +
- "needs it will ask again next time."
- }
+ stringResource(
+ if (item.specialMarker != null) {
+ R.string.permissions_revoke_special
+ } else {
+ R.string.permissions_revoke_runtime
+ },
+ stringResource(item.name)
+ )
)
},
confirmButton = {
@@ -250,10 +250,20 @@ private fun PermissionRow(
openAppPermissionSettings(context, packageName)
}
}
- ) { Text(if (item.specialMarker != null) "Open settings screen" else "Open app settings") }
+ ) {
+ Text(
+ stringResource(
+ if (item.specialMarker != null) {
+ R.string.permissions_open_settings_screen
+ } else {
+ R.string.permissions_open_app_settings
+ }
+ )
+ )
+ }
},
dismissButton = {
- TextButton(onClick = { showRevokeDialog = false }) { Text("Cancel") }
+ TextButton(onClick = { showRevokeDialog = false }) { Text(stringResource(R.string.permissions_cancel)) }
}
)
}
@@ -261,12 +271,10 @@ private fun PermissionRow(
if (showHealthConnectDialog) {
SkinAlertDialog(
onDismissRequest = { showHealthConnectDialog = false },
- title = { Text("Health Connect permission needed") },
+ title = { Text(stringResource(R.string.permissions_health_connect_permission_needed)) },
text = {
Text(
- "Gotcha can't read your health data yet. Open Health Connect, " +
- "find Gotcha under App permissions, and allow the data types " +
- "you're comfortable sharing, then return here."
+ stringResource(R.string.permissions_gotcha_can_t_read_your)
)
},
confirmButton = {
@@ -275,10 +283,12 @@ private fun PermissionRow(
showHealthConnectDialog = false
openSpecialAccess(context, ToolResult.HEALTH_CONNECT, packageName)
}
- ) { Text("Open Health Connect") }
+ ) { Text(stringResource(R.string.permissions_open_health_connect)) }
},
dismissButton = {
- TextButton(onClick = { showHealthConnectDialog = false }) { Text("Not now") }
+ TextButton(
+ onClick = { showHealthConnectDialog = false }
+ ) { Text(stringResource(R.string.permissions_not_now)) }
}
)
}
@@ -318,8 +328,7 @@ internal fun openSpecialAccess(
ComponentName(context, GotchaDeviceAdminReceiver::class.java)
).putExtra(
DevicePolicyManager.EXTRA_ADD_EXPLANATION,
- "Gotcha uses device administration to lock the screen, enforce " +
- "password policy, and disable the camera when you ask it to."
+ context.getString(R.string.permissions_device_admin_explanation)
)
ToolResult.VPN_CONSENT -> VpnService.prepare(context)?.let {
Intent(Intent.ACTION_MAIN).apply {
diff --git a/app/src/main/java/com/gotcha/ui/SkillsScreen.kt b/app/src/main/java/com/gotcha/ui/SkillsScreen.kt
index de98e26..fefbf08 100644
--- a/app/src/main/java/com/gotcha/ui/SkillsScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/SkillsScreen.kt
@@ -36,6 +36,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import com.gotcha.BuildConfig
+import com.gotcha.R
import com.gotcha.agent.skills.Skill
import com.gotcha.agent.skills.SkillRegistry
import com.gotcha.data.Settings
@@ -95,7 +96,7 @@ fun SkillsScreen(
SettingsScaffold(title = stringResource(SettingsPage.SKILLS.title), onBack = onBack, overlay = overlay) {
val allSkills = SkillRegistry.getAllSkills()
if (allSkills.isEmpty()) {
- Text("No skills loaded.", style = MaterialTheme.typography.bodyMedium)
+ Text(stringResource(R.string.skills_no_skills_loaded), style = MaterialTheme.typography.bodyMedium)
} else {
allSkills.forEach { skill ->
Row(
@@ -132,21 +133,19 @@ fun SkillsScreen(
// ---- Community Skills ----
Text(
- "Community Skills",
+ stringResource(R.string.skills_community_skills),
style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.Bold
)
Text(
- "Import skills from ${BuildConfig.SAMOSA_SKILL_HOST} or paste JSON. " +
- "Community skills appear in the agent's system prompt " +
- "as advisory guidance.",
+ stringResource(R.string.skills_community_description, BuildConfig.SAMOSA_SKILL_HOST),
style = MaterialTheme.typography.bodySmall
)
OutlinedTextField(
value = communitySkillUrl,
onValueChange = { communitySkillUrl = it.trim() },
- label = { Text("Skill URL (https://${BuildConfig.SAMOSA_SKILL_HOST}/...)") },
+ label = { Text(stringResource(R.string.skills_url_label, BuildConfig.SAMOSA_SKILL_HOST)) },
singleLine = true,
modifier = Modifier.fillMaxWidth()
)
@@ -155,11 +154,11 @@ fun SkillsScreen(
if (communityImportBusy) return@Button
val url = communitySkillUrl.trim()
if (url.isEmpty()) {
- overlay.show("Enter a URL first.")
+ overlay.show(localContext.getString(R.string.skills_enter_a_url_first))
return@Button
}
communityImportBusy = true
- overlay.show("Fetching skill…", sticky = true)
+ overlay.show(localContext.getString(R.string.skills_fetching_skill), sticky = true)
scope.launch {
val result = runCatching {
val hosts = communitySkillHosts
@@ -169,7 +168,7 @@ fun SkillsScreen(
result.onSuccess { skill ->
communitySkillUrl = ""
communitySkillRefreshTick++
- overlay.show("Imported '${skill.id}'.")
+ overlay.show(localContext.getString(R.string.skills_imported, skill.id))
}.onFailure { e ->
overlay.show(formatImportError(e, localContext.stringLookup()))
}
@@ -177,13 +176,13 @@ fun SkillsScreen(
},
enabled = !communityImportBusy,
modifier = Modifier.fillMaxWidth()
- ) { Text("Import from URL") }
+ ) { Text(stringResource(R.string.skills_import_from_url)) }
var pasteOpen by remember { mutableStateOf(false) }
OutlinedButton(
onClick = { pasteOpen = true },
modifier = Modifier.fillMaxWidth()
- ) { Text("Paste JSON…") }
+ ) { Text(stringResource(R.string.skills_paste_json)) }
if (pasteOpen) {
androidx.compose.ui.window.Dialog(onDismissRequest = {
pasteOpen = false
@@ -195,13 +194,13 @@ fun SkillsScreen(
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
- "Paste community skill JSON",
+ stringResource(R.string.skills_paste_community_skill_json),
style = MaterialTheme.typography.titleMedium
)
OutlinedTextField(
value = communitySkillPasteJson,
onValueChange = { communitySkillPasteJson = it },
- label = { Text("Skill JSON") },
+ label = { Text(stringResource(R.string.skills_skill_json)) },
modifier = Modifier.fillMaxWidth().height(220.dp),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text)
)
@@ -212,16 +211,16 @@ fun SkillsScreen(
TextButton(onClick = {
pasteOpen = false
communitySkillPasteJson = ""
- }) { Text("Cancel") }
+ }) { Text(stringResource(R.string.skills_cancel)) }
TextButton(onClick = {
val src = communitySkillPasteJson.trim()
if (src.isEmpty()) {
- overlay.show("Paste JSON first.")
+ overlay.show(localContext.getString(R.string.skills_paste_json_first))
return@TextButton
}
communityImportBusy = true
pasteOpen = false
- overlay.show("Importing skill…", sticky = true)
+ overlay.show(localContext.getString(R.string.skills_importing_skill), sticky = true)
scope.launch {
val result = runCatching {
SkillRegistry.importCommunity(src)
@@ -230,14 +229,12 @@ fun SkillsScreen(
communitySkillPasteJson = ""
result.onSuccess { skill ->
communitySkillRefreshTick++
- overlay.show(
- "Imported '${skill.id}'."
- )
+ overlay.show(localContext.getString(R.string.skills_imported, skill.id))
}.onFailure { e ->
overlay.show(formatImportError(e, localContext.stringLookup()))
}
}
- }) { Text("Import") }
+ }) { Text(stringResource(R.string.skills_import)) }
}
}
}
@@ -250,7 +247,7 @@ fun SkillsScreen(
}
if (communitySkills.isEmpty()) {
Text(
- "No community skills imported yet.",
+ stringResource(R.string.skills_no_community_skills_imported_yet),
style = MaterialTheme.typography.bodySmall
)
} else {
@@ -268,7 +265,7 @@ fun SkillsScreen(
fontWeight = FontWeight.Bold
)
Text(
- "id: ${skill.id}",
+ stringResource(R.string.skills_id, skill.id),
style = MaterialTheme.typography.bodySmall
)
if (skill.description.isNotBlank()) {
@@ -294,7 +291,7 @@ fun SkillsScreen(
) {
Icon(
Icons.Outlined.Delete,
- contentDescription = "Delete ${skill.id}",
+ contentDescription = stringResource(R.string.skills_delete_description, skill.id),
tint = MaterialTheme.colorScheme.error
)
}
@@ -307,13 +304,10 @@ fun SkillsScreen(
communitySkillToDelete?.let { pending ->
SkinAlertDialog(
onDismissRequest = { communitySkillToDelete = null },
- title = { Text("Delete community skill?") },
+ title = { Text(stringResource(R.string.skills_delete_community_skill)) },
text = {
Text(
- "Are you sure you want to permanently delete " +
- "\"${pending.id}\"? The skill will be removed from " +
- "this device and the agent will no longer have " +
- "access to it. This action cannot be undone."
+ stringResource(R.string.skills_delete_confirm, pending.id)
)
},
confirmButton = {
@@ -326,17 +320,17 @@ fun SkillsScreen(
disabledSkills = disabledSkills - id
onSave { applySkills(it) }
communitySkillRefreshTick++
- overlay.show("Deleted '$id'.")
+ overlay.show(localContext.getString(R.string.skills_deleted, id))
}
},
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.error
)
- ) { Text("Delete") }
+ ) { Text(stringResource(R.string.skills_delete)) }
},
dismissButton = {
TextButton(onClick = { communitySkillToDelete = null }) {
- Text("Cancel")
+ Text(stringResource(R.string.skills_cancel))
}
}
)
@@ -346,13 +340,12 @@ fun SkillsScreen(
// ---- Host allowlist ----
Text(
- "Allowed community skill hosts",
+ stringResource(R.string.skills_allowed_community_skill_hosts),
style = MaterialTheme.typography.titleSmall,
fontWeight = FontWeight.Bold
)
Text(
- "Only HTTPS hosts in this list can be fetched. " +
- "Default: ${BuildConfig.SAMOSA_SKILL_HOST}.",
+ stringResource(R.string.skills_hosts_description, BuildConfig.SAMOSA_SKILL_HOST),
style = MaterialTheme.typography.bodySmall
)
communitySkillHosts.forEach { host ->
@@ -364,7 +357,7 @@ fun SkillsScreen(
Text(host, modifier = Modifier.weight(1f))
if (host.equals(pinnedHost, ignoreCase = true)) {
Text(
- "Built-in",
+ stringResource(R.string.skills_built_in),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@@ -372,7 +365,7 @@ fun SkillsScreen(
TextButton(onClick = {
communitySkillHosts = communitySkillHosts - host
onSave { applySkills(it) }
- }) { Text("Remove") }
+ }) { Text(stringResource(R.string.skills_remove)) }
}
}
}
@@ -385,7 +378,7 @@ fun SkillsScreen(
OutlinedTextField(
value = newHost,
onValueChange = { newHost = it.trim() },
- label = { Text("Add host") },
+ label = { Text(stringResource(R.string.skills_add_host)) },
singleLine = true,
modifier = Modifier.weight(1f)
)
@@ -397,7 +390,7 @@ fun SkillsScreen(
onSave { applySkills(it) }
newHost = ""
}
- ) { Text("Add") }
+ ) { Text(stringResource(R.string.skills_add)) }
}
}
}
diff --git a/app/src/main/java/com/gotcha/ui/TermuxSetupScreen.kt b/app/src/main/java/com/gotcha/ui/TermuxSetupScreen.kt
index 6a3c21e..7617414 100644
--- a/app/src/main/java/com/gotcha/ui/TermuxSetupScreen.kt
+++ b/app/src/main/java/com/gotcha/ui/TermuxSetupScreen.kt
@@ -31,10 +31,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
+import com.gotcha.R
import com.gotcha.tools.TermuxTool
import com.gotcha.tools.ToolResult
import com.gotcha.ui.theme.GotchaMono
@@ -78,12 +80,13 @@ fun TermuxSetupScreen(onBack: () -> Unit) {
) { granted ->
state = TermuxTool.TermuxSetupState.from(tool.status())
overlay.show(
- if (granted) {
- "Permission granted — next, enable external apps in Termux."
- } else {
- "Permission denied. If no dialog appeared, Termux was installed after Gotcha — " +
- "update or reinstall Gotcha so Android can grant it."
- }
+ context.getString(
+ if (granted) {
+ R.string.termux_setup_permission_granted_next_enable_external
+ } else {
+ R.string.termux_setup_permission_denied_if_no_dialog
+ }
+ )
)
}
@@ -93,76 +96,78 @@ fun TermuxSetupScreen(onBack: () -> Unit) {
scope.launch {
val probe = tool.probeExternalApps()
state = state.copy(externalAppsEnabled = probe)
- probeFeedback = when (probe) {
- TermuxTool.TermuxConfigProbe.CONFIGURED ->
- "Termux answered — allow-external-apps is enabled."
- TermuxTool.TermuxConfigProbe.NOT_CONFIGURED ->
- "Termux answered, but allow-external-apps is not enabled yet."
- TermuxTool.TermuxConfigProbe.UNKNOWN ->
- "Could not confirm. Open Termux once, set the property, then check again."
- }
+ probeFeedback = context.getString(
+ when (probe) {
+ TermuxTool.TermuxConfigProbe.CONFIGURED ->
+ R.string.termux_setup_termux_answered_allow_external_apps
+ TermuxTool.TermuxConfigProbe.NOT_CONFIGURED ->
+ R.string.termux_setup_termux_answered_but_allow_external
+ TermuxTool.TermuxConfigProbe.UNKNOWN ->
+ R.string.termux_setup_could_not_confirm_open_termux
+ }
+ )
probing = false
}
}
- SettingsScaffold(title = "Termux (Linux shell)", onBack = onBack, overlay = overlay) {
+ SettingsScaffold(title = stringResource(SettingsPage.TERMUX.title), onBack = onBack, overlay = overlay) {
Text(
- "Termux gives the assistant a full Linux shell — installing packages, running " +
- "scripts and tools no phone ships with. This page walks you through the one-time " +
- "setup so you don't have to look anything up.",
+ stringResource(R.string.termux_setup_termux_gives_the_assistant_a),
style = MaterialTheme.typography.bodySmall
)
SetupCheck(
- title = "Install Termux",
+ title = stringResource(R.string.termux_setup_install_termux),
done = state.installed,
detail = if (state.installed) {
- "Termux ${state.versionName.orEmpty().trim()} is installed."
+ stringResource(R.string.termux_setup_installed_version, state.versionName.orEmpty().trim())
} else {
- "Termux is not installed."
+ stringResource(R.string.termux_setup_not_installed)
},
action = if (state.installed) {
null
} else {
- SetupAction("Install Termux from F-Droid") {
+ SetupAction(stringResource(R.string.termux_setup_action_install_termux_from_fdroid)) {
runCatching {
context.startActivity(
Intent(Intent.ACTION_VIEW, Uri.parse(TermuxTool.TERMUX_FDROID_URL))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
)
}.onFailure {
- overlay.show("Could not open the F-Droid page.")
+ overlay.show(context.getString(R.string.termux_setup_could_not_open_the_f))
}
}
}
)
SetupCheck(
- title = "Check the Termux build",
+ title = stringResource(R.string.termux_setup_check_the_termux_build),
done = state.pluginApiAvailable,
- detail = when {
- !state.installed -> "Install Termux first."
- state.pluginApiAvailable -> "This build exposes the Run Commands API Gotcha needs."
- else ->
- "This build has no Run Commands API — that is the Google Play build, which " +
- "removed it. Install the F-Droid or GitHub build instead."
- }
+ detail = stringResource(
+ when {
+ !state.installed -> R.string.termux_setup_install_termux_first
+ state.pluginApiAvailable -> R.string.termux_setup_this_build_exposes_the_run
+ else ->
+ R.string.termux_setup_this_build_has_no_run
+ }
+ )
)
SetupCheck(
- title = "Grant the Run Commands permission",
+ title = stringResource(R.string.termux_setup_grant_the_run_commands_permission),
done = state.permissionGranted,
- detail = when {
- !state.installed -> "Install Termux first."
- state.permissionGranted -> "Gotcha may run commands in Termux."
- else ->
- "Termux must let Gotcha run commands. If no permission dialog appears, " +
- "Termux was installed after Gotcha — update or reinstall Gotcha."
- },
+ detail = stringResource(
+ when {
+ !state.installed -> R.string.termux_setup_install_termux_first
+ state.permissionGranted -> R.string.termux_setup_gotcha_may_run_commands_in
+ else ->
+ R.string.termux_setup_termux_must_let_gotcha_run
+ }
+ ),
action = when {
state.permissionGranted -> null
state.installed && state.pluginApiAvailable ->
- SetupAction("Grant permission") {
+ SetupAction(stringResource(R.string.termux_setup_action_grant_permission)) {
permissionLauncher.launch(TermuxTool.PERMISSION_RUN_COMMAND)
}
else -> null
@@ -170,19 +175,21 @@ fun TermuxSetupScreen(onBack: () -> Unit) {
)
SetupCheck(
- title = "Allow external apps",
+ title = stringResource(R.string.termux_setup_allow_external_apps),
done = state.externalAppsEnabled == TermuxTool.TermuxConfigProbe.CONFIGURED,
- detail = when {
- !state.installed -> "Install Termux first."
- !state.pluginApiAvailable -> "This build cannot run commands — see step 2."
- state.externalAppsEnabled == TermuxTool.TermuxConfigProbe.CONFIGURED ->
- "allow-external-apps is enabled — Gotcha can reach Termux."
- state.externalAppsEnabled == TermuxTool.TermuxConfigProbe.NOT_CONFIGURED ->
- "allow-external-apps is not enabled. Open Termux and run the two lines below."
- else -> "Not confirmed yet. Open Termux, run the two lines below, then check again."
- },
+ detail = stringResource(
+ when {
+ !state.installed -> R.string.termux_setup_install_termux_first
+ !state.pluginApiAvailable -> R.string.termux_setup_this_build_cannot_run_commands
+ state.externalAppsEnabled == TermuxTool.TermuxConfigProbe.CONFIGURED ->
+ R.string.termux_setup_allow_external_apps_is_enabled
+ state.externalAppsEnabled == TermuxTool.TermuxConfigProbe.NOT_CONFIGURED ->
+ R.string.termux_setup_allow_external_apps_is_not
+ else -> R.string.termux_setup_not_confirmed_yet_open_termux
+ }
+ ),
action = if (state.installed) {
- SetupAction("Open Termux") {
+ SetupAction(stringResource(R.string.termux_setup_action_open_termux)) {
openSpecialAccess(context, ToolResult.TERMUX_ACCESS, context.packageName)
}
} else {
@@ -208,15 +215,21 @@ fun TermuxSetupScreen(onBack: () -> Unit) {
clipboard?.setPrimaryClip(
ClipData.newPlainText("Termux setup", TermuxTool.SETUP_COMMANDS)
)
- overlay.show("Copied to clipboard.")
+ overlay.show(context.getString(R.string.termux_setup_copied_to_clipboard))
},
modifier = Modifier.weight(1f)
- ) { Text("Copy commands") }
+ ) { Text(stringResource(R.string.termux_setup_copy_commands)) }
OutlinedButton(
onClick = { checkConfiguration() },
enabled = !probing,
modifier = Modifier.weight(1f)
- ) { Text(if (probing) "Checking…" else "Check configuration") }
+ ) {
+ Text(
+ stringResource(
+ if (probing) R.string.termux_setup_checking else R.string.termux_setup_check_configuration
+ )
+ )
+ }
}
}
@@ -231,7 +244,7 @@ fun TermuxSetupScreen(onBack: () -> Unit) {
modifier = Modifier.fillMaxWidth()
) {
Text(
- "Termux is set up. Try asking the assistant to run a command in Termux.",
+ stringResource(R.string.termux_setup_termux_is_set_up_try),
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.Medium,
modifier = Modifier.padding(12.dp)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ac8ef84..739bdd8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -404,4 +404,309 @@
<!-- Transcription language picker -->
<string name="speech_language_follow_voice">Follow voice language / auto-detect</string>
+
+ <!-- SkillsScreen -->
+ <string name="skills_no_skills_loaded">No skills loaded.</string>
+ <string name="skills_import_from_url">Import from URL</string>
+ <string name="skills_paste_json">Paste JSON…</string>
+ <string name="skills_skill_json">Skill JSON</string>
+ <string name="skills_cancel">Cancel</string>
+ <string name="skills_import">Import</string>
+ <string name="skills_delete_community_skill">Delete community skill?</string>
+ <string name="skills_delete">Delete</string>
+ <string name="skills_remove">Remove</string>
+ <string name="skills_add_host">Add host</string>
+ <string name="skills_add">Add</string>
+ <string name="skills_community_skills">Community Skills</string>
+ <string name="skills_paste_community_skill_json">Paste community skill JSON</string>
+ <string name="skills_no_community_skills_imported_yet">No community skills imported yet.</string>
+ <string name="skills_allowed_community_skill_hosts">Allowed community skill hosts</string>
+ <string name="skills_built_in">Built-in</string>
+ <string name="skills_enter_a_url_first">Enter a URL first.</string>
+ <string name="skills_fetching_skill">Fetching skill…</string>
+ <string name="skills_paste_json_first">Paste JSON first.</string>
+ <string name="skills_importing_skill">Importing skill…</string>
+
+ <!-- TermuxSetupScreen -->
+ <string name="termux_setup_copy_commands">Copy commands</string>
+ <string name="termux_setup_install_termux">Install Termux</string>
+ <string name="termux_setup_check_the_termux_build">Check the Termux build</string>
+ <string name="termux_setup_grant_the_run_commands_permission">Grant the Run Commands permission</string>
+ <string name="termux_setup_allow_external_apps">Allow external apps</string>
+ <string name="termux_setup_termux_gives_the_assistant_a">Termux gives the assistant a full Linux shell — installing packages, running scripts and tools no phone ships with. This page walks you through the one-time setup so you don\'t have to look anything up.</string>
+ <string name="termux_setup_termux_is_set_up_try">Termux is set up. Try asking the assistant to run a command in Termux.</string>
+ <string name="termux_setup_checking">Checking…</string>
+ <string name="termux_setup_check_configuration">Check configuration</string>
+ <string name="termux_setup_could_not_open_the_f">Could not open the F-Droid page.</string>
+ <string name="termux_setup_copied_to_clipboard">Copied to clipboard.</string>
+ <string name="termux_setup_permission_granted_next_enable_external">Permission granted — next, enable external apps in Termux.</string>
+ <string name="termux_setup_permission_denied_if_no_dialog">Permission denied. If no dialog appeared, Termux was installed after Gotcha — update or reinstall Gotcha so Android can grant it.</string>
+
+ <!-- AboutScreen -->
+ <string name="about_check_for_updates">Check for Updates</string>
+ <string name="about_download_update">Download Update</string>
+ <string name="about_install_update">Install Update</string>
+ <string name="about_grant_install_permission">Grant Install Permission</string>
+ <string name="about_retry_check">Retry Check</string>
+ <string name="about_open_in_your_browser">Open in your browser</string>
+ <string name="about_app_version_updates">App Version &amp; Updates</string>
+ <string name="about_checking_for_updates">Checking for updates...</string>
+ <string name="about_allow_gotcha_to_install_updates">Allow Gotcha to install updates from this source, then return here.</string>
+
+ <!-- LegalScreen -->
+ <string name="legal_by_using_gotcha_you_accept">By using Gotcha you accept these documents.</string>
+
+ <!-- PermissionsSection -->
+ <string name="permissions_cancel">Cancel</string>
+ <string name="permissions_health_connect_permission_needed">Health Connect permission needed</string>
+ <string name="permissions_open_health_connect">Open Health Connect</string>
+ <string name="permissions_not_now">Not now</string>
+ <string name="permissions_nothing_here_is_required_up">Nothing here is required up front — the assistant asks for a permission when it first needs one, and says why. This page is for granting them ahead of time, seeing what is on, and turning anything back off. Runtime permissions show a system dialog when toggled on; special-access permissions open a Settings screen for one-time setup.</string>
+ <string name="permissions_guided_setup">Guided setup ›</string>
+ <string name="permissions_gotcha_can_t_read_your">Gotcha can\'t read your health data yet. Open Health Connect, find Gotcha under App permissions, and allow the data types you\'re comfortable sharing, then return here.</string>
+ <string name="permissions_open_settings_screen">Open settings screen</string>
+ <string name="permissions_open_app_settings">Open app settings</string>
+ <string name="permissions_granted">Granted</string>
+ <string name="permissions_not_granted_asked_for_when">Not granted — asked for when first needed</string>
+
+ <!-- Termux setup -->
+ <string name="termux_setup_termux_answered_allow_external_apps">Termux answered — allow-external-apps is enabled.</string>
+ <string name="termux_setup_termux_answered_but_allow_external">Termux answered, but allow-external-apps is not enabled yet.</string>
+ <string name="termux_setup_could_not_confirm_open_termux">Could not confirm. Open Termux once, set the property, then check again.</string>
+ <string name="termux_setup_installed_version">Termux %1$s is installed.</string>
+ <string name="termux_setup_not_installed">Termux is not installed.</string>
+ <string name="termux_setup_install_termux_first">Install Termux first.</string>
+ <string name="termux_setup_this_build_exposes_the_run">This build exposes the Run Commands API Gotcha needs.</string>
+ <string name="termux_setup_this_build_has_no_run">This build has no Run Commands API — that is the Google Play build, which removed it. Install the F-Droid or GitHub build instead.</string>
+ <string name="termux_setup_gotcha_may_run_commands_in">Gotcha may run commands in Termux.</string>
+ <string name="termux_setup_termux_must_let_gotcha_run">Termux must let Gotcha run commands. If no permission dialog appears, Termux was installed after Gotcha — update or reinstall Gotcha.</string>
+ <string name="termux_setup_this_build_cannot_run_commands">This build cannot run commands — see step 2.</string>
+ <string name="termux_setup_allow_external_apps_is_enabled">allow-external-apps is enabled — Gotcha can reach Termux.</string>
+ <string name="termux_setup_allow_external_apps_is_not">allow-external-apps is not enabled. Open Termux and run the two lines below.</string>
+ <string name="termux_setup_not_confirmed_yet_open_termux">Not confirmed yet. Open Termux, run the two lines below, then check again.</string>
+ <string name="termux_setup_action_install_termux_from_fdroid">Install Termux from F-Droid</string>
+ <string name="termux_setup_action_grant_permission">Grant permission</string>
+ <string name="termux_setup_action_open_termux">Open Termux</string>
+
+ <!-- Skills page -->
+ <string name="skills_community_description">Import skills from %1$s or paste JSON. Community skills appear in the agent\'s system prompt as advisory guidance.</string>
+ <string name="skills_url_label">Skill URL (https://%1$s/...)</string>
+ <string name="skills_imported">Imported \'%1$s\'.</string>
+ <string name="skills_id">id: %1$s</string>
+ <string name="skills_delete_description">Delete %1$s</string>
+ <string name="skills_delete_confirm">Are you sure you want to permanently delete \"%1$s\"? The skill will be removed from this device and the agent will no longer have access to it. This action cannot be undone.</string>
+ <string name="skills_deleted">Deleted \'%1$s\'.</string>
+ <string name="skills_hosts_description">Only HTTPS hosts in this list can be fetched. Default: %1$s.</string>
+
+ <!-- About page -->
+ <string name="loading">(loading…)</string>
+ <string name="about_link_website">Samosa AI website</string>
+ <string name="about_link_about_us">About us</string>
+ <string name="about_link_gotcha">Gotcha</string>
+ <string name="about_link_docs">Gotcha documentation</string>
+ <string name="about_link_pricing">Pricing</string>
+ <string name="about_link_blog">Blog</string>
+ <string name="about_link_github">GitHub</string>
+ <string name="about_link_email">Email [email protected]</string>
+ <string name="about_version">Gotcha v%1$s (build %2$d)</string>
+ <string name="about_up_to_date">Gotcha is up to date (v%1$s).</string>
+ <string name="about_update_available">New update available: v%1$s</string>
+ <string name="about_download_failed">Download failed</string>
+ <string name="about_downloading">Downloading update: %1$d%%</string>
+ <string name="about_installer_failed">Could not launch the installer.</string>
+ <string name="about_update_error">Error: %1$s</string>
+
+ <!-- Legal page -->
+ <string name="legal_accepted_toast">Accepted. You won\'t see this gate again until the legal copy changes.</string>
+ <string name="legal_accepted_current">You\'ve accepted version %1$s. You\'ll be asked again only if the legal copy changes.</string>
+ <string name="legal_not_accepted">You haven\'t accepted yet. The first-launch dialog will keep showing until you tap %1$s.</string>
+ <string name="legal_accepted_earlier">You accepted an earlier version (%1$s). The current version is %2$s.</string>
+
+ <!-- Permissions catalog -->
+ <string name="permission_group_communications">Communications</string>
+ <string name="permission_group_contacts">Contacts</string>
+ <string name="permission_group_calendar">Calendar</string>
+ <string name="permission_group_media_storage">Media &amp; Storage</string>
+ <string name="permission_group_location">Location</string>
+ <string name="permission_group_device_control">Device Control</string>
+ <string name="permission_group_notifications">Notifications</string>
+ <string name="permission_group_system_access">System Access</string>
+ <string name="permission_group_health">Health</string>
+ <string name="permission_phone">Phone</string>
+ <string name="permission_phone_description">Place calls directly</string>
+ <string name="permission_sms">SMS</string>
+ <string name="permission_sms_description">Send text messages</string>
+ <string name="permission_read_sms">Read SMS</string>
+ <string name="permission_read_sms_description">Read inbox messages</string>
+ <string name="permission_call_log">Call Log</string>
+ <string name="permission_call_log_description">Read recent call history</string>
+ <string name="permission_contacts">Contacts</string>
+ <string name="permission_contacts_description">Read and create contacts</string>
+ <string name="permission_calendar">Calendar</string>
+ <string name="permission_calendar_description">Read and create calendar events</string>
+ <string name="permission_camera">Camera</string>
+ <string name="permission_camera_description">Take photos</string>
+ <string name="permission_microphone">Microphone</string>
+ <string name="permission_microphone_description">Record audio</string>
+ <string name="permission_storage_read">Storage Read</string>
+ <string name="permission_storage_read_description">Read files from shared storage</string>
+ <string name="permission_storage_write">Storage Write</string>
+ <string name="permission_storage_write_description">Write files to shared storage</string>
+ <string name="permission_all_files_access">All Files Access</string>
+ <string name="permission_all_files_access_description">Full access to all files on device</string>
+ <string name="permission_location">Location</string>
+ <string name="permission_location_description">Get device location</string>
+ <string name="permission_write_settings">Write Settings</string>
+ <string name="permission_write_settings_description">Modify system settings (brightness)</string>
+ <string name="permission_do_not_disturb">Do Not Disturb</string>
+ <string name="permission_do_not_disturb_description">Silence/vibrate mode and DND</string>
+ <string name="permission_usage_access">Usage Access</string>
+ <string name="permission_usage_access_description">Read app usage and data stats</string>
+ <string name="permission_termux_commands_optional">Termux Commands (Optional)</string>
+ <string name="permission_termux_commands_optional_description">Run shell commands and install packages in Termux. Also needs `allow-external-apps=true` in Termux\'s ~/.termux/termux.properties — use the Guided setup link for step-by-step help.</string>
+ <string name="permission_device_admin_optional">Device Admin (Optional)</string>
+ <string name="permission_device_admin_optional_description">DANGEROUS: Lock screen, enforce password policy. Only enable if you really need these.</string>
+ <string name="permission_show_notifications">Show Notifications</string>
+ <string name="permission_show_notifications_description">Display server messages and reply alerts in the status bar</string>
+ <string name="permission_accessibility">Accessibility</string>
+ <string name="permission_accessibility_description">Read screen, tap, swipe, type</string>
+ <string name="permission_notification_listener">Notification Listener</string>
+ <string name="permission_notification_listener_description">Read and dismiss notifications, media control</string>
+ <string name="permission_display_over_apps">Display Over Apps</string>
+ <string name="permission_display_over_apps_description">Show floating overlays</string>
+ <string name="permission_health_connect">Health Connect</string>
+ <string name="permission_health_connect_description">Read steps, sleep, heart rate, weight and workouts</string>
+
+ <!-- Permission requests: why each one is asked for -->
+ <string name="permission_rationale_call_phone">Gotcha needs the Phone permission to dial the number you asked it to call. It only places calls you ask for, and the dialer stays on screen while it does.</string>
+ <string name="permission_rationale_send_sms">Gotcha needs the SMS permission to send the message you asked for. Nothing is sent that you haven\'t asked it to send.</string>
+ <string name="permission_rationale_read_sms">Gotcha needs to read your inbox to answer this — for example to find a code or a message someone sent you. Messages stay on the device unless you ask Gotcha to do something with them.</string>
+ <string name="permission_rationale_read_call_log">Gotcha needs your call history to answer questions about who called and when.</string>
+ <string name="permission_rationale_read_contacts">Gotcha needs your contacts to turn a name into a number — so \"call Priya\" reaches the right Priya.</string>
+ <string name="permission_rationale_write_contacts">Gotcha needs permission to save this contact to your address book.</string>
+ <string name="permission_rationale_read_calendar">Gotcha needs your calendar to see what\'s on your schedule.</string>
+ <string name="permission_rationale_write_calendar">Gotcha needs calendar access to create or change the event you asked for.</string>
+ <string name="permission_rationale_camera">Gotcha needs the camera to take the photo you asked for.</string>
+ <string name="permission_rationale_record_audio">Gotcha needs the microphone to hear you — for voice input, recording, and the \"Hey Gotcha\" wake word.</string>
+ <string name="permission_rationale_access_fine_location">Gotcha needs your location to answer this — weather, what\'s nearby, or where you are right now.</string>
+ <string name="permission_rationale_access_coarse_location">Gotcha needs an approximate location to answer this.</string>
+ <string name="permission_rationale_read_media_images">Gotcha needs access to your photos to open the image you pointed it at.</string>
+ <string name="permission_rationale_read_external_storage">Gotcha needs storage access to open the file you pointed it at.</string>
+ <string name="permission_rationale_post_notifications">Gotcha needs notification permission to alert you when a reply or a message arrives.</string>
+ <string name="permission_rationale_read_phone_state">On a dual-SIM phone, Gotcha needs to read the phone state to pick which SIM places the call or sends the message.</string>
+ <string name="permission_rationale_from_description">Gotcha needs this permission to %1$s.</string>
+ <string name="permission_rationale_generic">Gotcha needs the %1$s permission to do what you asked.</string>
+
+ <!-- PermissionAsk -->
+ <string name="permission_ask_continue">Continue</string>
+ <string name="permission_ask_not_now">Not now</string>
+ <string name="permission_ask_open_app_settings">Open app settings</string>
+ <string name="permission_ask_android_won_t_ask_again">Android won\'t ask again once a permission has been turned off. You can switch it back on in Settings › Apps › Gotcha › Permissions, then ask Gotcha again.</string>
+
+ <!-- Permission dialogs -->
+ <string name="permission_ask_needed">%1$s permission needed</string>
+ <string name="permission_ask_turned_off">%1$s is turned off</string>
+
+ <!-- Permissions page -->
+ <string name="permissions_revoke_title">Turn off %1$s?</string>
+ <string name="permissions_revoke_special">%1$s is switched on in the system\'s own settings screen, and only that screen can switch it back off. Gotcha stops using it the moment you do.</string>
+ <string name="permissions_revoke_runtime">Only Android can take a permission back. Open Gotcha\'s app settings, go to Permissions, and deny %1$s there — anything that needs it will ask again next time.</string>
+ <string name="permissions_device_admin_explanation">Gotcha uses device administration to lock the screen, enforce password policy, and disable the camera when you ask it to.</string>
+
+ <!-- ConnectorsSection -->
+ <string name="connectors_auto_tool_sync">Auto Tool Sync</string>
+ <string name="connectors_interval">Interval</string>
+ <string name="connectors_use_gmail_preset">Use Gmail preset</string>
+ <string name="connectors_services_to_authorise">Services to authorise:</string>
+ <string name="connectors_gmail">Gmail</string>
+ <string name="connectors_calendar">Calendar</string>
+ <string name="connectors_tenant_common_or_your_organisation">Tenant (common, or your organisation\'s tenant ID)</string>
+ <string name="connectors_home_assistant">Home Assistant</string>
+ <string name="connectors_notion">Notion</string>
+ <string name="connectors_email_imap">Email (IMAP)</string>
+ <string name="connectors_google_gmail_calendar">Google (Gmail, Calendar)</string>
+ <string name="connectors_microsoft_outlook_calendar_to_do">Microsoft (Outlook, Calendar, To Do)</string>
+ <string name="connectors_changing_this_needs_a_reconnect">Changing this needs a reconnect — the saved sign-in only carries the scopes granted at consent time.</string>
+ <string name="connectors_syncing">Syncing…</string>
+ <string name="connectors_refresh_all">Refresh All</string>
+ <string name="connectors_long_lived_access_token">Long-lived access token</string>
+ <string name="connectors_internal_integration_token">Internal integration token</string>
+ <string name="connectors_email_address">Email address</string>
+ <string name="connectors_app_password">App password</string>
+ <string name="connectors_imap_host">IMAP host</string>
+ <string name="connectors_imap_port">IMAP port</string>
+ <string name="connectors_smtp_host">SMTP host</string>
+ <string name="connectors_smtp_port">SMTP port</string>
+ <string name="connectors_home_assistant_url">Home Assistant URL</string>
+ <string name="connectors_control_and_query_your_smart">Control and query your smart home through Home Assistant\'s Model Context Protocol server. Its tools are defined by your server and scoped to the entities you expose to Assist.</string>
+ <string name="connectors_search_read_and_write_notion">Search, read and write Notion pages using an internal integration in your own workspace — no OAuth app to register.</string>
+ <string name="connectors_full_read_write_gmail_and">Full read/write Gmail and Google Calendar access using your own Google Cloud OAuth client — no shared app, no verification wait.</string>
+ <string name="connectors_outlook_mail_calendar_and_to">Outlook mail, calendar and To Do using your own Entra app registration. One sign-in covers all three.</string>
+ <string name="connectors_1_in_home_assistant_add">1. In Home Assistant, add the \"Model Context Protocol Server\" integration (Settings ▸ Devices &amp; services ▸ Add integration).</string>
+ <string name="connectors_2_create_a_long_lived">2. Create a long-lived access token: your profile ▸ Security ▸ Long-lived access tokens ▸ Create token.</string>
+ <string name="connectors_3_paste_your_home_assistant">3. Paste your Home Assistant URL (e.g. http://192.168.1.10:8123) and the token below.</string>
+ <string name="connectors_1_go_to_notion_so">1. Go to notion.so/my-integrations ▸ New integration, in your workspace.</string>
+ <string name="connectors_2_give_it_read_insert">2. Give it Read, Insert and Update content capabilities.</string>
+ <string name="connectors_3_copy_the_internal_integration">3. Copy the Internal Integration Secret and paste it below.</string>
+ <string name="connectors_needs_an_app_password_not">Needs an app password, not your regular password. Requires 2-Step Verification to be enabled first.</string>
+ <string name="connectors_generate_one_at_myaccount_google">Generate one at myaccount.google.com/apppasswords, or via Google Account ▸ Security ▸ 2-Step Verification ▸ App passwords.</string>
+ <string name="connectors_1_create_a_google_cloud">1. Create a Google Cloud project.</string>
+ <string name="connectors_2_enable_the_gmail_api">2. Enable the Gmail API and/or the Google Calendar API — whichever you tick below.</string>
+ <string name="connectors_3_configure_the_oauth_consent">3. Configure the OAuth consent screen (External, add yourself as a test user — or publish it to skip weekly reconnects).</string>
+ <string name="connectors_4_create_a_desktop_app">4. Create a Desktop app OAuth client.</string>
+ <string name="connectors_5_paste_its_client_id">5. Paste its Client ID and secret below.</string>
+ <string name="connectors_1_go_to_portal_azure">1. Go to portal.azure.com ▸ Microsoft Entra ID ▸ App registrations ▸ New.</string>
+ <string name="connectors_2_under_redirect_uri_pick">2. Under \"Redirect URI\" pick \"Public client/native\" and enter http://localhost.</string>
+ <string name="connectors_3_in_api_permissions_add">3. In API permissions add delegated Microsoft Graph permissions: offline_access, User.Read, Mail.ReadWrite, Mail.Send, Calendars.ReadWrite, Tasks.ReadWrite.</string>
+ <string name="connectors_4_copy_the_application_client">4. Copy the Application (client) ID from the Overview page.</string>
+
+ <!-- ConnectorCards -->
+ <string name="connector_cards_enabled">Enabled</string>
+ <string name="connector_cards_disconnect">Disconnect</string>
+ <string name="connector_cards_client_id">Client ID</string>
+ <string name="connector_cards_client_secret">Client secret</string>
+ <string name="connector_cards_pasted_redirect_url">Pasted redirect URL</string>
+ <string name="connector_cards_finish_sign_in_with_pasted">Finish sign-in with pasted URL</string>
+ <string name="connector_cards_connecting">Connecting…</string>
+ <string name="connector_cards_connect">Connect</string>
+ <string name="connector_cards_waiting_for_sign_in">Waiting for sign-in…</string>
+ <string name="connector_cards_disconnected">Disconnected.</string>
+ <string name="connector_cards_opening_sign_in">Opening sign-in…</string>
+ <string name="connector_cards_refresh_tools">Refresh tools</string>
+ <string name="connector_cards_refresh_connection">Refresh connection</string>
+ <string name="connector_cards_refreshing_tools">Refreshing tools…</string>
+ <string name="connector_cards_refreshing">Refreshing…</string>
+ <string name="connector_cards_the_assistant_can_use_this">The assistant can use this connector\'s tools.</string>
+ <string name="connector_cards_switched_off_tools_hidden_sign">Switched off — tools hidden, sign-in kept.</string>
+ <string name="connector_cards_hide_paste_url_fallback">Hide paste-URL fallback</string>
+ <string name="connector_cards_browser_didn_t_return_paste">Browser didn\'t return? Paste redirect URL</string>
+
+ <!-- ConnectorsSection -->
+ <string name="connectors_4_expose_the_devices_you">4. Expose the devices you want the assistant to control: Settings ▸ Voice assistants ▸ Expose entities.</string>
+ <string name="connectors_4_important_open_each_page">4. Important: open each page you want reachable and use ⋯ ▸ Connections ▸ add the integration. Pages that are not shared stay invisible to it.</string>
+ <string name="connectors_other_providers_check_their_imap">Other providers: check their IMAP app-password documentation.</string>
+ <string name="connectors_6_tap_connect">6. Tap Connect.</string>
+ <string name="connectors_5_paste_it_below_and">5. Paste it below and tap Connect. Leave Tenant as \"common\" for personal accounts.</string>
+
+ <!-- Connector cards -->
+ <string name="connector_cards_enable">Enable %1$s</string>
+ <string name="connector_cards_collapse">Collapse %1$s</string>
+ <string name="connector_cards_expand">Expand %1$s</string>
+ <string name="connector_cards_not_connected_hint">Not connected — tap to set up</string>
+ <string name="connector_cards_connected_as">Connected as %1$s.</string>
+
+ <!-- Connectors page -->
+ <string name="connectors_interval_off">Off</string>
+ <string name="connectors_last_sync_just_now">Last sync: Just now</string>
+ <string name="connectors_last_sync_never">Last sync: Never</string>
+ <string name="connectors_all_up_to_date">All active connectors are up to date.</string>
+ <string name="connectors_imap_saved">Saved. Credentials are verified on first use.</string>
+ <plurals name="connectors_last_sync_minutes">
+ <item quantity="one">Last sync: %1$d min ago</item>
+ <item quantity="other">Last sync: %1$d min ago</item>
+ </plurals>
+ <plurals name="connectors_refreshed">
+ <item quantity="one">Refreshed %1$d connector: %2$s</item>
+ <item quantity="other">Refreshed %1$d connectors: %2$s</item>
+ </plurals>
</resources>
diff --git a/app/src/test/java/com/gotcha/ui/PermissionAskTest.kt b/app/src/test/java/com/gotcha/ui/PermissionAskTest.kt
index dc3ce02..aedf6d2 100644
--- a/app/src/test/java/com/gotcha/ui/PermissionAskTest.kt
+++ b/app/src/test/java/com/gotcha/ui/PermissionAskTest.kt
@@ -40,7 +40,7 @@ class PermissionAskTest {
assertTrue("the catalog must declare runtime permissions", runtimePermissions.isNotEmpty())
runtimePermissions.forEach { permission ->
- val ask = runtimePermissionAsk(permission)
+ val ask = runtimePermissionAsk(permission, context.stringLookup())
assertTrue(
"'$permission' has no rationale of its own — it fell back to a generic sentence",
ask.rationale.startsWith("Gotcha needs") && !ask.rationale.contains("to do what you asked")
@@ -56,7 +56,7 @@ class PermissionAskTest {
fun theAskNamesTheCapabilityTheSettingsRowNames() {
// One vocabulary for one permission: the dialog that asks for it and the
// Settings row that shows it granted have to be recognisably the same thing.
- val ask = runtimePermissionAsk(android.Manifest.permission.READ_CALL_LOG)
+ val ask = runtimePermissionAsk(android.Manifest.permission.READ_CALL_LOG, context.stringLookup())
assertEquals("Call Log", ask.title)
}
@@ -64,7 +64,7 @@ class PermissionAskTest {
fun anUnknownPermissionStillProducesAReadableAsk() {
// A tool reporting something the catalog has never heard of must still
// yield a dialog a human can act on, not a raw permission string.
- val ask = runtimePermissionAsk("android.permission.BODY_SENSORS")
+ val ask = runtimePermissionAsk("android.permission.BODY_SENSORS", context.stringLookup())
assertEquals("Body Sensors", ask.title)
assertTrue(ask.rationale.startsWith("Gotcha needs"))
}