Hide advanced signing options by default

This commit is contained in:
2026-04-27 13:18:49 -05:00
parent b9f5165e38
commit 55837a2982
8 changed files with 107 additions and 34 deletions
@@ -1330,6 +1330,7 @@ private fun SignScreen(
var certPassword by rememberSaveable { mutableStateOf("") }
var reason by rememberSaveable { mutableStateOf("Firmado digitalmente") }
var location by rememberSaveable { mutableStateOf("") }
var showAdvancedOptions by remember { mutableStateOf(false) }
var currentPageIndex by rememberSaveable(selectedDocumentId) { mutableStateOf(0) }
var preview by remember(selectedDocumentId) { mutableStateOf<PdfPreviewState?>(null) }
var placement by remember(selectedDocumentId) { mutableStateOf<SignaturePlacement?>(null) }
@@ -1339,6 +1340,9 @@ private fun SignScreen(
val selectedDocument = state.documents.firstOrNull { it.id.toString() == selectedDocumentId }
val signerLabel = state.userName ?: state.userEmail ?: "Firmante"
val signatureStyle = state.signaturePreferences?.signatureStyle ?: "qr"
val qrPosition = state.signaturePreferences?.qrPosition ?: "left"
val qrBackground = state.signaturePreferences?.qrBackground ?: "transparent"
val qrBorder = state.signaturePreferences?.qrBorder ?: "none"
LaunchedEffect(initialDocumentId, state.documents) {
val documentId = initialDocumentId ?: return@LaunchedEffect
@@ -1360,7 +1364,6 @@ private fun SignScreen(
) {
item {
SectionCard(title = "Vista previa y firma") {
Text("Esta versión usa la configuración visual de firma ya guardada en tu cuenta.", color = TextMuted, fontSize = AppFontSizes.sm)
DropdownSelector(
label = "Documento",
options = state.documents.associate { it.id.toString() to (it.title ?: it.filename ?: "Documento ${it.id}") },
@@ -1374,8 +1377,37 @@ private fun SignScreen(
onSelect = { selectedCertificateId = it }
)
AppTextField(value = certPassword, onValueChange = { certPassword = it }, label = "Contraseña del certificado", isPassword = true)
AppTextField(value = reason, onValueChange = { reason = it }, label = "Razón")
AppTextField(value = location, onValueChange = { location = it }, label = "Ubicación")
OutlinedActionButton(
label = if (showAdvancedOptions) "Ocultar detalles" else "Mostrar detalles",
icon = if (showAdvancedOptions) Icons.Outlined.VisibilityOff else Icons.Outlined.Visibility
) {
showAdvancedOptions = !showAdvancedOptions
}
if (showAdvancedOptions) {
Text("Esta versión usa la configuración visual de firma ya guardada en tu cuenta.", color = TextMuted, fontSize = AppFontSizes.sm)
AppTextField(value = reason, onValueChange = { reason = it }, label = "Razón")
AppTextField(value = location, onValueChange = { location = it }, label = "Ubicación")
Surface(
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(18.dp),
color = SurfaceSoft,
border = BorderStroke(1.dp, StrokeSoft)
) {
Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(6.dp)
) {
Text("Estilo aplicado", color = BrandDark, fontSize = AppFontSizes.base, fontWeight = FontWeight.SemiBold)
Text("La firma usará tu configuración guardada en el menú Estilo Firma.", color = TextMuted, fontSize = AppFontSizes.sm)
Text("Tipo: $signatureStyle", color = BrandDark, fontSize = AppFontSizes.sm)
if (signatureStyle == "qr") {
Text("Posición QR: ${if (qrPosition == "left") "Izquierda" else "Derecha"}", color = BrandDark, fontSize = AppFontSizes.sm)
Text("Fondo: ${if (qrBackground == "transparent") "Transparente" else "Suave"}", color = BrandDark, fontSize = AppFontSizes.sm)
Text("Borde: ${if (qrBorder == "none") "Sin borde" else "Con borde"}", color = BrandDark, fontSize = AppFontSizes.sm)
}
}
}
}
OutlinedActionButton("Cargar PDF para ubicar firma", Icons.Outlined.Description) {
val documentId = selectedDocumentId.toIntOrNull() ?: return@OutlinedActionButton
scope.launch {