Fixed hiding password even when "Hinzufügen" button gets clicked

This commit is contained in:
dankito 2024-09-01 19:15:33 +02:00
parent 72bc20ebd1
commit 6a5dd98d8d
2 changed files with 6 additions and 6 deletions

View File

@ -110,7 +110,7 @@ fun AddAccountDialog(
Spacer(modifier = Modifier.height(12.dp)) 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)) Spacer(modifier = Modifier.height(16.dp))
} }

View File

@ -22,6 +22,10 @@ fun PasswordTextField(password: String = "", label: String = "Passwort", onEnter
var passwordVisible by remember { mutableStateOf(false) } var passwordVisible by remember { mutableStateOf(false) }
if (forceHidePassword != null) {
passwordVisible = !!!forceHidePassword
}
OutlinedTextField( OutlinedTextField(
value = password, value = password,
onValueChange = { onChange(it) }, onValueChange = { onChange(it) },
@ -41,10 +45,6 @@ fun PasswordTextField(password: String = "", label: String = "Passwort", onEnter
) )
}, },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
onEnterPressed = { onEnterPressed = onEnterPressed
passwordVisible = false // actually only senseful for AddAccountDialog so that password isn't visible during (long) communication process with bank server
onEnterPressed?.invoke()
}
) )
} }