From 6a5dd98d8d42476baf71f33f9174fde71e20f061 Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 1 Sep 2024 19:15:33 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20hiding=20password=20even=20when=20"Hinz?= =?UTF-8?q?uf=C3=BCgen"=20button=20gets=20clicked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/codinux/banking/ui/dialogs/AddAccountDialog.kt | 2 +- .../net/codinux/banking/ui/forms/PasswordTextField.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt index b9e8c60..0117577 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt @@ -110,7 +110,7 @@ fun AddAccountDialog( Spacer(modifier = Modifier.height(12.dp)) - PasswordTextField(password, onChange = { password = it }, onEnterPressed = { confirmCalled() }) + PasswordTextField(password, forceHidePassword = if (isAddingAccount) true else null, onChange = { password = it }, onEnterPressed = { confirmCalled() }) Spacer(modifier = Modifier.height(16.dp)) } diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/PasswordTextField.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/PasswordTextField.kt index 270e54d..0c10d87 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/PasswordTextField.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/PasswordTextField.kt @@ -22,6 +22,10 @@ fun PasswordTextField(password: String = "", label: String = "Passwort", onEnter var passwordVisible by remember { mutableStateOf(false) } + if (forceHidePassword != null) { + passwordVisible = !!!forceHidePassword + } + OutlinedTextField( value = password, onValueChange = { onChange(it) }, @@ -41,10 +45,6 @@ fun PasswordTextField(password: String = "", label: String = "Passwort", onEnter ) }, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), - onEnterPressed = { - passwordVisible = false // actually only senseful for AddAccountDialog so that password isn't visible during (long) communication process with bank server - - onEnterPressed?.invoke() - } + onEnterPressed = onEnterPressed ) } \ No newline at end of file