Implemented showing select TAN media view only if there is more than one TAN medium for this TAN procedure

This commit is contained in:
dankito 2020-09-10 00:41:52 +02:00
parent 51c7a9f098
commit f7f6e7703b
2 changed files with 34 additions and 20 deletions

View File

@ -122,6 +122,9 @@ open class EnterTanDialog : DialogFragment() {
} }
protected open fun setupSelectTanMediumView(rootView: View) { protected open fun setupSelectTanMediumView(rootView: View) {
val tanMediaForTanProcedure = presenter.getTanMediaForTanProcedure(customer, tanChallenge.tanProcedure)
if (tanMediaForTanProcedure.size > 1) {
rootView.lytTanMedium.visibility = View.VISIBLE rootView.lytTanMedium.visibility = View.VISIBLE
tanMediumAdapter.setItems(customer.tanMediaSorted) tanMediumAdapter.setItems(customer.tanMediaSorted)
@ -141,12 +144,11 @@ open class EnterTanDialog : DialogFragment() {
} }
} }
} }
}
protected open fun setupTanView(rootView: View) { protected open fun setupTanView(rootView: View) {
if (OpticalTanProcedures.contains(tanChallenge.tanProcedure.type)) { if (OpticalTanProcedures.contains(tanChallenge.tanProcedure.type)) {
if (customer.tanMedia.isNotEmpty()) {
setupSelectTanMediumView(rootView) setupSelectTanMediumView(rootView)
}
if (tanChallenge is FlickerCodeTanChallenge) { if (tanChallenge is FlickerCodeTanChallenge) {
setupFlickerCodeTanView(rootView) setupFlickerCodeTanView(rootView)

View File

@ -10,10 +10,6 @@ import net.dankito.banking.ui.model.parameters.TransferMoneyData
import net.dankito.banking.ui.model.responses.AddAccountResponse import net.dankito.banking.ui.model.responses.AddAccountResponse
import net.dankito.banking.ui.model.responses.BankingClientResponse import net.dankito.banking.ui.model.responses.BankingClientResponse
import net.dankito.banking.ui.model.responses.GetTransactionsResponse import net.dankito.banking.ui.model.responses.GetTransactionsResponse
import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult
import net.dankito.banking.ui.model.tan.EnterTanResult
import net.dankito.banking.ui.model.tan.TanChallenge
import net.dankito.banking.ui.model.tan.TanGeneratorTanMedium
import net.dankito.banking.bankfinder.IBankFinder import net.dankito.banking.bankfinder.IBankFinder
import net.dankito.banking.bankfinder.BankInfo import net.dankito.banking.bankfinder.BankInfo
import net.dankito.banking.search.IRemitteeSearcher import net.dankito.banking.search.IRemitteeSearcher
@ -23,6 +19,7 @@ import net.dankito.banking.ui.model.moneytransfer.ExtractTransferMoneyDataFromPd
import net.dankito.banking.ui.model.moneytransfer.ExtractTransferMoneyDataFromPdfResultType import net.dankito.banking.ui.model.moneytransfer.ExtractTransferMoneyDataFromPdfResultType
import net.dankito.banking.ui.model.parameters.GetTransactionsParameter import net.dankito.banking.ui.model.parameters.GetTransactionsParameter
import net.dankito.banking.ui.model.settings.AppSettings import net.dankito.banking.ui.model.settings.AppSettings
import net.dankito.banking.ui.model.tan.*
import net.dankito.banking.util.* import net.dankito.banking.util.*
import net.dankito.banking.util.extraction.IInvoiceDataExtractor import net.dankito.banking.util.extraction.IInvoiceDataExtractor
import net.dankito.banking.util.extraction.ITextExtractorRegistry import net.dankito.banking.util.extraction.ITextExtractorRegistry
@ -48,6 +45,9 @@ open class BankingPresenter(
) { ) {
companion object { companion object {
val ChipTanTanProcedures = listOf(TanProcedureType.ChipTanManuell, TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanUsb,
TanProcedureType.ChipTanQrCode, TanProcedureType.ChipTanPhotoTanMatrixCode)
protected const val OneDayMillis = 24 * 60 * 60 * 1000 protected const val OneDayMillis = 24 * 60 * 60 * 1000
protected val MessageLogEntryDateFormatter = DateFormatter("yyyy.MM.dd HH:mm:ss.SSS") protected val MessageLogEntryDateFormatter = DateFormatter("yyyy.MM.dd HH:mm:ss.SSS")
@ -677,6 +677,18 @@ open class BankingPresenter(
} }
open fun getTanMediaForTanProcedure(bank: Customer, tanProcedure: TanProcedure): List<TanMedium> {
if (ChipTanTanProcedures.contains(tanProcedure.type)) {
return bank.tanMediaSorted.filterIsInstance<TanGeneratorTanMedium>()
}
else if (tanProcedure.type == TanProcedureType.SmsTan) {
return bank.tanMediaSorted.filterIsInstance<MobilePhoneTanMedium>()
}
return listOf()
}
var appSettings: AppSettings = AppSettings() var appSettings: AppSettings = AppSettings()
protected set protected set