From caffe71f896cdfe708a3df25b321843e279adfac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Nov 2025 12:33:47 +0000 Subject: [PATCH 1/2] Initial plan From a1e7c298de3d433c90f6d0c1d320b27a0a238c99 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Nov 2025 12:38:37 +0000 Subject: [PATCH 2/2] Add delete button with confirmation dialog to edit contacts screen Co-authored-by: David-LS-Bilbao <221296404+David-LS-Bilbao@users.noreply.github.com> --- .../contactos/EditarContactoScreen.kt | 35 +++++++++++++++++++ gradlew | 0 2 files changed, 35 insertions(+) mode change 100644 => 100755 gradlew diff --git a/app/src/main/java/com/dls/pymetask/presentation/contactos/EditarContactoScreen.kt b/app/src/main/java/com/dls/pymetask/presentation/contactos/EditarContactoScreen.kt index a67d457..70bc1a0 100644 --- a/app/src/main/java/com/dls/pymetask/presentation/contactos/EditarContactoScreen.kt +++ b/app/src/main/java/com/dls/pymetask/presentation/contactos/EditarContactoScreen.kt @@ -100,6 +100,7 @@ fun EditarContactoScreen( var tipo by remember { mutableStateOf("") } var fotoUrl by remember { mutableStateOf(null) } var inicializado by remember(contactoId) { mutableStateOf(false) } + var showDeleteDialog by remember { mutableStateOf(false) } LaunchedEffect(contacto) { if (!inicializado) { @@ -211,8 +212,42 @@ fun EditarContactoScreen( enabled = nombre.isNotBlank() && telefono.isNotBlank() && !isUploading, modifier = Modifier.fillMaxWidth() ) { Text(stringResource(R.string.contacts_save_changes)) } + + // Botón de eliminar contacto + OutlinedButton( + onClick = { showDeleteDialog = true }, + modifier = Modifier.fillMaxWidth(), + colors = ButtonDefaults.outlinedButtonColors( + contentColor = MaterialTheme.colorScheme.error + ) + ) { Text(stringResource(R.string.common_delete)) } } } + + // Diálogo de confirmación para eliminar + if (showDeleteDialog) { + AlertDialog( + onDismissRequest = { showDeleteDialog = false }, + title = { Text(stringResource(R.string.contacts_delete_title)) }, + text = { Text(stringResource(R.string.contacts_delete_text, contacto.nombre)) }, + confirmButton = { + TextButton( + onClick = { + showDeleteDialog = false + viewModel.onDeleteContacto(context, contacto.id, contacto.fotoUrl) + navController.popBackStack() + } + ) { + Text(stringResource(R.string.common_delete), color = MaterialTheme.colorScheme.error) + } + }, + dismissButton = { + TextButton(onClick = { showDeleteDialog = false }) { + Text(stringResource(R.string.common_cancel)) + } + } + ) + } } diff --git a/gradlew b/gradlew old mode 100644 new mode 100755