Updated EnterTanDialog for Decoupled TAN methods
This commit is contained in:
parent
55dec76f36
commit
3eb3c488da
|
@ -36,6 +36,8 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
|
|||
|
||||
val challenge = tanChallengeReceived.tanChallenge
|
||||
|
||||
val isNotADecoupledTanMethod = !!!challenge.selectedTanMethod.type.isDecoupledMethod
|
||||
|
||||
var showTanMethodsDropDownMenu by remember { mutableStateOf(false) }
|
||||
var showTanMediaDropDownMenu by remember { mutableStateOf(false) }
|
||||
|
||||
|
@ -48,6 +50,12 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
|
|||
var enteredTan by remember { mutableStateOf("") }
|
||||
|
||||
|
||||
if (!!!isNotADecoupledTanMethod) {
|
||||
challenge.addUserApprovedDecoupledTanCallback {
|
||||
onDismiss()
|
||||
}
|
||||
}
|
||||
|
||||
fun confirmCalled() {
|
||||
if (enteredTan.length > 2) {
|
||||
tanChallengeReceived.callback(EnterTanResult(enteredTan))
|
||||
|
@ -59,7 +67,9 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
|
|||
BaseDialog(
|
||||
title = "TAN Eingabe",
|
||||
useMoreThanPlatformDefaultWidthOnMobile = true,
|
||||
confirmButtonEnabled = enteredTan.length > 2,
|
||||
confirmButtonTitle = if (isNotADecoupledTanMethod) "OK" else "",
|
||||
confirmButtonEnabled = enteredTan.length > 2 && isNotADecoupledTanMethod,
|
||||
showProgressIndicatorOnConfirmButton = !!!isNotADecoupledTanMethod,
|
||||
onConfirm = { confirmCalled() },
|
||||
onDismiss = {
|
||||
tanChallengeReceived.callback(EnterTanResult(null))
|
||||
|
@ -71,7 +81,7 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
|
|||
Row {
|
||||
BankIcon(challenge.user, Modifier.padding(end = 6.dp))
|
||||
|
||||
Text("${challenge.user.displayName}, Nutzer ${challenge.user.loginName}${challenge.account?.let { ", Konto ${it.productName ?: it.identifier}" } ?: ""}")
|
||||
Text("${challenge.user.bankName}, Nutzer ${challenge.user.loginName}${challenge.account?.let { ", Konto ${it.productName ?: it.identifier}" } ?: ""}")
|
||||
}
|
||||
Text(
|
||||
"TAN benötigt ${Internationalization.getTextForActionRequiringTan(challenge.forAction)}",
|
||||
|
@ -173,25 +183,32 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
|
|||
Text(challenge.messageToShowToUser)
|
||||
}
|
||||
|
||||
|
||||
Column(Modifier.fillMaxWidth().padding(top = 16.dp)) {
|
||||
OutlinedTextField(
|
||||
value = enteredTan,
|
||||
onValueChange = { enteredTan = it },
|
||||
label = { Text("TAN eingeben") },
|
||||
modifier = Modifier.fillMaxWidth().focusRequester(textFieldFocus),
|
||||
keyboardOptions = KeyboardOptions(
|
||||
autoCorrect = false,
|
||||
keyboardType = if (challenge.selectedTanMethod.allowedTanFormat == AllowedTanFormat.Numeric) KeyboardType.Number else KeyboardType.Text
|
||||
),
|
||||
onEnterPressed = { confirmCalled() }
|
||||
)
|
||||
if (isNotADecoupledTanMethod) {
|
||||
OutlinedTextField(
|
||||
value = enteredTan,
|
||||
onValueChange = { enteredTan = it },
|
||||
label = { Text("TAN eingeben") },
|
||||
modifier = Modifier.fillMaxWidth().focusRequester(textFieldFocus),
|
||||
keyboardOptions = KeyboardOptions(
|
||||
autoCorrect = false,
|
||||
keyboardType = if (challenge.selectedTanMethod.allowedTanFormat == AllowedTanFormat.Numeric) KeyboardType.Number else KeyboardType.Text
|
||||
),
|
||||
onEnterPressed = { confirmCalled() }
|
||||
)
|
||||
} else {
|
||||
Text("Sobald sie die TAN in Ihrer App freigegeben haben, wird der Dialog automatisch geschlossen.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LaunchedEffect(textFieldFocus) {
|
||||
textFieldFocus.requestFocus()
|
||||
if (isNotADecoupledTanMethod) {
|
||||
LaunchedEffect(textFieldFocus) {
|
||||
textFieldFocus.requestFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue