Implemented showing select TAN media view only if there is more than one TAN medium for this TAN procedure
This commit is contained in:
parent
51c7a9f098
commit
f7f6e7703b
|
@ -122,31 +122,33 @@ open class EnterTanDialog : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun setupSelectTanMediumView(rootView: View) {
|
protected open fun setupSelectTanMediumView(rootView: View) {
|
||||||
rootView.lytTanMedium.visibility = View.VISIBLE
|
val tanMediaForTanProcedure = presenter.getTanMediaForTanProcedure(customer, tanChallenge.tanProcedure)
|
||||||
|
|
||||||
tanMediumAdapter.setItems(customer.tanMediaSorted)
|
if (tanMediaForTanProcedure.size > 1) {
|
||||||
|
rootView.lytTanMedium.visibility = View.VISIBLE
|
||||||
|
|
||||||
rootView.spnTanMedium.adapter = tanMediumAdapter
|
tanMediumAdapter.setItems(customer.tanMediaSorted)
|
||||||
rootView.spnTanMedium.onItemSelectedListener = ListItemSelectedListener(tanMediumAdapter) { selectedTanMedium ->
|
|
||||||
// TODO: implement logic to change a mobile phone as TAN medium
|
rootView.spnTanMedium.adapter = tanMediumAdapter
|
||||||
if (selectedTanMedium.status != TanMediumStatus.Used) {
|
rootView.spnTanMedium.onItemSelectedListener = ListItemSelectedListener(tanMediumAdapter) { selectedTanMedium ->
|
||||||
(selectedTanMedium as? TanGeneratorTanMedium)?.let { tanGeneratorTanMedium ->
|
// TODO: implement logic to change a mobile phone as TAN medium
|
||||||
tanEnteredCallback(EnterTanResult.userAsksToChangeTanMedium(tanGeneratorTanMedium) { response ->
|
if (selectedTanMedium.status != TanMediumStatus.Used) {
|
||||||
handleChangeTanMediumResponse(selectedTanMedium, response)
|
(selectedTanMedium as? TanGeneratorTanMedium)?.let { tanGeneratorTanMedium ->
|
||||||
})
|
tanEnteredCallback(EnterTanResult.userAsksToChangeTanMedium(tanGeneratorTanMedium) { response ->
|
||||||
// TODO: find a way to update account.tanMedia afterwards
|
handleChangeTanMediumResponse(selectedTanMedium, response)
|
||||||
|
})
|
||||||
|
// TODO: find a way to update account.tanMedia afterwards
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: ensure that only TanGeneratorTanMedium instances get added to spinner?
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: ensure that only TanGeneratorTanMedium instances get added to spinner?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue