Not displaying USB TAN procedures anymore (either Android nor JavaFX app supports USB)

This commit is contained in:
dankito 2020-04-29 22:16:53 +02:00
parent b18cd322e0
commit 4d64bc79bf
2 changed files with 8 additions and 4 deletions

View File

@ -31,7 +31,9 @@ open class EnterTanDialog(
protected val dialogService = JavaFxDialogService() protected val dialogService = JavaFxDialogService()
protected val selectedTanProcedure = SimpleObjectProperty<TanProcedure>(account.selectedTanProcedure ?: account.supportedTanProcedures.firstOrNull()) protected val tanProceduresWithoutUnsupported = account.supportedTanProcedures.filterNot { it.displayName.contains("usb", true) } // USB tan generators are not supported
protected val selectedTanProcedure = SimpleObjectProperty<TanProcedure>(account.selectedTanProcedure ?: tanProceduresWithoutUnsupported.firstOrNull { it.displayName.contains("manuell", true) == false } ?: tanProceduresWithoutUnsupported.firstOrNull())
protected val selectedTanMedium = SimpleObjectProperty<TanMedium>(account.tanMediaSorted.firstOrNull()) protected val selectedTanMedium = SimpleObjectProperty<TanMedium>(account.tanMediaSorted.firstOrNull())
@ -61,7 +63,7 @@ open class EnterTanDialog(
form { form {
fieldset { fieldset {
field(messages["enter.tan.dialog.select.tan.procedure"]) { field(messages["enter.tan.dialog.select.tan.procedure"]) {
combobox(selectedTanProcedure, account.supportedTanProcedures) { combobox(selectedTanProcedure, tanProceduresWithoutUnsupported) {
cellFormat { cellFormat {
text = it.displayName text = it.displayName
} }

View File

@ -89,13 +89,15 @@ open class EnterTanDialog : DialogFragment() {
protected open fun setupSelectTanProcedureView(rootView: View) { protected open fun setupSelectTanProcedureView(rootView: View) {
val adapter = TanProceduresAdapter() val adapter = TanProceduresAdapter()
adapter.setItems(account.supportedTanProcedures) val tanProceduresWithoutUnsupported = account.supportedTanProcedures.filterNot { it.displayName.contains("usb", true) } // USB tan generators are not supported on Android
adapter.setItems(tanProceduresWithoutUnsupported)
rootView.findViewById<Spinner>(R.id.spnTanProcedures)?.let { spinner -> rootView.findViewById<Spinner>(R.id.spnTanProcedures)?.let { spinner ->
spinner.adapter = adapter spinner.adapter = adapter
val selectedTanProcedure = account.selectedTanProcedure val selectedTanProcedure = account.selectedTanProcedure
?: account.supportedTanProcedures.firstOrNull() ?: tanProceduresWithoutUnsupported.filter { it.displayName.contains("manuell") == false && it.displayName.contains("usb") == false }.firstOrNull()
?: tanProceduresWithoutUnsupported.firstOrNull()
selectedTanProcedure?.let { spinner.setSelection(adapter.getItems().indexOf(selectedTanProcedure)) } selectedTanProcedure?.let { spinner.setSelection(adapter.getItems().indexOf(selectedTanProcedure)) }
spinner.onItemSelectedListener = ListItemSelectedListener(adapter) { newSelectedTanProcedure -> spinner.onItemSelectedListener = ListItemSelectedListener(adapter) { newSelectedTanProcedure ->