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.
feat: add delete confirmation dialog for community skills in SettingsScreen
Rishabh Bajpai7d9d9e16d033
diff --git a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt b/app/src/main/java/com/gotcha/ui/SettingsScreen.ktindex 6d982f4..112639b 100644--- a/app/src/main/java/com/gotcha/ui/SettingsScreen.kt+++ b/app/src/main/java/com/gotcha/ui/SettingsScreen.kt@@ -15,12 +15,18 @@ import androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.rememberScrollStateimport androidx.compose.foundation.text.KeyboardOptionsimport androidx.compose.foundation.verticalScroll+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.outlined.Delete+import androidx.compose.material3.AlertDialogimport androidx.compose.material3.Button+import androidx.compose.material3.ButtonDefaultsimport androidx.compose.material3.DropdownMenuItemimport androidx.compose.material3.ExperimentalMaterial3Apiimport androidx.compose.material3.ExposedDropdownMenuBoximport androidx.compose.material3.ExposedDropdownMenuDefaultsimport androidx.compose.material3.HorizontalDivider+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButtonimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.OutlinedButtonimport androidx.compose.material3.OutlinedTextField@@ -50,6 +56,7 @@ import androidx.compose.ui.text.input.PasswordVisualTransformationimport androidx.compose.ui.text.input.VisualTransformationimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dp+import com.gotcha.agent.skills.Skillimport com.gotcha.agent.skills.SkillRegistryimport com.gotcha.audio.AudioModelimport com.gotcha.audio.AudioProvider@@ -145,6 +152,7 @@ fun SettingsScreen(var communitySkillPasteJson by remember { mutableStateOf("") }var communityImportBusy by remember { mutableStateOf(false) }var communitySkillRefreshTick by remember { mutableStateOf(0) }+ var communitySkillToDelete by remember { mutableStateOf<Skill?>(null) }val localContext = LocalContext.currentandroidx.compose.runtime.LaunchedEffect(Unit) {// Defense-in-depth: ChatViewModel also calls SkillRegistry.init, but@@ -1205,23 +1213,57 @@ fun SettingsScreen(onSave(currentSettings())})+ IconButton(+ onClick = { communitySkillToDelete = skill }+ ) {+ Icon(+ Icons.Outlined.Delete,+ contentDescription = "Delete ${skill.id}",+ tint = MaterialTheme.colorScheme.error+ )+ }}- Row(- horizontalArrangement = Arrangement.End,- modifier = Modifier.fillMaxWidth()- ) {- TextButton(onClick = {+ }+ }+ }++ // ---- Delete confirmation dialog ----+ communitySkillToDelete?.let { pending ->+ AlertDialog(+ onDismissRequest = { communitySkillToDelete = null },+ title = { Text("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."+ )+ },+ confirmButton = {+ Button(+ onClick = {+ val id = pending.id+ communitySkillToDelete = nullscope.launch {- runCatching { SkillRegistry.removeCommunity(skill.id) }- disabledSkills = disabledSkills - skill.id+ runCatching { SkillRegistry.removeCommunity(id) }+ disabledSkills = disabledSkills - idonSave(currentSettings())communitySkillRefreshTick++- overlay = SettingsOverlay("Removed '${skill.id}'.")+ overlay = SettingsOverlay("Deleted '$id'.")}- }) { Text("Remove") }+ },+ colors = ButtonDefaults.buttonColors(+ containerColor = MaterialTheme.colorScheme.error+ )+ ) { Text("Delete") }+ },+ dismissButton = {+ TextButton(onClick = { communitySkillToDelete = null }) {+ Text("Cancel")}}- }+ )}HorizontalDivider(thickness = 1.dp)