d39710d35123
feat: E3 additional URLs — dynamic editor (max 5) in EntryEdit + detail rows with copy & open-in-browser in EntryDetail (v2.1.37)
- time
- 2026-06-09 04:26 UTC · 5 months ago
- machine
- koh2
- agent
- claude-opus-4-8
- session
- peach remaining gaps
- parent
- f291581522e2
↓ peach-android-d39710d3.tar.gzatlas at this save
files changed7 files
app/drafts/E3/AdditionalUrlsDetail.kt+0 −196app/drafts/E3/AdditionalUrlsEditor.kt+0 −119app/src/main/java/com/peachpasswords/ui/vault/AdditionalUrlsDetail.kt+197 −0app/src/main/java/com/peachpasswords/ui/vault/AdditionalUrlsEditor.kt+119 −0app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+7 −0app/src/main/java/com/peachpasswords/ui/vault/EntryEditScreen.kt+6 −0app/src/main/java/com/peachpasswords/ui/vault/EntryEditViewModel.kt+18 −0app/drafts/E3/AdditionalUrlsDetail.kt+0 −196
@@ -1,196 +0,0 @@1-package com.peachpasswords.ui.vault2-3-import android.content.ActivityNotFoundException4-import android.content.Context5-import android.content.Intent6-import android.net.Uri7-import android.widget.Toast8-import androidx.compose.animation.core.LinearEasing9-import androidx.compose.animation.core.animateFloatAsState10-import androidx.compose.animation.core.tween11-import androidx.compose.foundation.background12-import androidx.compose.foundation.clickable13-import androidx.compose.foundation.layout.Arrangement14-import androidx.compose.foundation.layout.Box15-import androidx.compose.foundation.layout.Column16-import androidx.compose.foundation.layout.Row17-import androidx.compose.foundation.layout.Spacer18-import androidx.compose.foundation.layout.fillMaxWidth19-import androidx.compose.foundation.layout.height20-import androidx.compose.foundation.layout.padding21-import androidx.compose.foundation.layout.size22-import androidx.compose.foundation.layout.width23-import androidx.compose.foundation.shape.RoundedCornerShape24-import androidx.compose.material.icons.Icons25-import androidx.compose.material.icons.automirrored.rounded.OpenInNew26-import androidx.compose.material.icons.rounded.Check27-import androidx.compose.material.icons.rounded.ContentCopy28-import androidx.compose.material3.Icon29-import androidx.compose.material3.Text30-import androidx.compose.runtime.Composable31-import androidx.compose.ui.Alignment32-import androidx.compose.ui.Modifier33-import androidx.compose.ui.draw.clip34-import androidx.compose.ui.draw.drawBehind35-import androidx.compose.ui.geometry.Offset36-import androidx.compose.ui.geometry.Size37-import androidx.compose.ui.graphics.Brush38-import androidx.compose.ui.graphics.Color39-import androidx.compose.ui.platform.LocalContext40-import androidx.compose.ui.text.TextStyle41-import androidx.compose.ui.unit.dp42-import androidx.compose.ui.unit.em43-import androidx.compose.ui.unit.sp44-import com.peachpasswords.ui.theme.LocalPeachAccent45-import com.peachpasswords.ui.theme.LocalReduceMotion46-import com.peachpasswords.ui.theme.PeachColors47-import com.peachpasswords.ui.theme.PeachType48-49-/**50- * E3 — additional-URL rows for EntryDetailScreen. Self-contained: it carries its51- * own field shell, copy button, and open-in-browser control so it can be inserted52- * into the detail field stack without touching the screen's private `FieldShell`53- * / `CopyButton`. Each row shows "URL N", the value, copy, and open-in-browser.54- *55- * `copiedKeyFor(index)` is the per-row clipboard latch key the caller passes to56- * `vm.copy(key, value)`; `copiedField` is the screen's current latch.57- */58-@Composable59-fun AdditionalUrlRows(60- urls: List<String>,61- copiedField: String?,62- onCopy: (key: String, value: String) -> Unit,63-) {64- val context = LocalContext.current65- urls.forEachIndexed { index, url ->66- if (url.isNotBlank()) {67- val key = additionalUrlCopyKey(index)68- AdditionalUrlFieldShell(label = "URL ${index + 2}") {69- Text(70- url,71- color = PeachColors.T0,72- style = PeachType.bodyMono,73- modifier = Modifier.weight(1f),74- )75- OpenInBrowserButton(onClick = { openUrlInBrowser(context, url) })76- Spacer(Modifier.width(4.dp))77- AdditionalUrlCopyButton(copied = copiedField == key, onCopy = { onCopy(key, url) })78- }79- }80- }81-}82-83-/** Per-row clipboard latch key; keeps each URL's copy feedback independent. */84-fun additionalUrlCopyKey(index: Int): String = "additionalUrl:$index"85-86-/**87- * Launches ACTION_VIEW for the URL, prefixing a scheme when the stored value is88- * bare (so "example.com" still resolves). Falls back to a toast if no browser89- * handles the intent.90- */91-fun openUrlInBrowser(context: Context, raw: String) {92- val normalized = if (raw.matches(Regex("^[a-zA-Z][a-zA-Z0-9+.-]*://.*"))) raw else "https://$raw"93- try {94- context.startActivity(95- Intent(Intent.ACTION_VIEW, Uri.parse(normalized)).apply {96- addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)97- },98- )99- } catch (_: ActivityNotFoundException) {100- Toast.makeText(context, "No app can open this link", Toast.LENGTH_SHORT).show()101- }102-}103-104-/** Mirrors EntryDetailScreen's private FieldShell: mono label over a value/action row with a t3 hairline. */105-@Composable106-private fun AdditionalUrlFieldShell(107- label: String,108- content: @Composable androidx.compose.foundation.layout.RowScope.() -> Unit,109-) {110- Column(111- Modifier.fillMaxWidth().padding(vertical = 10.dp).drawBehind {112- drawRect(113- color = PeachColors.T3,114- topLeft = Offset(0f, size.height - 1.dp.toPx()),115- size = Size(size.width, 1.dp.toPx()),116- )117- },118- ) {119- Text(label.uppercase(), color = PeachColors.T2, style = PeachType.labelMono.copy(letterSpacing = 0.08.em))120- Spacer(Modifier.height(6.dp))121- Row(verticalAlignment = Alignment.CenterVertically, content = content)122- }123-}124-125-@Composable126-private fun OpenInBrowserButton(onClick: () -> Unit) {127- Box(128- Modifier129- .size(36.dp)130- .clip(RoundedCornerShape(6.dp))131- .background(PeachColors.S2)132- .clickable(onClick = onClick),133- contentAlignment = Alignment.Center,134- ) {135- Icon(136- Icons.AutoMirrored.Rounded.OpenInNew,137- contentDescription = "open in browser",138- tint = PeachColors.T2,139- modifier = Modifier.size(15.dp),140- )141- }142-}143-144-/** Mirrors EntryDetailScreen's private CopyButton (sheen sweep + drain bar, spec §4.4). */145-@Composable146-private fun AdditionalUrlCopyButton(copied: Boolean, onCopy: () -> Unit) {147- val accent = LocalPeachAccent.current148- val reduceMotion = LocalReduceMotion.current149- val animate = copied && !reduceMotion150- val drain by animateFloatAsState(151- targetValue = if (copied) 1f else 0f,152- animationSpec = if (animate) tween(1400, easing = LinearEasing) else tween(0),153- label = "url-copy-drain",154- )155- val sheen by animateFloatAsState(156- targetValue = if (copied) 1f else 0f,157- animationSpec = if (animate) tween(600, easing = LinearEasing) else tween(0),158- label = "url-copy-sheen",159- )160- Box(161- Modifier162- .size(36.dp)163- .clip(RoundedCornerShape(6.dp))164- .background(PeachColors.S2)165- .clickable(onClick = onCopy)166- .drawBehind {167- if (animate && sheen < 1f) {168- val sweepX = (sheen * 2f - 0.5f) * size.width169- val band = size.width * 0.5f170- drawRect(171- brush = Brush.linearGradient(172- colors = listOf(Color.Transparent, accent.copy(alpha = 0.35f), Color.Transparent),173- start = Offset(sweepX - band, 0f),174- end = Offset(sweepX + band, size.height),175- ),176- )177- }178- if (drain > 0f) {179- val h = 2.dp.toPx()180- drawRect(181- color = accent,182- topLeft = Offset(0f, size.height - h),183- size = Size(size.width * drain, h),184- )185- }186- },187- contentAlignment = Alignment.Center,188- ) {189- Icon(190- if (copied) Icons.Rounded.Check else Icons.Rounded.ContentCopy,191- contentDescription = "copy",192- tint = if (copied) accent else PeachColors.T1,193- modifier = Modifier.size(15.dp),194- )195- }196-}app/drafts/E3/AdditionalUrlsEditor.kt+0 −119
@@ -1,119 +0,0 @@1-package com.peachpasswords.ui.vault2-3-import androidx.compose.foundation.background4-import androidx.compose.foundation.border5-import androidx.compose.foundation.clickable6-import androidx.compose.foundation.layout.Arrangement7-import androidx.compose.foundation.layout.Box8-import androidx.compose.foundation.layout.Column9-import androidx.compose.foundation.layout.Row10-import androidx.compose.foundation.layout.Spacer11-import androidx.compose.foundation.layout.fillMaxWidth12-import androidx.compose.foundation.layout.height13-import androidx.compose.foundation.layout.padding14-import androidx.compose.foundation.layout.width15-import androidx.compose.foundation.shape.RoundedCornerShape16-import androidx.compose.foundation.text.BasicTextField17-import androidx.compose.material3.Text18-import androidx.compose.runtime.Composable19-import androidx.compose.ui.Alignment20-import androidx.compose.ui.Modifier21-import androidx.compose.ui.draw.clip22-import androidx.compose.ui.graphics.Color23-import androidx.compose.ui.graphics.SolidColor24-import androidx.compose.ui.text.TextStyle25-import androidx.compose.ui.unit.dp26-import androidx.compose.ui.unit.sp27-import com.peachpasswords.ui.theme.LocalPeachAccent28-import com.peachpasswords.ui.theme.PeachColors29-import com.peachpasswords.ui.theme.PeachType30-31-/** E3 — hard cap on additional URLs, matching the spec. */32-const val MAX_ADDITIONAL_URLS = 533-34-/**35- * E3 — editor block for the additional-URLs list. Self-contained (mirrors the36- * underline `Field` style in EntryEditScreen) so it drops into the login branch37- * below the main `url` field without depending on the screen's private `Field`.38- *39- * Each row is an underlined input labeled "URL N" with an "×" remove control.40- * A ghost "+ add URL" affordance appends an empty entry; it disappears at the41- * cap and is replaced by the limit hint.42- */43-@Composable44-fun AdditionalUrlsEditor(45- urls: List<String>,46- onChange: (Int, String) -> Unit,47- onAdd: () -> Unit,48- onRemove: (Int) -> Unit,49-) {50- val accent = LocalPeachAccent.current51- Column(Modifier.fillMaxWidth()) {52- urls.forEachIndexed { index, value ->53- // Label numbering starts at 2 so it reads as a continuation of the54- // primary URL field (which is conceptually "URL 1").55- Column(Modifier.fillMaxWidth().padding(bottom = 14.dp)) {56- Text(57- "URL ${index + 2}",58- color = PeachColors.T1,59- fontFamily = PeachType.Mono,60- fontSize = 8.sp,61- )62- Spacer(Modifier.height(6.dp))63- Row(verticalAlignment = Alignment.CenterVertically) {64- Box(65- Modifier.weight(1f)66- .border(1.dp, PeachColors.T3, RoundedCornerShape(10.dp))67- .padding(horizontal = 12.dp, vertical = 12.dp),68- ) {69- BasicTextField(70- value = value,71- onValueChange = { onChange(index, it) },72- singleLine = true,73- textStyle = TextStyle(74- color = PeachColors.T0,75- fontFamily = PeachType.Mono,76- fontSize = 13.sp,77- ),78- cursorBrush = SolidColor(accent),79- modifier = Modifier.fillMaxWidth(),80- )81- }82- Spacer(Modifier.width(8.dp))83- Text(84- "×",85- color = PeachColors.T2,86- fontFamily = PeachType.Mono,87- fontSize = 16.sp,88- modifier = Modifier89- .clip(RoundedCornerShape(6.dp))90- .clickable { onRemove(index) }91- .padding(horizontal = 8.dp, vertical = 4.dp),92- )93- }94- }95- }96-97- if (urls.size < MAX_ADDITIONAL_URLS) {98- Text(99- "+ add URL",100- color = accent,101- fontFamily = PeachType.Mono,102- fontSize = 11.sp,103- modifier = Modifier104- .clip(RoundedCornerShape(6.dp))105- .clickable(onClick = onAdd)106- .padding(vertical = 4.dp),107- )108- Spacer(Modifier.height(14.dp))109- } else {110- Text(111- "Max $MAX_ADDITIONAL_URLS additional URLs",112- color = PeachColors.T2,113- fontFamily = PeachType.Mono,114- fontSize = 9.sp,115- )116- Spacer(Modifier.height(14.dp))117- }118- }119-}app/src/main/java/com/peachpasswords/ui/vault/AdditionalUrlsDetail.kt+197 −0
@@ -0,0 +1,197 @@1+package com.peachpasswords.ui.vault2+3+import android.content.ActivityNotFoundException4+import android.content.Context5+import android.content.Intent6+import android.net.Uri7+import android.widget.Toast8+import androidx.compose.animation.core.LinearEasing9+import androidx.compose.animation.core.animateFloatAsState10+import androidx.compose.animation.core.tween11+import androidx.compose.foundation.background12+import androidx.compose.foundation.clickable13+import androidx.compose.foundation.layout.Arrangement14+import androidx.compose.foundation.layout.Box15+import androidx.compose.foundation.layout.Column16+import androidx.compose.foundation.layout.Row17+import androidx.compose.foundation.layout.Spacer18+import androidx.compose.foundation.layout.fillMaxWidth19+import androidx.compose.foundation.layout.height20+import androidx.compose.foundation.layout.padding21+import androidx.compose.foundation.layout.size22+import androidx.compose.foundation.layout.width23+import androidx.compose.foundation.shape.RoundedCornerShape24+import androidx.compose.material.icons.Icons25+import androidx.compose.material.icons.automirrored.rounded.OpenInNew26+import androidx.compose.material.icons.rounded.Check27+import androidx.compose.material.icons.rounded.ContentCopy28+import androidx.compose.material3.Icon29+import androidx.compose.material3.Text30+import androidx.compose.runtime.Composable31+import androidx.compose.runtime.getValue32+import androidx.compose.ui.Alignment33+import androidx.compose.ui.Modifier34+import androidx.compose.ui.draw.clip35+import androidx.compose.ui.draw.drawBehind36+import androidx.compose.ui.geometry.Offset37+import androidx.compose.ui.geometry.Size38+import androidx.compose.ui.graphics.Brush39+import androidx.compose.ui.graphics.Color40+import androidx.compose.ui.platform.LocalContext41+import androidx.compose.ui.text.TextStyle42+import androidx.compose.ui.unit.dp43+import androidx.compose.ui.unit.em44+import androidx.compose.ui.unit.sp45+import com.peachpasswords.ui.theme.LocalPeachAccent46+import com.peachpasswords.ui.theme.LocalReduceMotion47+import com.peachpasswords.ui.theme.PeachColors48+import com.peachpasswords.ui.theme.PeachType49+50+/**51+ * E3 — additional-URL rows for EntryDetailScreen. Self-contained: it carries its52+ * own field shell, copy button, and open-in-browser control so it can be inserted53+ * into the detail field stack without touching the screen's private `FieldShell`54+ * / `CopyButton`. Each row shows "URL N", the value, copy, and open-in-browser.55+ *56+ * `copiedKeyFor(index)` is the per-row clipboard latch key the caller passes to57+ * `vm.copy(key, value)`; `copiedField` is the screen's current latch.58+ */59+@Composable60+fun AdditionalUrlRows(61+ urls: List<String>,62+ copiedField: String?,63+ onCopy: (key: String, value: String) -> Unit,64+) {65+ val context = LocalContext.current66+ urls.forEachIndexed { index, url ->67+ if (url.isNotBlank()) {68+ val key = additionalUrlCopyKey(index)69+ AdditionalUrlFieldShell(label = "URL ${index + 2}") {70+ Text(71+ url,72+ color = PeachColors.T0,73+ style = PeachType.bodyMono,74+ modifier = Modifier.weight(1f),75+ )76+ OpenInBrowserButton(onClick = { openUrlInBrowser(context, url) })77+ Spacer(Modifier.width(4.dp))78+ AdditionalUrlCopyButton(copied = copiedField == key, onCopy = { onCopy(key, url) })79+ }80+ }81+ }82+}83+84+/** Per-row clipboard latch key; keeps each URL's copy feedback independent. */85+fun additionalUrlCopyKey(index: Int): String = "additionalUrl:$index"86+87+/**88+ * Launches ACTION_VIEW for the URL, prefixing a scheme when the stored value is89+ * bare (so "example.com" still resolves). Falls back to a toast if no browser90+ * handles the intent.91+ */92+fun openUrlInBrowser(context: Context, raw: String) {93+ val normalized = if (raw.matches(Regex("^[a-zA-Z][a-zA-Z0-9+.-]*://.*"))) raw else "https://$raw"94+ try {95+ context.startActivity(96+ Intent(Intent.ACTION_VIEW, Uri.parse(normalized)).apply {97+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)98+ },99+ )100+ } catch (_: ActivityNotFoundException) {101+ Toast.makeText(context, "No app can open this link", Toast.LENGTH_SHORT).show()102+ }103+}104+105+/** Mirrors EntryDetailScreen's private FieldShell: mono label over a value/action row with a t3 hairline. */106+@Composable107+private fun AdditionalUrlFieldShell(108+ label: String,109+ content: @Composable androidx.compose.foundation.layout.RowScope.() -> Unit,110+) {111+ Column(112+ Modifier.fillMaxWidth().padding(vertical = 10.dp).drawBehind {113+ drawRect(114+ color = PeachColors.T3,115+ topLeft = Offset(0f, size.height - 1.dp.toPx()),116+ size = Size(size.width, 1.dp.toPx()),117+ )118+ },119+ ) {120+ Text(label.uppercase(), color = PeachColors.T2, style = PeachType.labelMono.copy(letterSpacing = 0.08.em))121+ Spacer(Modifier.height(6.dp))122+ Row(verticalAlignment = Alignment.CenterVertically, content = content)123+ }124+}125+126+@Composable127+private fun OpenInBrowserButton(onClick: () -> Unit) {128+ Box(129+ Modifier130+ .size(36.dp)131+ .clip(RoundedCornerShape(6.dp))132+ .background(PeachColors.S2)133+ .clickable(onClick = onClick),134+ contentAlignment = Alignment.Center,135+ ) {136+ Icon(137+ Icons.AutoMirrored.Rounded.OpenInNew,138+ contentDescription = "open in browser",139+ tint = PeachColors.T2,140+ modifier = Modifier.size(15.dp),141+ )142+ }143+}144+145+/** Mirrors EntryDetailScreen's private CopyButton (sheen sweep + drain bar, spec §4.4). */146+@Composable147+private fun AdditionalUrlCopyButton(copied: Boolean, onCopy: () -> Unit) {148+ val accent = LocalPeachAccent.current149+ val reduceMotion = LocalReduceMotion.current150+ val animate = copied && !reduceMotion151+ val drain by animateFloatAsState(152+ targetValue = if (copied) 1f else 0f,153+ animationSpec = if (animate) tween(1400, easing = LinearEasing) else tween(0),154+ label = "url-copy-drain",155+ )156+ val sheen by animateFloatAsState(157+ targetValue = if (copied) 1f else 0f,158+ animationSpec = if (animate) tween(600, easing = LinearEasing) else tween(0),159+ label = "url-copy-sheen",160+ )161+ Box(162+ Modifier163+ .size(36.dp)164+ .clip(RoundedCornerShape(6.dp))165+ .background(PeachColors.S2)166+ .clickable(onClick = onCopy)167+ .drawBehind {168+ if (animate && sheen < 1f) {169+ val sweepX = (sheen * 2f - 0.5f) * size.width170+ val band = size.width * 0.5f171+ drawRect(172+ brush = Brush.linearGradient(173+ colors = listOf(Color.Transparent, accent.copy(alpha = 0.35f), Color.Transparent),174+ start = Offset(sweepX - band, 0f),175+ end = Offset(sweepX + band, size.height),176+ ),177+ )178+ }179+ if (drain > 0f) {180+ val h = 2.dp.toPx()181+ drawRect(182+ color = accent,183+ topLeft = Offset(0f, size.height - h),184+ size = Size(size.width * drain, h),185+ )186+ }187+ },188+ contentAlignment = Alignment.Center,189+ ) {190+ Icon(191+ if (copied) Icons.Rounded.Check else Icons.Rounded.ContentCopy,192+ contentDescription = "copy",193+ tint = if (copied) accent else PeachColors.T1,194+ modifier = Modifier.size(15.dp),195+ )196+ }197+}app/src/main/java/com/peachpasswords/ui/vault/AdditionalUrlsEditor.kt+119 −0
@@ -0,0 +1,119 @@1+package com.peachpasswords.ui.vault2+3+import androidx.compose.foundation.background4+import androidx.compose.foundation.border5+import androidx.compose.foundation.clickable6+import androidx.compose.foundation.layout.Arrangement7+import androidx.compose.foundation.layout.Box8+import androidx.compose.foundation.layout.Column9+import androidx.compose.foundation.layout.Row10+import androidx.compose.foundation.layout.Spacer11+import androidx.compose.foundation.layout.fillMaxWidth12+import androidx.compose.foundation.layout.height13+import androidx.compose.foundation.layout.padding14+import androidx.compose.foundation.layout.width15+import androidx.compose.foundation.shape.RoundedCornerShape16+import androidx.compose.foundation.text.BasicTextField17+import androidx.compose.material3.Text18+import androidx.compose.runtime.Composable19+import androidx.compose.ui.Alignment20+import androidx.compose.ui.Modifier21+import androidx.compose.ui.draw.clip22+import androidx.compose.ui.graphics.Color23+import androidx.compose.ui.graphics.SolidColor24+import androidx.compose.ui.text.TextStyle25+import androidx.compose.ui.unit.dp26+import androidx.compose.ui.unit.sp27+import com.peachpasswords.ui.theme.LocalPeachAccent28+import com.peachpasswords.ui.theme.PeachColors29+import com.peachpasswords.ui.theme.PeachType30+31+/** E3 — hard cap on additional URLs, matching the spec. */32+const val MAX_ADDITIONAL_URLS = 533+34+/**35+ * E3 — editor block for the additional-URLs list. Self-contained (mirrors the36+ * underline `Field` style in EntryEditScreen) so it drops into the login branch37+ * below the main `url` field without depending on the screen's private `Field`.38+ *39+ * Each row is an underlined input labeled "URL N" with an "×" remove control.40+ * A ghost "+ add URL" affordance appends an empty entry; it disappears at the41+ * cap and is replaced by the limit hint.42+ */43+@Composable44+fun AdditionalUrlsEditor(45+ urls: List<String>,46+ onChange: (Int, String) -> Unit,47+ onAdd: () -> Unit,48+ onRemove: (Int) -> Unit,49+) {50+ val accent = LocalPeachAccent.current51+ Column(Modifier.fillMaxWidth()) {52+ urls.forEachIndexed { index, value ->53+ // Label numbering starts at 2 so it reads as a continuation of the54+ // primary URL field (which is conceptually "URL 1").55+ Column(Modifier.fillMaxWidth().padding(bottom = 14.dp)) {56+ Text(57+ "URL ${index + 2}",58+ color = PeachColors.T1,59+ fontFamily = PeachType.Mono,60+ fontSize = 8.sp,61+ )62+ Spacer(Modifier.height(6.dp))63+ Row(verticalAlignment = Alignment.CenterVertically) {64+ Box(65+ Modifier.weight(1f)66+ .border(1.dp, PeachColors.T3, RoundedCornerShape(10.dp))67+ .padding(horizontal = 12.dp, vertical = 12.dp),68+ ) {69+ BasicTextField(70+ value = value,71+ onValueChange = { onChange(index, it) },72+ singleLine = true,73+ textStyle = TextStyle(74+ color = PeachColors.T0,75+ fontFamily = PeachType.Mono,76+ fontSize = 13.sp,77+ ),78+ cursorBrush = SolidColor(accent),79+ modifier = Modifier.fillMaxWidth(),80+ )81+ }82+ Spacer(Modifier.width(8.dp))83+ Text(84+ "×",85+ color = PeachColors.T2,86+ fontFamily = PeachType.Mono,87+ fontSize = 16.sp,88+ modifier = Modifier89+ .clip(RoundedCornerShape(6.dp))90+ .clickable { onRemove(index) }91+ .padding(horizontal = 8.dp, vertical = 4.dp),92+ )93+ }94+ }95+ }96+97+ if (urls.size < MAX_ADDITIONAL_URLS) {98+ Text(99+ "+ add URL",100+ color = accent,101+ fontFamily = PeachType.Mono,102+ fontSize = 11.sp,103+ modifier = Modifier104+ .clip(RoundedCornerShape(6.dp))105+ .clickable(onClick = onAdd)106+ .padding(vertical = 4.dp),107+ )108+ Spacer(Modifier.height(14.dp))109+ } else {110+ Text(111+ "Max $MAX_ADDITIONAL_URLS additional URLs",112+ color = PeachColors.T2,113+ fontFamily = PeachType.Mono,114+ fontSize = 9.sp,115+ )116+ Spacer(Modifier.height(14.dp))117+ }118+ }119+}app/src/main/java/com/peachpasswords/ui/vault/EntryDetailScreen.kt+7 −0
@@ -226,6 +226,13 @@226226 e.email?.takeIf { it.isNotBlank() }?.let {227227 FieldRow("email", it, copiedField == "email") { vm.copy("email", it) }228228 }229+ e.additionalUrls?.takeIf { it.any { u -> u.isNotBlank() } }?.let { urls ->230+ AdditionalUrlRows(231+ urls = urls,232+ copiedField = copiedField,233+ onCopy = { key, value -> vm.copy(key, value) },234+ )235+ }229236 e.password?.takeIf { it.isNotBlank() }?.let { pw ->230237 PasswordRow(231238 value = pw,app/src/main/java/com/peachpasswords/ui/vault/EntryEditScreen.kt+6 −0
@@ -101,6 +101,12 @@101101 Field("title", f.title, vm::setTitle)102102 if (f.type == "login") {103103 Field("url", f.url, vm::setUrl)104+ AdditionalUrlsEditor(105+ urls = f.additionalUrls,106+ onChange = vm::setAdditionalUrl,107+ onAdd = vm::addAdditionalUrl,108+ onRemove = vm::removeAdditionalUrl,109+ )104110 IdentitySuggestField("username", f.username, usernameSuggestions, vm::setUsername)105111 IdentitySuggestField("email", f.email, usernameSuggestions, vm::setEmail)106112 PasswordField(app/src/main/java/com/peachpasswords/ui/vault/EntryEditViewModel.kt+18 −0
@@ -26,6 +26,7 @@2626 val email: String = "",2727 val password: String = "",2828 val url: String = "",29+ val additionalUrls: List<String> = emptyList(),2930 val totp: String = "",3031 val notes: String = "",3132 val cardNumber: String = "",@@ -67,6 +68,7 @@6768 email = it.email.orEmpty(),6869 password = it.password.orEmpty(),6970 url = it.url.orEmpty(),71+ additionalUrls = it.additionalUrls.orEmpty(),7072 totp = it.totp.orEmpty(),7173 notes = it.notes.orEmpty(),7274 cardNumber = CardFieldUtils.formatPan(it.cardNumber.orEmpty()),@@ -95,6 +97,16 @@9597 fun setEmail(v: String) = _form.update { it.copy(email = v) }9698 fun setPassword(v: String) = _form.update { it.copy(password = v) }9799 fun setUrl(v: String) = _form.update { it.copy(url = v) }100+ fun setAdditionalUrl(index: Int, v: String) = _form.update { form ->101+ form.copy(additionalUrls = form.additionalUrls.toMutableList().also { it[index] = v })102+ }103+ fun addAdditionalUrl() = _form.update { form ->104+ if (form.additionalUrls.size >= MAX_ADDITIONAL_URLS) form105+ else form.copy(additionalUrls = form.additionalUrls + "")106+ }107+ fun removeAdditionalUrl(index: Int) = _form.update { form ->108+ form.copy(additionalUrls = form.additionalUrls.toMutableList().also { it.removeAt(index) })109+ }98110 fun setTotp(v: String) = _form.update { it.copy(totp = v) }99111 fun setNotes(v: String) = _form.update { it.copy(notes = v) }100112 fun setCardNumber(v: String) = _form.update {@@ -169,6 +181,9 @@169181 email = f.email.ifBlank { null },170182 password = f.password.ifBlank { null },171183 url = f.url.ifBlank { null },184+ additionalUrls = f.additionalUrls185+ .map { it.trim() }.filter { it.isNotBlank() }186+ .ifEmpty { null },172187 totp = f.totp.ifBlank { null },173188 notes = f.notes.ifBlank { null },174189 cardNumber = f.cardNumber.filter { it.isDigit() }.ifBlank { null },@@ -189,6 +204,9 @@189204 email = f.email.ifBlank { null },190205 password = f.password.ifBlank { null },191206 url = f.url.ifBlank { null },207+ additionalUrls = f.additionalUrls208+ .map { it.trim() }.filter { it.isNotBlank() }209+ .ifEmpty { null },192210 totp = f.totp.ifBlank { null },193211 notes = f.notes.ifBlank { null },194212 cardNumber = f.cardNumber.filter { it.isDigit() }.ifBlank { null },