82bb6a2fc716

feat: D6 inline field editing in EntryDetail — editable username/email/notes/password rows (biometric-gated pw edit), identity-suggest dropdown via updateField (v2.1.33)

time
2026-06-09 04:34 UTC · 5 months ago
machine
koh2
agent
claude-opus-4-8
session
peach remaining gaps
parent
ed2b2847cc79
4 files app/drafts/D6/EditableFieldRow.kt+0 −280app/src/main/java/com/peachpasswords/ui/vault/EditableFieldRow.kt+283 −0app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+29 −64app/src/main/java/com/peachpasswords/ui/vault/EntryDetailViewModel.kt+25 −0
app/drafts/D6/EditableFieldRow.kt+0 −280
@@ -1,280 +0,0 @@1-package com.peachpasswords.ui.vault2-3-/*4- * D6 — Inline per-field editing for EntryDetailScreen.5- *6- * Self-contained drop-in composables (orchestrator merges these into7- * EntryDetailScreen.kt — D6/D7/E6 all touch that file, so this stays isolated8- * with anchors documented in INTEGRATION.md).9- *10- * Provides:11- *   - EditableFieldRow      : view <-> edit toggle, underlined BasicTextField,12- *                             ✓ save / ✗ cancel, optional identity-suggest dropdown.13- *   - EditablePasswordRow   : same, but gated behind a biometric/password unlock14- *                             before entering edit mode (mirrors the reveal flow).15- *16- * Both reuse the file's existing private helpers FieldShell, FieldRow-style17- * label/value layout, and CopyButton. Those are already present in18- * EntryDetailScreen.kt; this draft references them by name. If the orchestrator19- * places this in a separate file instead of inlining, FieldShell + CopyButton20- * must be made `internal` (see INTEGRATION.md).21- */22-23-import androidx.compose.foundation.clickable24-import androidx.compose.foundation.layout.Arrangement25-import androidx.compose.foundation.layout.Box26-import androidx.compose.foundation.layout.Column27-import androidx.compose.foundation.layout.Row28-import androidx.compose.foundation.layout.Spacer29-import androidx.compose.foundation.layout.fillMaxWidth30-import androidx.compose.foundation.layout.height31-import androidx.compose.foundation.layout.padding32-import androidx.compose.foundation.layout.width33-import androidx.compose.foundation.shape.RoundedCornerShape34-import androidx.compose.foundation.text.BasicTextField35-import androidx.compose.material3.DropdownMenu36-import androidx.compose.material3.DropdownMenuItem37-import androidx.compose.material3.Text38-import androidx.compose.runtime.Composable39-import androidx.compose.runtime.getValue40-import androidx.compose.runtime.mutableStateOf41-import androidx.compose.runtime.remember42-import androidx.compose.runtime.setValue43-import androidx.compose.ui.Alignment44-import androidx.compose.ui.Modifier45-import androidx.compose.ui.draw.clip46-import androidx.compose.ui.draw.drawBehind47-import androidx.compose.ui.geometry.Offset48-import androidx.compose.ui.graphics.SolidColor49-import androidx.compose.ui.platform.LocalContext50-import androidx.compose.ui.text.input.PasswordVisualTransformation51-import androidx.compose.ui.text.input.VisualTransformation52-import androidx.compose.ui.unit.dp53-import androidx.compose.ui.unit.em54-import androidx.fragment.app.FragmentActivity55-import com.peachpasswords.ui.lock.Biometrics56-import com.peachpasswords.ui.theme.LocalPeachAccent57-import com.peachpasswords.ui.theme.PeachColors58-import com.peachpasswords.ui.theme.PeachType59-60-/**61- * A field row that toggles between read-only display and inline edit.62- *63- * View mode: value text + copy button (unchanged look from the existing FieldRow).64- * Edit mode: an underlined BasicTextField with ✓ save / ✗ cancel beneath it, and65- * — when [suggestions] is non-empty — a DropdownMenu of prior values to tap-fill.66- *67- * @param field   logical field key passed to [onSave] (e.g. "username", "email", "notes").68- * @param onSave  called with the trimmed draft when the user taps ✓; the caller69- *                (EntryDetailViewModel.updateField) persists it.70- * @param suggestions identity-suggest values for USERNAME/EMAIL; empty disables the dropdown.71- * @param mono    mono body style for the value (false = serif body, used by notes).72- */73-@Composable74-fun EditableFieldRow(75-    label: String,76-    field: String,77-    value: String,78-    copied: Boolean,79-    onCopy: () -> Unit,80-    onSave: (String) -> Unit,81-    suggestions: List<String> = emptyList(),82-    mono: Boolean = true,83-    singleLine: Boolean = true,84-) {85-    var editing by remember(value) { mutableStateOf(false) }86-    var draft by remember(value) { mutableStateOf(value) }87-88-    FieldShell(label) {89-        if (!editing) {90-            Text(91-                value,92-                color = PeachColors.T0,93-                style = if (mono) PeachType.bodyMono else PeachType.body,94-                modifier = Modifier95-                    .weight(1f)96-                    .clickable { draft = value; editing = true },97-            )98-            CopyButton(copied, onCopy)99-        } else {100-            InlineEditor(101-                draft = draft,102-                onDraftChange = { draft = it },103-                onSave = { onSave(draft.trim()); editing = false },104-                onCancel = { draft = value; editing = false },105-                suggestions = suggestions,106-                onPickSuggestion = { draft = it },107-                singleLine = singleLine,108-                modifier = Modifier.weight(1f),109-            )110-        }111-    }112-}113-114-/**115- * Password variant of [EditableFieldRow]. Entering edit mode is gated behind a116- * biometric (or device-credential) prompt, mirroring the existing reveal flow in117- * PasswordRow. The draft starts masked; a show/hide toggle controls visibility.118- *119- * The gate runs only on the view→edit transition. Once authenticated the field is120- * editable with the cleartext draft available.121- */122-@Composable123-fun EditablePasswordRow(124-    value: String,125-    copied: Boolean,126-    entryTitle: String,127-    onCopy: () -> Unit,128-    onSave: (String) -> Unit,129-) {130-    val accent = LocalPeachAccent.current131-    val context = LocalContext.current132-    var editing by remember(value) { mutableStateOf(false) }133-    var draft by remember(value) { mutableStateOf(value) }134-    var show by remember { mutableStateOf(false) }135-136-    fun beginEdit() {137-        val activity = context as? FragmentActivity138-        if (activity != null && Biometrics.isAvailable(context)) {139-            Biometrics.authenticate(140-                activity,141-                title = "Unlock Peach",142-                subtitle = entryTitle,143-                onSuccess = { draft = value; show = false; editing = true },144-            )145-        } else {146-            // No biometrics: fall through (same fallback the reveal flow uses).147-            draft = value; show = false; editing = true148-        }149-    }150-151-    FieldShell("password") {152-        if (!editing) {153-            Text(154-                text = "•".repeat(value.length.coerceIn(8, 16)),155-                color = PeachColors.T0,156-                style = PeachType.bodyMono,157-                modifier = Modifier.weight(1f).clickable { beginEdit() },158-            )159-            Text(160-                "edit", color = accent, style = PeachType.labelMono,161-                modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable { beginEdit() }.padding(8.dp),162-            )163-            CopyButton(copied, onCopy)164-        } else {165-            Column(Modifier.weight(1f)) {166-                Row(verticalAlignment = Alignment.CenterVertically) {167-                    UnderlinedField(168-                        draft = draft,169-                        onDraftChange = { draft = it },170-                        transformation = if (show) VisualTransformation.None else PasswordVisualTransformation(),171-                        singleLine = true,172-                        modifier = Modifier.weight(1f),173-                    )174-                    Text(175-                        if (show) "hide" else "show", color = accent, style = PeachType.labelMono,176-                        modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable { show = !show }.padding(6.dp),177-                    )178-                }179-                Spacer(Modifier.height(8.dp))180-                SaveCancelRow(181-                    onSave = { onSave(draft); editing = false },182-                    onCancel = { draft = value; editing = false },183-                )184-            }185-        }186-    }187-}188-189-/** Underlined editor + suggestion dropdown + save/cancel — the shared edit body. */190-@Composable191-private fun InlineEditor(192-    draft: String,193-    onDraftChange: (String) -> Unit,194-    onSave: () -> Unit,195-    onCancel: () -> Unit,196-    suggestions: List<String>,197-    onPickSuggestion: (String) -> Unit,198-    singleLine: Boolean,199-    modifier: Modifier = Modifier,200-) {201-    var dropdownOpen by remember { mutableStateOf(suggestions.isNotEmpty()) }202-203-    Column(modifier) {204-        Box {205-            UnderlinedField(206-                draft = draft,207-                onDraftChange = onDraftChange,208-                singleLine = singleLine,209-                modifier = Modifier.fillMaxWidth(),210-            )211-            if (suggestions.isNotEmpty()) {212-                DropdownMenu(213-                    expanded = dropdownOpen,214-                    onDismissRequest = { dropdownOpen = false },215-                ) {216-                    suggestions.take(4).forEach { suggestion ->217-                        DropdownMenuItem(218-                            text = {219-                                Text(220-                                    suggestion,221-                                    color = PeachColors.T1,222-                                    style = PeachType.labelMono.copy(letterSpacing = 0.06.em),223-                                )224-                            },225-                            onClick = { onPickSuggestion(suggestion); dropdownOpen = false },226-                        )227-                    }228-                }229-            }230-        }231-        Spacer(Modifier.height(8.dp))232-        SaveCancelRow(onSave = onSave, onCancel = onCancel)233-    }234-}235-236-/** A BasicTextField with an accent underline drawn beneath it (spec §5 inline edit). */237-@Composable238-private fun UnderlinedField(239-    draft: String,240-    onDraftChange: (String) -> Unit,241-    transformation: VisualTransformation = VisualTransformation.None,242-    singleLine: Boolean = true,243-    modifier: Modifier = Modifier,244-) {245-    val accent = LocalPeachAccent.current246-    BasicTextField(247-        value = draft,248-        onValueChange = onDraftChange,249-        singleLine = singleLine,250-        textStyle = PeachType.bodyMono.copy(color = PeachColors.T0),251-        cursorBrush = SolidColor(accent),252-        visualTransformation = transformation,253-        modifier = modifier254-            .padding(bottom = 4.dp)255-            .drawBehind {256-                drawLine(257-                    color = accent,258-                    start = Offset(0f, size.height),259-                    end = Offset(size.width, size.height),260-                    strokeWidth = 1.dp.toPx(),261-                )262-            },263-    )264-}265-266-@Composable267-private fun SaveCancelRow(onSave: () -> Unit, onCancel: () -> Unit) {268-    val accent = LocalPeachAccent.current269-    Row(horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.CenterVertically) {270-        Text(271-            "✓ save", color = accent, style = PeachType.labelMono,272-            modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable(onClick = onSave).padding(vertical = 4.dp),273-        )274-        Text(275-            "✗", color = PeachColors.T2, style = PeachType.labelMono,276-            modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable(onClick = onCancel).padding(horizontal = 6.dp, vertical = 4.dp),277-        )278-        Spacer(Modifier.width(1.dp))279-    }280-}

view file at the parent

app/src/main/java/com/peachpasswords/ui/vault/EditableFieldRow.kt+283 −0
@@ -0,0 +1,283 @@1+package com.peachpasswords.ui.vault2+3+/*4+ * D6 — Inline per-field editing for EntryDetailScreen.5+ *6+ * Self-contained drop-in composables (orchestrator merges these into7+ * EntryDetailScreen.kt — D6/D7/E6 all touch that file, so this stays isolated8+ * with anchors documented in INTEGRATION.md).9+ *10+ * Provides:11+ *   - EditableFieldRow      : view <-> edit toggle, underlined BasicTextField,12+ *                             ✓ save / ✗ cancel, optional identity-suggest dropdown.13+ *   - EditablePasswordRow   : same, but gated behind a biometric/password unlock14+ *                             before entering edit mode (mirrors the reveal flow).15+ *16+ * Both reuse the file's existing private helpers FieldShell, FieldRow-style17+ * label/value layout, and CopyButton. Those are already present in18+ * EntryDetailScreen.kt; this draft references them by name. If the orchestrator19+ * places this in a separate file instead of inlining, FieldShell + CopyButton20+ * must be made `internal` (see INTEGRATION.md).21+ */22+23+import androidx.compose.foundation.clickable24+import androidx.compose.foundation.layout.Arrangement25+import androidx.compose.foundation.layout.Box26+import androidx.compose.foundation.layout.Column27+import androidx.compose.foundation.layout.Row28+import androidx.compose.foundation.layout.Spacer29+import androidx.compose.foundation.layout.fillMaxWidth30+import androidx.compose.foundation.layout.height31+import androidx.compose.foundation.layout.padding32+import androidx.compose.foundation.layout.width33+import androidx.compose.foundation.shape.RoundedCornerShape34+import androidx.compose.foundation.text.BasicTextField35+import androidx.compose.material3.DropdownMenu36+import androidx.compose.material3.DropdownMenuItem37+import androidx.compose.material3.Text38+import androidx.compose.runtime.Composable39+import androidx.compose.runtime.getValue40+import androidx.compose.runtime.mutableStateOf41+import androidx.compose.runtime.remember42+import androidx.compose.runtime.setValue43+import androidx.compose.ui.Alignment44+import androidx.compose.ui.Modifier45+import androidx.compose.ui.draw.clip46+import androidx.compose.ui.draw.drawBehind47+import androidx.compose.ui.geometry.Offset48+import androidx.compose.ui.graphics.SolidColor49+import androidx.compose.ui.platform.LocalContext50+import androidx.compose.ui.text.input.PasswordVisualTransformation51+import androidx.compose.ui.text.input.VisualTransformation52+import androidx.compose.ui.unit.dp53+import androidx.compose.ui.unit.em54+import androidx.fragment.app.FragmentActivity55+import com.peachpasswords.ui.components.CopyButton56+import com.peachpasswords.ui.lock.Biometrics57+import com.peachpasswords.ui.theme.LocalPeachAccent58+import com.peachpasswords.ui.theme.PeachColors59+import com.peachpasswords.ui.theme.PeachType60+61+/**62+ * A field row that toggles between read-only display and inline edit.63+ *64+ * View mode: value text + copy button (unchanged look from the existing FieldRow).65+ * Edit mode: an underlined BasicTextField with ✓ save / ✗ cancel beneath it, and66+ * — when [suggestions] is non-empty — a DropdownMenu of prior values to tap-fill.67+ *68+ * @param field   logical field key passed to [onSave] (e.g. "username", "email", "notes").69+ * @param onSave  called with the trimmed draft when the user taps ✓; the caller70+ *                (EntryDetailViewModel.updateField) persists it.71+ * @param suggestions identity-suggest values for USERNAME/EMAIL; empty disables the dropdown.72+ * @param mono    mono body style for the value (false = serif body, used by notes).73+ */74+@Composable75+fun EditableFieldRow(76+    label: String,77+    field: String,78+    value: String,79+    copied: Boolean,80+    onCopy: () -> Unit,81+    onSave: (String) -> Unit,82+    suggestions: List<String> = emptyList(),83+    mono: Boolean = true,84+    singleLine: Boolean = true,85+) {86+    var editing by remember(value) { mutableStateOf(false) }87+    var draft by remember(value) { mutableStateOf(value) }88+89+    FieldShell(label) {90+        if (!editing) {91+            Text(92+                value,93+                color = PeachColors.T0,94+                style = if (mono) PeachType.bodyMono else PeachType.body,95+                modifier = Modifier96+                    .weight(1f)97+                    .clickable { draft = value; editing = true },98+            )99+            CopyButton(copied, onCopy)100+        } else {101+            InlineEditor(102+                draft = draft,103+                onDraftChange = { draft = it },104+                onSave = { onSave(draft.trim()); editing = false },105+                onCancel = { draft = value; editing = false },106+                suggestions = suggestions,107+                onPickSuggestion = { draft = it },108+                singleLine = singleLine,109+                modifier = Modifier.weight(1f),110+            )111+        }112+    }113+}114+115+/**116+ * Password variant of [EditableFieldRow]. Entering edit mode is gated behind a117+ * biometric (or device-credential) prompt, mirroring the existing reveal flow in118+ * PasswordRow. The draft starts masked; a show/hide toggle controls visibility.119+ *120+ * The gate runs only on the view→edit transition. Once authenticated the field is121+ * editable with the cleartext draft available.122+ */123+@Composable124+fun EditablePasswordRow(125+    value: String,126+    copied: Boolean,127+    entryTitle: String,128+    onCopy: () -> Unit,129+    onSave: (String) -> Unit,130+    onGenerate: () -> Unit,131+) {132+    val accent = LocalPeachAccent.current133+    val context = LocalContext.current134+    var editing by remember(value) { mutableStateOf(false) }135+    var draft by remember(value) { mutableStateOf(value) }136+    var show by remember { mutableStateOf(false) }137+138+    fun beginEdit() {139+        val activity = context as? FragmentActivity140+        if (activity != null && Biometrics.isAvailable(context)) {141+            Biometrics.authenticate(142+                activity,143+                title = "Unlock Peach",144+                subtitle = entryTitle,145+                onSuccess = { draft = value; show = false; editing = true },146+            )147+        } else {148+            // No biometrics: fall through (same fallback the reveal flow uses).149+            draft = value; show = false; editing = true150+        }151+    }152+153+    FieldShell("password") {154+        if (!editing) {155+            Text(156+                text = "•".repeat(value.length.coerceIn(8, 16)),157+                color = PeachColors.T0,158+                style = PeachType.bodyMono,159+                modifier = Modifier.weight(1f).clickable { beginEdit() },160+            )161+            Text(162+                "edit", color = accent, style = PeachType.labelMono,163+                modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable { beginEdit() }.padding(8.dp),164+            )165+            CopyButton(copied, onCopy)166+            WrenchButton(onClick = onGenerate)167+        } else {168+            Column(Modifier.weight(1f)) {169+                Row(verticalAlignment = Alignment.CenterVertically) {170+                    UnderlinedField(171+                        draft = draft,172+                        onDraftChange = { draft = it },173+                        transformation = if (show) VisualTransformation.None else PasswordVisualTransformation(),174+                        singleLine = true,175+                        modifier = Modifier.weight(1f),176+                    )177+                    Text(178+                        if (show) "hide" else "show", color = accent, style = PeachType.labelMono,179+                        modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable { show = !show }.padding(6.dp),180+                    )181+                }182+                Spacer(Modifier.height(8.dp))183+                SaveCancelRow(184+                    onSave = { onSave(draft); editing = false },185+                    onCancel = { draft = value; editing = false },186+                )187+            }188+        }189+    }190+}191+192+/** Underlined editor + suggestion dropdown + save/cancel — the shared edit body. */193+@Composable194+private fun InlineEditor(195+    draft: String,196+    onDraftChange: (String) -> Unit,197+    onSave: () -> Unit,198+    onCancel: () -> Unit,199+    suggestions: List<String>,200+    onPickSuggestion: (String) -> Unit,201+    singleLine: Boolean,202+    modifier: Modifier = Modifier,203+) {204+    var dropdownOpen by remember { mutableStateOf(suggestions.isNotEmpty()) }205+206+    Column(modifier) {207+        Box {208+            UnderlinedField(209+                draft = draft,210+                onDraftChange = onDraftChange,211+                singleLine = singleLine,212+                modifier = Modifier.fillMaxWidth(),213+            )214+            if (suggestions.isNotEmpty()) {215+                DropdownMenu(216+                    expanded = dropdownOpen,217+                    onDismissRequest = { dropdownOpen = false },218+                ) {219+                    suggestions.take(4).forEach { suggestion ->220+                        DropdownMenuItem(221+                            text = {222+                                Text(223+                                    suggestion,224+                                    color = PeachColors.T1,225+                                    style = PeachType.labelMono.copy(letterSpacing = 0.06.em),226+                                )227+                            },228+                            onClick = { onPickSuggestion(suggestion); dropdownOpen = false },229+                        )230+                    }231+                }232+            }233+        }234+        Spacer(Modifier.height(8.dp))235+        SaveCancelRow(onSave = onSave, onCancel = onCancel)236+    }237+}238+239+/** A BasicTextField with an accent underline drawn beneath it (spec §5 inline edit). */240+@Composable241+private fun UnderlinedField(242+    draft: String,243+    onDraftChange: (String) -> Unit,244+    transformation: VisualTransformation = VisualTransformation.None,245+    singleLine: Boolean = true,246+    modifier: Modifier = Modifier,247+) {248+    val accent = LocalPeachAccent.current249+    BasicTextField(250+        value = draft,251+        onValueChange = onDraftChange,252+        singleLine = singleLine,253+        textStyle = PeachType.bodyMono.copy(color = PeachColors.T0),254+        cursorBrush = SolidColor(accent),255+        visualTransformation = transformation,256+        modifier = modifier257+            .padding(bottom = 4.dp)258+            .drawBehind {259+                drawLine(260+                    color = accent,261+                    start = Offset(0f, size.height),262+                    end = Offset(size.width, size.height),263+                    strokeWidth = 1.dp.toPx(),264+                )265+            },266+    )267+}268+269+@Composable270+private fun SaveCancelRow(onSave: () -> Unit, onCancel: () -> Unit) {271+    val accent = LocalPeachAccent.current272+    Row(horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.CenterVertically) {273+        Text(274+            "✓ save", color = accent, style = PeachType.labelMono,275+            modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable(onClick = onSave).padding(vertical = 4.dp),276+        )277+        Text(278+            "✗", color = PeachColors.T2, style = PeachType.labelMono,279+            modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable(onClick = onCancel).padding(horizontal = 6.dp, vertical = 4.dp),280+        )281+        Spacer(Modifier.width(1.dp))282+    }283+}

view file

app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+29 −64
@@ -83,7 +83,7 @@8383     vm: EntryDetailViewModel = hiltViewModel(),8484 ) {8585     val entry by vm.entry.collectAsState()86-    val revealed by vm.revealed.collectAsState()86+    val identitySuggestions by vm.identitySuggestions.collectAsState()8787     val cvcRevealed by vm.cvcRevealed.collectAsState()8888     var cardRevealed by remember { mutableStateOf(false) }8989     val copiedField by vm.copiedField.collectAsState()@@ -222,11 +222,23 @@222222                         copyButton = { copied, onCopy -> CopyButton(copied, onCopy) },223223                     )224224                 } else {225-                    e.username?.takeIf { it.isNotBlank() }?.let {226-                        FieldRow("username", it, copiedField == "username") { vm.copy("username", it) }225+                    e.username?.takeIf { it.isNotBlank() }?.let { v ->226+                        EditableFieldRow(227+                            label = "username", field = "username", value = v,228+                            copied = copiedField == "username",229+                            onCopy = { vm.copy("username", v) },230+                            onSave = { vm.updateField("username", it) },231+                            suggestions = identitySuggestions,232+                        )227233                     }228-                    e.email?.takeIf { it.isNotBlank() }?.let {229-                        FieldRow("email", it, copiedField == "email") { vm.copy("email", it) }234+                    e.email?.takeIf { it.isNotBlank() }?.let { v ->235+                        EditableFieldRow(236+                            label = "email", field = "email", value = v,237+                            copied = copiedField == "email",238+                            onCopy = { vm.copy("email", v) },239+                            onSave = { vm.updateField("email", it) },240+                            suggestions = identitySuggestions,241+                        )230242                     }231243                     e.additionalUrls?.takeIf { it.any { u -> u.isNotBlank() } }?.let { urls ->232244                         AdditionalUrlRows(@@ -236,20 +248,12 @@236248                         )237249                     }238250                     e.password?.takeIf { it.isNotBlank() }?.let { pw ->239-                        PasswordRow(251+                        EditablePasswordRow(240252                             value = pw,241-                            revealed = revealed,242253                             copied = copiedField == "password",243-                            onReveal = {244-                                if (revealed) vm.mask()245-                                else {246-                                    val activity = context as? FragmentActivity247-                                    if (activity != null && Biometrics.isAvailable(context)) {248-                                        Biometrics.authenticate(activity, "Unlock Peach", e.title, onSuccess = vm::reveal)249-                                    } else vm.reveal()250-                                }251-                            },254+                            entryTitle = e.title,252255                             onCopy = { vm.copy("password", pw) },256+                            onSave = { vm.updateField("password", it) },253257                             onGenerate = { generatorOpen = true },254258                         )255259                     }@@ -258,8 +262,14 @@258262                         TotpBand(totpField = e.totp!!, copied = copiedField == "totp", onCopy = vm::copyTotp)259263                     }260264                 }261-                e.notes?.takeIf { it.isNotBlank() }?.let {262-                    FieldRow("notes", it, copiedField == "notes", mono = false) { vm.copy("notes", it) }265+                e.notes?.takeIf { it.isNotBlank() }?.let { v ->266+                    EditableFieldRow(267+                        label = "notes", field = "notes", value = v,268+                        copied = copiedField == "notes",269+                        onCopy = { vm.copy("notes", v) },270+                        onSave = { vm.updateField("notes", it) },271+                        mono = false, singleLine = false,272+                    )263273                 }264274                 e.tags?.takeIf { it.isNotEmpty() }?.let { tags ->265275                     DetailTagRow(@@ -283,54 +293,9 @@283293     }284294 }285295 286-@Composable287-private fun FieldRow(288-    label: String,289-    value: String,290-    copied: Boolean,291-    mono: Boolean = true,292-    onCopy: () -> Unit,293-) {294-    FieldShell(label) {295-        Text(296-            value,297-            color = PeachColors.T0,298-            style = if (mono) PeachType.bodyMono else PeachType.body,299-            modifier = Modifier.weight(1f),300-        )301-        CopyButton(copied, onCopy)302-    }303-}304-305-@Composable306-private fun PasswordRow(307-    value: String,308-    revealed: Boolean,309-    copied: Boolean,310-    onReveal: () -> Unit,311-    onCopy: () -> Unit,312-    onGenerate: () -> Unit,313-) {314-    val accent = LocalPeachAccent.current315-    FieldShell("password") {316-        Text(317-            text = if (revealed) value else "•".repeat(value.length.coerceIn(8, 16)),318-            color = PeachColors.T0,319-            style = PeachType.bodyMono,320-            modifier = Modifier.weight(1f),321-        )322-        Text(323-            if (revealed) "hide" else "show", color = accent, style = PeachType.labelMono,324-            modifier = Modifier.clip(RoundedCornerShape(6.dp)).clickable(onClick = onReveal).padding(8.dp),325-        )326-        CopyButton(copied, onCopy)327-        WrenchButton(onClick = onGenerate)328-    }329-}330-331296 /** A field row: uppercase mono label over a value/action row, with a t3 hairline beneath (spec §5.4). */332297 @Composable333-private fun FieldShell(298+internal fun FieldShell(334299     label: String,335300     content: @Composable androidx.compose.foundation.layout.RowScope.() -> Unit,336301 ) {

view file

app/src/main/java/com/peachpasswords/ui/vault/EntryDetailViewModel.kt+25 −0
@@ -32,6 +32,12 @@3232         vault.entries.map { list -> list.firstOrNull { it.id == id } }3333             .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), vault.getEntry(id))3434 35+    /** Distinct prior username/email values for the identity-suggest dropdown. */36+    val identitySuggestions: StateFlow<List<String>> =37+        vault.entries38+            .map { vault.getDistinctFieldValues("username").take(4) }39+            .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyList())40+3541     private val _revealed = MutableStateFlow(false)3642     val revealed: StateFlow<Boolean> = _revealed.asStateFlow()3743 @@ -90,6 +96,25 @@9096         viewModelScope.launch {9197             runCatching { vault.updateEntry(current.copy(password = newPassword)) }9298             onDone()99+        }100+    }101+102+    /**103+     * Persist a single field's inline edit via a full-entry updateEntry patch104+     * (which handles password-history capture + timestamps). No-op if entry gone.105+     */106+    fun updateField(field: String, value: String) {107+        val current = entry.value ?: return108+        val patch = when (field) {109+            "username" -> current.copy(username = value.ifBlank { null })110+            "email" -> current.copy(email = value.ifBlank { null })111+            "password" -> current.copy(password = value.ifBlank { null })112+            "notes" -> current.copy(notes = value.ifBlank { null })113+            "totp" -> current.copy(totp = value.ifBlank { null })114+            else -> return115+        }116+        viewModelScope.launch {117+            runCatching { vault.updateEntry(patch) }93118         }94119     }95120 

view file