@@ -77,16 +77,21 @@ fun PoisonPillPinCreationDialog(
7777 // PIN input
7878 OutlinedTextField (
7979 value = pin,
80- onValueChange = {
81- if (it.length <= uiState.pinSize.max() && it.all { char -> char.isDigit() }) {
82- pin = it
80+ onValueChange = { newPin ->
81+ val isValid = if (uiState.alphanumericPinEnabled) {
82+ newPin.all { char -> char.isLetterOrDigit() }
83+ } else {
84+ newPin.all { char -> char.isDigit() }
85+ }
86+ if (newPin.length <= uiState.pinSize.max() && isValid) {
87+ pin = newPin
8388 showError = null
8489 }
8590 },
8691 label = { Text (stringResource(R .string.pin_creation_hint)) },
8792 visualTransformation = PasswordVisualTransformation (),
8893 keyboardOptions = KeyboardOptions (
89- keyboardType = KeyboardType .NumberPassword ,
94+ keyboardType = if (uiState.alphanumericPinEnabled) KeyboardType . Password else KeyboardType .NumberPassword ,
9095 imeAction = ImeAction .Next
9196 ),
9297 singleLine = true ,
@@ -98,16 +103,21 @@ fun PoisonPillPinCreationDialog(
98103 // Confirm PIN input
99104 OutlinedTextField (
100105 value = confirmPin,
101- onValueChange = {
102- if (it.length <= uiState.pinSize.max() && it.all { char -> char.isDigit() }) {
103- confirmPin = it
106+ onValueChange = { newConfirmPin ->
107+ val isValid = if (uiState.alphanumericPinEnabled) {
108+ newConfirmPin.all { char -> char.isLetterOrDigit() }
109+ } else {
110+ newConfirmPin.all { char -> char.isDigit() }
111+ }
112+ if (newConfirmPin.length <= uiState.pinSize.max() && isValid) {
113+ confirmPin = newConfirmPin
104114 showError = null
105115 }
106116 },
107117 label = { Text (stringResource(R .string.pin_creation_confirm_hint)) },
108118 visualTransformation = PasswordVisualTransformation (),
109119 keyboardOptions = KeyboardOptions (
110- keyboardType = KeyboardType .NumberPassword ,
120+ keyboardType = if (uiState.alphanumericPinEnabled) KeyboardType . Password else KeyboardType .NumberPassword ,
111121 imeAction = ImeAction .Done
112122 ),
113123 singleLine = true ,
@@ -158,4 +168,4 @@ fun PoisonPillPinCreationDialog(
158168 }
159169 }
160170 }
161- }
171+ }
0 commit comments