From ea34567354cbd7b766a302a01a1dec2ce8a15d91 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 4 Sep 2024 00:29:45 +0200 Subject: [PATCH] Using now new TanMedium.displayName property --- .../banking/ui/dialogs/EnterTanDialog.kt | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/EnterTanDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/EnterTanDialog.kt index c96f10a..829f9c9 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/EnterTanDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/EnterTanDialog.kt @@ -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) } ?: "", + value = challenge.selectedTanMedium?.let { it.displayName } ?: "", 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 ?: "" } \ No newline at end of file