Using now new TanMedium.displayName property

This commit is contained in:
dankito 2024-09-04 00:29:45 +02:00
parent d3d90d4737
commit ea34567354
1 changed files with 3 additions and 15 deletions

View File

@ -121,12 +121,12 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
Row(Modifier.padding(top = 16.dp)) {
ExposedDropdownMenuBox(showTanMediaDropDownMenu, { isExpanded -> showTanMediaDropDownMenu = isExpanded }, Modifier.fillMaxWidth()) {
OutlinedTextField(
value = challenge.selectedTanMedium?.let { getTanMediumDisplayName(it) } ?: "<Keines ausgewählt>",
value = challenge.selectedTanMedium?.let { it.displayName } ?: "<Keines ausgewählt>",
onValueChange = { Log.info { "TanMedia value changed: $it" }},
modifier = Modifier.fillMaxWidth(),
label = { Text("TAN Medium") },
readOnly = true,
trailingIcon = { Icon(Icons.Filled.ArrowDropDown, "Alle TAN Verfahren anzeigen") }
trailingIcon = { Icon(Icons.Filled.ArrowDropDown, "Alle TAN Medien anzeigen") }
)
ExposedDropdownMenu(showTanMediaDropDownMenu, { showTanMediaDropDownMenu = false }) {
@ -138,7 +138,7 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
// TODO: change TanMethod
}
) {
Text(getTanMediumDisplayName(tanMedium))
Text(tanMedium.displayName)
}
}
}
@ -210,16 +210,4 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
textFieldFocus.requestFocus()
}
}
}
fun getTanMediumDisplayName(tanMedium: net.codinux.banking.client.model.tan.TanMedium): String {
tanMedium.tanGenerator?.let { tanGenerator ->
return "${tanMedium.mediumName} ${tanGenerator.cardNumber}"
}
tanMedium.mobilePhone?.let { mobilePhone ->
return "${tanMedium.mediumName} ${mobilePhone.concealedPhoneNumber ?: mobilePhone.phoneNumber}"
}
return tanMedium.mediumName ?: ""
}