aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-10-08 18:28:04 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-10-08 18:28:04 +0530
commit9bdbd552049d845383675c35c1323372d46a37b9 (patch)
tree29957a8e385f1fcd2cb78cff31f0b11051780d09 /app/src/main
parent662be13ab5883e7a22003ad94f0c85fbc3d142d2 (diff)
feat(ui-compose): add a `PasswordField` composable and switch decrypt screen to it
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/app/passwordstore/ui/crypto/DecryptScreen.kt11
1 files changed, 3 insertions, 8 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/crypto/DecryptScreen.kt b/app/src/main/java/app/passwordstore/ui/crypto/DecryptScreen.kt
index 41687985..3dc2a401 100644
--- a/app/src/main/java/app/passwordstore/ui/crypto/DecryptScreen.kt
+++ b/app/src/main/java/app/passwordstore/ui/crypto/DecryptScreen.kt
@@ -24,6 +24,7 @@ import androidx.compose.ui.unit.dp
import app.passwordstore.R
import app.passwordstore.data.passfile.PasswordEntry
import app.passwordstore.ui.APSAppBar
+import app.passwordstore.ui.compose.PasswordField
import app.passwordstore.ui.compose.theme.APSThemePreview
import app.passwordstore.util.time.UserClock
import app.passwordstore.util.totp.UriTotpFinder
@@ -56,13 +57,7 @@ fun PasswordEntryScreen(
style = MaterialTheme.typography.headlineSmall,
)
if (entry.password != null) {
- TextField(
- value = entry.password!!,
- onValueChange = {},
- readOnly = true,
- label = { Text("Password") },
- trailingIcon = { CopyButton { clipboard.setText(AnnotatedString(entry.password!!)) } },
- )
+ PasswordField(value = entry.password!!, label = "Password", initialVisibility = false)
}
if (entry.hasTotp()) {
val totp by entry.totp.collectAsState(runBlocking { entry.totp.first() })
@@ -97,7 +92,7 @@ private fun PasswordEntryPreview() {
APSThemePreview { PasswordEntryScreen("Test Entry", createTestEntry()) }
}
-fun createTestEntry() =
+private fun createTestEntry() =
PasswordEntry(
UserClock(),
UriTotpFinder(),