diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-02 23:30:37 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-02 23:30:37 +0100 |
| commit | 22bb0aae958e8458274be994f3e679cb226d2241 (patch) | |
| tree | df00014e469ccc1a06648283284b38b5ea0eb08f /ui/compose/src | |
| parent | 5bea3821864212de67dc3bfc1299ec8b12134213 (diff) | |
| download | HardenedPass-22bb0aae958e8458274be994f3e679cb226d2241.tar.gz HardenedPass-22bb0aae958e8458274be994f3e679cb226d2241.zip | |
feat(app): add the Compose entry screen
Header with avatar, name and folder; password, username and one-time
code with a countdown bar in the first group; extra fields in the second.
FieldRow can start revealed (the "Show the password" setting) and shows
masked values in JetBrains Mono, as the old screen did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'ui/compose/src')
| -rw-r--r-- | ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt index c49ec2bc..e632acc1 100644 --- a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt +++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/FieldRow.kt @@ -21,6 +21,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily import app.passwordstore.ui.compose.preview.ThemePreviews import app.passwordstore.ui.compose.theme.APSTheme import app.passwordstore.ui.compose.theme.SpacingLarge @@ -29,9 +31,12 @@ import app.passwordstore.ui.compose.theme.SpacingMedium /** Content descriptions for [FieldRow]'s buttons, supplied by the app's translated strings. */ public data class FieldRowLabels(val copy: String, val show: String, val hide: String) +/** Masked values (passwords) use a monospace face, so 0 and O, l and 1 stay apart. */ +private val Monospace = FontFamily(Font(R.font.jetbrainsmono_nl_regular)) + /** * A labelled value with an optional copy button. When [masked] is true the value is hidden behind - * dots until the reveal toggle is pressed. + * dots until the reveal toggle is pressed, unless [initiallyRevealed] shows it from the start. */ @Composable public fun FieldRow( @@ -40,9 +45,10 @@ public fun FieldRow( labels: FieldRowLabels, modifier: Modifier = Modifier, masked: Boolean = false, + initiallyRevealed: Boolean = false, onCopy: (() -> Unit)? = null, ) { - var revealed by rememberSaveable { mutableStateOf(false) } + var revealed by rememberSaveable { mutableStateOf(initiallyRevealed) } Row( modifier .fillMaxWidth() @@ -60,9 +66,10 @@ public fun FieldRow( style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, ) + val style = MaterialTheme.typography.bodyLarge Text( if (masked && !revealed) "•".repeat(10) else value, - style = MaterialTheme.typography.bodyLarge, + style = if (masked) style.copy(fontFamily = Monospace) else style, ) } if (masked) |
