diff --git a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/CustomerEntity.kt b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/CustomerEntity.kt index 06fad9f9..d6812c19 100644 --- a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/CustomerEntity.kt +++ b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/CustomerEntity.kt @@ -3,7 +3,7 @@ package net.dankito.banking.persistence.model import com.fasterxml.jackson.annotation.* import net.dankito.banking.ui.model.ICustomer import net.dankito.banking.ui.model.tan.TanMedium -import net.dankito.banking.ui.model.tan.TanProcedure +import net.dankito.banking.ui.model.tan.TanMethod import java.util.* @@ -20,8 +20,8 @@ open class CustomerEntity( override var userId: String = customerId, override var iconUrl: String? = null, override var accounts: List = listOf(), - override var supportedTanProcedures: List = listOf(), - override var selectedTanProcedure: TanProcedure? = null, + override var supportedTanMethods: List = listOf(), + override var selectedTanMethod: TanMethod? = null, override var tanMedia: List = listOf(), override var countDaysForWhichTransactionsAreKept: Int? = null, override var technicalId: String = UUID.randomUUID().toString(), diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanProceduresAdapter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanMethodsAdapter.kt similarity index 59% rename from ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanProceduresAdapter.kt rename to ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanMethodsAdapter.kt index 1e137181..4be49be7 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanProceduresAdapter.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/TanMethodsAdapter.kt @@ -4,20 +4,20 @@ import android.view.View import android.view.ViewGroup import android.widget.TextView import net.dankito.banking.ui.android.R -import net.dankito.banking.ui.model.tan.TanProcedure +import net.dankito.banking.ui.model.tan.TanMethod import net.dankito.utils.android.extensions.asActivity import net.dankito.utils.android.ui.adapter.ListAdapter -open class TanProceduresAdapter : ListAdapter() { +open class TanMethodsAdapter : ListAdapter() { override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View? { - val procedure = getItem(position) + val method = getItem(position) val view = convertView ?: parent?.context?.asActivity()?.layoutInflater?.inflate( - R.layout.list_item_tan_procedure, parent, false) + R.layout.list_item_tan_method, parent, false) - view?.findViewById(R.id.txtTanProcedureDisplayName)?.text = procedure.displayName + view?.findViewById(R.id.txtTanMethodDisplayName)?.text = method.displayName return view } diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt index e4dbc557..d760abfa 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/EnterTanDialog.kt @@ -18,7 +18,7 @@ import kotlinx.android.synthetic.main.dialog_enter_tan.view.* import kotlinx.android.synthetic.main.view_collapsible_text.view.* import net.dankito.banking.ui.android.R import net.dankito.banking.ui.android.adapter.TanMediumAdapter -import net.dankito.banking.ui.android.adapter.TanProceduresAdapter +import net.dankito.banking.ui.android.adapter.TanMethodsAdapter import net.dankito.banking.ui.android.di.BankingComponent import net.dankito.banking.ui.android.listener.ListItemSelectedListener import net.dankito.banking.ui.model.TypedCustomer @@ -32,10 +32,10 @@ import javax.inject.Inject open class EnterTanDialog : DialogFragment() { companion object { - val QrCodeTanProcedures = listOf(TanProcedureType.ChipTanQrCode, TanProcedureType.QrCode) + val QrCodeTanMethods = listOf(TanMethodType.ChipTanQrCode, TanMethodType.QrCode) - val OpticalTanProcedures = listOf(TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanQrCode, - TanProcedureType.ChipTanPhotoTanMatrixCode, TanProcedureType.photoTan, TanProcedureType.QrCode) + val OpticalTanMethods = listOf(TanMethodType.ChipTanFlickercode, TanMethodType.ChipTanQrCode, + TanMethodType.ChipTanPhotoTanMatrixCode, TanMethodType.photoTan, TanMethodType.QrCode) const val DialogTag = "EnterTanDialog" } @@ -82,7 +82,7 @@ open class EnterTanDialog : DialogFragment() { } protected open fun setupUI(rootView: View) { - setupSelectTanProcedureView(rootView) + setupSelectTanMethodView(rootView) setupTanView(rootView) @@ -95,23 +95,23 @@ open class EnterTanDialog : DialogFragment() { rootView.btnEnteringTanDone.setOnClickListener { enteringTanDone(rootView.edtxtEnteredTan.text.toString()) } } - protected open fun setupSelectTanProcedureView(rootView: View) { - val adapter = TanProceduresAdapter() - val tanProceduresWithoutUnsupported = customer.supportedTanProcedures.filterNot { it.type == TanProcedureType.ChipTanUsb } // USB tan generators are not supported on Android - adapter.setItems(tanProceduresWithoutUnsupported) + protected open fun setupSelectTanMethodView(rootView: View) { + val adapter = TanMethodsAdapter() + val tanMethodsWithoutUnsupported = customer.supportedTanMethods.filterNot { it.type == TanMethodType.ChipTanUsb } // USB tan generators are not supported on Android + adapter.setItems(tanMethodsWithoutUnsupported) - rootView.findViewById(R.id.spnTanProcedures)?.let { spinner -> + rootView.findViewById(R.id.spnTanMethods)?.let { spinner -> spinner.adapter = adapter - val selectedTanProcedure = customer.selectedTanProcedure - ?: tanProceduresWithoutUnsupported.firstOrNull { it.type != TanProcedureType.ChipTanManuell && it.type != TanProcedureType.ChipTanUsb } - ?: tanProceduresWithoutUnsupported.firstOrNull() - selectedTanProcedure?.let { spinner.setSelection(adapter.getItems().indexOf(selectedTanProcedure)) } + val selectedTanMethod = customer.selectedTanMethod + ?: tanMethodsWithoutUnsupported.firstOrNull { it.type != TanMethodType.ChipTanManuell && it.type != TanMethodType.ChipTanUsb } + ?: tanMethodsWithoutUnsupported.firstOrNull() + selectedTanMethod?.let { spinner.setSelection(adapter.getItems().indexOf(selectedTanMethod)) } - spinner.onItemSelectedListener = ListItemSelectedListener(adapter) { newSelectedTanProcedure -> - if (newSelectedTanProcedure != selectedTanProcedure) { - tanEnteredCallback(EnterTanResult.userAsksToChangeTanProcedure(newSelectedTanProcedure)) - // TODO: find a way to update account.selectedTanProcedure afterwards + spinner.onItemSelectedListener = ListItemSelectedListener(adapter) { newSelectedTanMethod -> + if (newSelectedTanMethod != selectedTanMethod) { + tanEnteredCallback(EnterTanResult.userAsksToChangeTanMethod(newSelectedTanMethod)) + // TODO: find a way to update account.selectedTanMethod afterwards dismiss() } @@ -120,9 +120,9 @@ open class EnterTanDialog : DialogFragment() { } protected open fun setupSelectTanMediumView(rootView: View) { - val tanMediaForTanProcedure = presenter.getTanMediaForTanProcedure(customer, tanChallenge.tanProcedure) + val tanMediaForTanMethod = presenter.getTanMediaForTanMethod(customer, tanChallenge.tanMethod) - if (tanMediaForTanProcedure.size > 1) { + if (tanMediaForTanMethod.size > 1) { rootView.lytTanMedium.visibility = View.VISIBLE tanMediumAdapter.setItems(customer.tanMediaSorted) @@ -145,7 +145,7 @@ open class EnterTanDialog : DialogFragment() { } protected open fun setupTanView(rootView: View) { - if (OpticalTanProcedures.contains(tanChallenge.tanProcedure.type)) { + if (OpticalTanMethods.contains(tanChallenge.tanMethod.type)) { setupSelectTanMediumView(rootView) if (tanChallenge is FlickerCodeTanChallenge) { @@ -158,11 +158,11 @@ open class EnterTanDialog : DialogFragment() { } protected open fun setupEnteringTan(rootView: View) { - if (tanChallenge.tanProcedure.isNumericTan) { + if (tanChallenge.tanMethod.isNumericTan) { rootView.edtxtEnteredTan.inputType = InputType.TYPE_CLASS_NUMBER } - tanChallenge.tanProcedure.maxTanInputLength?.let { maxInputLength -> + tanChallenge.tanMethod.maxTanInputLength?.let { maxInputLength -> rootView.edtxtEnteredTan.filters = arrayOf(InputFilter.LengthFilter(maxInputLength)) } @@ -260,18 +260,18 @@ open class EnterTanDialog : DialogFragment() { protected open fun checkIfAppSettingsChanged() { - if (flickerCodeView.didTanProcedureSettingsChange) { - presenter.appSettings.flickerCodeSettings = flickerCodeView.tanProcedureSettings + if (flickerCodeView.didTanMethodSettingsChange) { + presenter.appSettings.flickerCodeSettings = flickerCodeView.tanMethodSettings presenter.appSettingsChanged() } - if (tanImageView.didTanProcedureSettingsChange) { + if (tanImageView.didTanMethodSettingsChange) { if (isQrTan(tanChallenge)) { - presenter.appSettings.qrCodeSettings = tanImageView.tanProcedureSettings + presenter.appSettings.qrCodeSettings = tanImageView.tanMethodSettings } else { - presenter.appSettings.photoTanSettings = tanImageView.tanProcedureSettings + presenter.appSettings.photoTanSettings = tanImageView.tanMethodSettings } presenter.appSettingsChanged() @@ -279,7 +279,7 @@ open class EnterTanDialog : DialogFragment() { } protected open fun isQrTan(tanChallenge: TanChallenge): Boolean { - return QrCodeTanProcedures.contains(tanChallenge.tanProcedure.type) + return QrCodeTanMethods.contains(tanChallenge.tanMethod.type) } } \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/ChipTanFlickerCodeView.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/ChipTanFlickerCodeView.kt index bb01f0e3..1c580aec 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/ChipTanFlickerCodeView.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/ChipTanFlickerCodeView.kt @@ -12,7 +12,7 @@ import net.dankito.banking.ui.android.R import net.dankito.banking.ui.model.tan.FlickerCode import net.dankito.banking.ui.util.FlickerCodeAnimator import net.dankito.banking.ui.model.settings.ITanView -import net.dankito.banking.ui.model.settings.TanProcedureSettings +import net.dankito.banking.ui.model.settings.TanMethodSettings import net.dankito.banking.ui.util.Step @@ -57,10 +57,10 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor( protected var isFlickerCodePaused = false - override var didTanProcedureSettingsChange: Boolean = false + override var didTanMethodSettingsChange: Boolean = false protected set - override var tanProcedureSettings: TanProcedureSettings? = null + override var tanMethodSettings: TanMethodSettings? = null protected set @@ -98,7 +98,7 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor( setMarkerPositionAfterStripesLayoutSet() - tanProcedureSettings?.let { + tanMethodSettings?.let { setSize(it.width, it.height, it.space) setFrequency(it.frequency) } @@ -156,7 +156,7 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor( setMarkerPositionAfterStripesLayoutSet() - tanProcedureSettingsChanged() + tanMethodSettingsChanged() } protected open fun setMarkerPositionAfterStripesLayoutSet() { @@ -187,13 +187,13 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor( animator.setFrequency(frequency) - tanProcedureSettingsChanged() + tanMethodSettingsChanged() } - protected open fun tanProcedureSettingsChanged() { - tanProcedureSettings = TanProcedureSettings(stripesWidth, stripesHeight, spaceBetweenStripes, currentFrequency) + protected open fun tanMethodSettingsChanged() { + tanMethodSettings = TanMethodSettings(stripesWidth, stripesHeight, spaceBetweenStripes, currentFrequency) - didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important + didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important } @@ -211,10 +211,10 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor( } - open fun setCode(flickerCode: FlickerCode, tanProcedureSettings: TanProcedureSettings?) { + open fun setCode(flickerCode: FlickerCode, tanMethodSettings: TanMethodSettings?) { animator.stop() - tanProcedureSettings?.let { + tanMethodSettings?.let { setSize(it.width, it.height, it.space) setFrequency(it.frequency) } @@ -222,8 +222,8 @@ open class ChipTanFlickerCodeView @JvmOverloads constructor( setFrequency(DefaultFrequency) } - this.tanProcedureSettings = tanProcedureSettings - this.didTanProcedureSettingsChange = false + this.tanMethodSettings = tanMethodSettings + this.didTanMethodSettingsChange = false animator.animateFlickerCode(flickerCode) { step -> showStepOnUiThread(step) diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/TanImageView.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/TanImageView.kt index c9bc4044..6687d5d2 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/TanImageView.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/TanImageView.kt @@ -10,7 +10,7 @@ import kotlinx.android.synthetic.main.view_tan_image.view.* import kotlinx.android.synthetic.main.view_tan_image_size_controls.view.* import net.dankito.banking.ui.android.R import net.dankito.banking.ui.model.settings.ITanView -import net.dankito.banking.ui.model.settings.TanProcedureSettings +import net.dankito.banking.ui.model.settings.TanMethodSettings import net.dankito.banking.ui.model.tan.ImageTanChallenge @@ -30,10 +30,10 @@ open class TanImageView @JvmOverloads constructor( protected lateinit var imgTanImageView: ImageView - override var didTanProcedureSettingsChange: Boolean = false + override var didTanMethodSettingsChange: Boolean = false protected set - override var tanProcedureSettings: TanProcedureSettings? = null + override var tanMethodSettings: TanMethodSettings? = null protected set @@ -55,13 +55,13 @@ open class TanImageView @JvmOverloads constructor( } - open fun setImage(challenge: ImageTanChallenge, tanProcedureSettings: TanProcedureSettings?) { + open fun setImage(challenge: ImageTanChallenge, tanMethodSettings: TanMethodSettings?) { val decodedImage = challenge.image val bitmap = BitmapFactory.decodeByteArray(decodedImage.imageBytes, 0, decodedImage.imageBytes.size) rootView.imgTanImageView.setImageBitmap(bitmap) - tanProcedureSettings?.let { + tanMethodSettings?.let { setWidthAndHeight(it.width) } } @@ -92,14 +92,14 @@ open class TanImageView @JvmOverloads constructor( requestLayout() - tanProcedureSettingsChanged(newWidthAndHeight) + tanMethodSettingsChanged(newWidthAndHeight) } } - protected open fun tanProcedureSettingsChanged(newWidthAndHeight: Int) { - tanProcedureSettings = TanProcedureSettings(newWidthAndHeight, newWidthAndHeight) + protected open fun tanMethodSettingsChanged(newWidthAndHeight: Int) { + tanMethodSettings = TanMethodSettings(newWidthAndHeight, newWidthAndHeight) - didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important + didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important } /** diff --git a/ui/BankingAndroidApp/src/main/res/layout/dialog_enter_tan.xml b/ui/BankingAndroidApp/src/main/res/layout/dialog_enter_tan.xml index b41fa93c..75af253a 100644 --- a/ui/BankingAndroidApp/src/main/res/layout/dialog_enter_tan.xml +++ b/ui/BankingAndroidApp/src/main/res/layout/dialog_enter_tan.xml @@ -15,24 +15,24 @@ \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml index 0b832172..91141075 100644 --- a/ui/BankingAndroidApp/src/main/res/values-de/strings.xml +++ b/ui/BankingAndroidApp/src/main/res/values-de/strings.xml @@ -74,7 +74,7 @@ Geschw.: - TAN Verfahren + TAN Verfahren TAN Medium Hinweis Ihrer Bank: TAN eingeben: diff --git a/ui/BankingAndroidApp/src/main/res/values/dimens.xml b/ui/BankingAndroidApp/src/main/res/values/dimens.xml index 18769252..ca83fedb 100644 --- a/ui/BankingAndroidApp/src/main/res/values/dimens.xml +++ b/ui/BankingAndroidApp/src/main/res/values/dimens.xml @@ -112,10 +112,10 @@ 6dp 4dp - 30dp - 6dp - 8dp - 15sp + 30dp + 6dp + 8dp + 15sp 30dp 8dp 15sp @@ -128,7 +128,7 @@ 8dp 120dp - 4dp + 4dp 4dp diff --git a/ui/BankingAndroidApp/src/main/res/values/strings.xml b/ui/BankingAndroidApp/src/main/res/values/strings.xml index 61058114..7fce6776 100644 --- a/ui/BankingAndroidApp/src/main/res/values/strings.xml +++ b/ui/BankingAndroidApp/src/main/res/values/strings.xml @@ -74,7 +74,7 @@ Frequency: - TAN procedure + TAN procedure TAN medium Hint from your bank: Enter TAN: diff --git a/ui/BankingJavaFxApp/src/main/resources/Messages.properties b/ui/BankingJavaFxApp/src/main/resources/Messages.properties index 3f3300fe..7bc1b07f 100755 --- a/ui/BankingJavaFxApp/src/main/resources/Messages.properties +++ b/ui/BankingJavaFxApp/src/main/resources/Messages.properties @@ -49,7 +49,7 @@ add.account.dialog.successfully.added.account.bank.supports.retrieving.transacti enter.tan.dialog.title=TAN required -enter.tan.dialog.select.tan.procedure=TAN procedure: +enter.tan.dialog.select.tan.method=TAN method: enter.tan.dialog.select.tan.medium=TAN medium: enter.tan.dialog.size.label=Size: enter.tan.dialog.frequency.label=Speed: diff --git a/ui/BankingJavaFxApp/src/main/resources/Messages_de.properties b/ui/BankingJavaFxApp/src/main/resources/Messages_de.properties index 8f95aee9..22c09cd1 100755 --- a/ui/BankingJavaFxApp/src/main/resources/Messages_de.properties +++ b/ui/BankingJavaFxApp/src/main/resources/Messages_de.properties @@ -49,7 +49,7 @@ add.account.dialog.successfully.added.account.bank.supports.retrieving.transacti enter.tan.dialog.title=TAN wird benötigt -enter.tan.dialog.select.tan.procedure=TAN Verfahren: +enter.tan.dialog.select.tan.method=TAN Verfahren: enter.tan.dialog.select.tan.medium=TAN Medium: enter.tan.dialog.size.label=Größe: enter.tan.dialog.frequency.label=Geschwindigkeit: diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt index d2766751..13fed066 100644 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/EnterTanDialog.kt @@ -27,7 +27,7 @@ open class EnterTanDialog( ) : Window() { companion object { - val QrCodeTanProcedures = listOf(TanProcedureType.ChipTanQrCode, TanProcedureType.QrCode) + val QrCodeTanMethods = listOf(TanMethodType.ChipTanQrCode, TanMethodType.QrCode) private val ButtonHeight = 40.0 private val ButtonWidth = 150.0 @@ -41,9 +41,9 @@ open class EnterTanDialog( protected var tanImageView: TanImageView? = null - protected val tanProceduresWithoutUnsupported = customer.supportedTanProcedures.filterNot { it.type == TanProcedureType.ChipTanUsb } // USB tan generators are not supported + protected val tanMethodsWithoutUnsupported = customer.supportedTanMethods.filterNot { it.type == TanMethodType.ChipTanUsb } // USB tan generators are not supported - protected val selectedTanProcedure = SimpleObjectProperty(customer.selectedTanProcedure ?: tanProceduresWithoutUnsupported.firstOrNull { it.displayName.contains("manuell", true) == false } ?: tanProceduresWithoutUnsupported.firstOrNull()) + protected val selectedTanMethod = SimpleObjectProperty(customer.selectedTanMethod ?: tanMethodsWithoutUnsupported.firstOrNull { it.displayName.contains("manuell", true) == false } ?: tanMethodsWithoutUnsupported.firstOrNull()) protected val selectedTanMedium = SimpleObjectProperty(customer.tanMediaSorted.firstOrNull()) @@ -51,8 +51,8 @@ open class EnterTanDialog( init { - selectedTanProcedure.addListener { _, _, newValue -> - tanEnteredCallback(EnterTanResult.userAsksToChangeTanProcedure(newValue)) + selectedTanMethod.addListener { _, _, newValue -> + tanEnteredCallback(EnterTanResult.userAsksToChangeTanMethod(newValue)) close() } @@ -72,12 +72,12 @@ open class EnterTanDialog( form { fieldset { - field(messages["enter.tan.dialog.select.tan.procedure"]) { + field(messages["enter.tan.dialog.select.tan.method"]) { label.apply { font = Font.font(font.family, FontWeight.BLACK, font.size) } - combobox(selectedTanProcedure, tanProceduresWithoutUnsupported) { + combobox(selectedTanMethod, tanMethodsWithoutUnsupported) { cellFormat { text = it.displayName } @@ -261,18 +261,18 @@ open class EnterTanDialog( protected open fun checkIfAppSettingsChanged() { - if (flickerCodeView?.didTanProcedureSettingsChange == true) { - presenter.appSettings.flickerCodeSettings = flickerCodeView?.tanProcedureSettings + if (flickerCodeView?.didTanMethodSettingsChange == true) { + presenter.appSettings.flickerCodeSettings = flickerCodeView?.tanMethodSettings presenter.appSettingsChanged() } - if (tanImageView?.didTanProcedureSettingsChange == true) { + if (tanImageView?.didTanMethodSettingsChange == true) { if (isQrTan(challenge)) { - presenter.appSettings.qrCodeSettings = tanImageView?.tanProcedureSettings + presenter.appSettings.qrCodeSettings = tanImageView?.tanMethodSettings } else { - presenter.appSettings.photoTanSettings = tanImageView?.tanProcedureSettings + presenter.appSettings.photoTanSettings = tanImageView?.tanMethodSettings } presenter.appSettingsChanged() @@ -280,7 +280,7 @@ open class EnterTanDialog( } protected open fun isQrTan(tanChallenge: TanChallenge): Boolean { - return QrCodeTanProcedures.contains(tanChallenge.tanProcedure.type) + return QrCodeTanMethods.contains(tanChallenge.tanMethod.type) } } \ No newline at end of file diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/ChipTanFlickerCodeView.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/ChipTanFlickerCodeView.kt index c6368fd9..c9759a19 100644 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/ChipTanFlickerCodeView.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/ChipTanFlickerCodeView.kt @@ -6,11 +6,10 @@ import javafx.geometry.Pos import javafx.scene.paint.Color import net.dankito.banking.ui.model.tan.FlickerCode import net.dankito.banking.ui.util.FlickerCodeAnimator -import net.dankito.banking.ui.util.Bit import net.dankito.banking.javafx.dialogs.tan.controls.ChipTanFlickerCodeStripeView import net.dankito.banking.javafx.dialogs.tan.controls.TanGeneratorMarkerView import net.dankito.banking.ui.model.settings.ITanView -import net.dankito.banking.ui.model.settings.TanProcedureSettings +import net.dankito.banking.ui.model.settings.TanMethodSettings import net.dankito.banking.ui.util.Step import net.dankito.utils.javafx.ui.extensions.fixedHeight import net.dankito.utils.javafx.ui.extensions.fixedWidth @@ -20,7 +19,7 @@ import tornadofx.* open class ChipTanFlickerCodeView( protected val flickerCode: FlickerCode, - tanProcedureSettings: TanProcedureSettings? + tanMethodSettings: TanMethodSettings? ): View(), ITanView { companion object { @@ -41,9 +40,9 @@ open class ChipTanFlickerCodeView( protected val flickerCodeLeftRightMargin = SimpleDoubleProperty(31.0) - protected val stripesHeight = SimpleDoubleProperty(tanProcedureSettings?.height?.toDouble() ?: 127.0) - protected val stripesWidth = SimpleDoubleProperty(tanProcedureSettings?.width?.toDouble() ?: 42.0) - protected val spaceBetweenStripes = SimpleDoubleProperty(tanProcedureSettings?.space?.toDouble() ?: 10.0) + protected val stripesHeight = SimpleDoubleProperty(tanMethodSettings?.height?.toDouble() ?: 127.0) + protected val stripesWidth = SimpleDoubleProperty(tanMethodSettings?.width?.toDouble() ?: 42.0) + protected val spaceBetweenStripes = SimpleDoubleProperty(tanMethodSettings?.space?.toDouble() ?: 10.0) protected val flickerCodeViewWidth = SimpleDoubleProperty() @@ -59,15 +58,15 @@ open class ChipTanFlickerCodeView( protected val isMinFrequencyReached = SimpleBooleanProperty(false) protected val isMaxFrequencyReached = SimpleBooleanProperty(false) - protected var currentFrequency = tanProcedureSettings?.frequency ?: DefaultFrequency + protected var currentFrequency = tanMethodSettings?.frequency ?: DefaultFrequency protected val animator = FlickerCodeAnimator() - override var didTanProcedureSettingsChange: Boolean = false + override var didTanMethodSettingsChange: Boolean = false protected set - override var tanProcedureSettings: TanProcedureSettings? = tanProcedureSettings + override var tanMethodSettings: TanMethodSettings? = tanMethodSettings protected set @@ -203,7 +202,7 @@ open class ChipTanFlickerCodeView( setSize(stripesWidth.value + ChangeSizeStripeWidthStep, stripesHeight.value + ChangeSizeStripeHeightStep, spaceBetweenStripes.value + ChangeSizeSpaceBetweenStripesStep) - tanProcedureSettingsChanged() + tanMethodSettingsChanged() } updateMinAndMaxSizeReached() @@ -214,7 +213,7 @@ open class ChipTanFlickerCodeView( setSize(stripesWidth.value - ChangeSizeStripeWidthStep, stripesHeight.value - ChangeSizeStripeHeightStep, spaceBetweenStripes.value - ChangeSizeSpaceBetweenStripesStep) - tanProcedureSettingsChanged() + tanMethodSettingsChanged() } updateMinAndMaxSizeReached() @@ -225,7 +224,7 @@ open class ChipTanFlickerCodeView( this.stripesHeight.value = height this.spaceBetweenStripes.value = spaceBetweenStripes - tanProcedureSettingsChanged() + tanMethodSettingsChanged() updateMinAndMaxSizeReached() } @@ -264,7 +263,7 @@ open class ChipTanFlickerCodeView( updateMinAndMaxFrequencyReached() - tanProcedureSettingsChanged() + tanMethodSettingsChanged() } protected open fun updateMinAndMaxFrequencyReached() { @@ -273,11 +272,11 @@ open class ChipTanFlickerCodeView( } - protected open fun tanProcedureSettingsChanged() { - tanProcedureSettings = TanProcedureSettings(stripesWidth.value.toInt(), stripesHeight.value.toInt(), + protected open fun tanMethodSettingsChanged() { + tanMethodSettings = TanMethodSettings(stripesWidth.value.toInt(), stripesHeight.value.toInt(), spaceBetweenStripes.value.toInt(), currentFrequency) - didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important + didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important } } \ No newline at end of file diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/TanImageView.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/TanImageView.kt index 03c21364..08f01c6a 100644 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/TanImageView.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/tan/controls/TanImageView.kt @@ -5,7 +5,7 @@ import javafx.geometry.Pos import javafx.scene.image.Image import javafx.scene.image.ImageView import net.dankito.banking.ui.model.settings.ITanView -import net.dankito.banking.ui.model.settings.TanProcedureSettings +import net.dankito.banking.ui.model.settings.TanMethodSettings import net.dankito.banking.ui.model.tan.TanImage import net.dankito.utils.javafx.ui.extensions.updateWindowSize import tornadofx.* @@ -14,7 +14,7 @@ import java.io.ByteArrayInputStream open class TanImageView( protected val tanImage: TanImage, - tanProcedureSettings: TanProcedureSettings? + tanMethodSettings: TanMethodSettings? ) : View(), ITanView { companion object { @@ -34,10 +34,10 @@ open class TanImageView( protected var tanImageView: ImageView by singleAssign() - override var didTanProcedureSettingsChange: Boolean = false + override var didTanMethodSettingsChange: Boolean = false protected set - override var tanProcedureSettings: TanProcedureSettings? = tanProcedureSettings + override var tanMethodSettings: TanMethodSettings? = tanMethodSettings protected set @@ -58,7 +58,7 @@ open class TanImageView( } } - tanProcedureSettings?.let { + tanMethodSettings?.let { runLater { setWidthAndHeight(it.width.toDouble()) } @@ -86,17 +86,17 @@ open class TanImageView( updateWindowSize() - tanProcedureSettingsChanged(newWidthAndHeight.toInt()) + tanMethodSettingsChanged(newWidthAndHeight.toInt()) } isMinSizeReached.value = tanImageView.fitHeight <= MinHeight isMaxSizeReached.value = tanImageView.fitHeight >= MaxHeight } - protected open fun tanProcedureSettingsChanged(newWidthAndHeight: Int) { - tanProcedureSettings = TanProcedureSettings(newWidthAndHeight, newWidthAndHeight) + protected open fun tanMethodSettingsChanged(newWidthAndHeight: Int) { + tanMethodSettings = TanMethodSettings(newWidthAndHeight, newWidthAndHeight) - didTanProcedureSettingsChange = true // we don't check if settings really changed, it's not that important + didTanMethodSettingsChange = true // we don't check if settings really changed, it's not that important } } \ No newline at end of file diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt index 44f46698..4d4e895e 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt @@ -1,7 +1,7 @@ package net.dankito.banking.ui.model import net.dankito.banking.ui.model.tan.TanMedium -import net.dankito.banking.ui.model.tan.TanProcedure +import net.dankito.banking.ui.model.tan.TanMethod import net.dankito.utils.multiplatform.UUID @@ -30,9 +30,9 @@ open class Customer( override var technicalId: String = UUID.random() - override var supportedTanProcedures: List = listOf() + override var supportedTanMethods: List = listOf() - override var selectedTanProcedure: TanProcedure? = null + override var selectedTanMethod: TanMethod? = null override var tanMedia: List = listOf() diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/ICustomer.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/ICustomer.kt index 76284623..73988a12 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/ICustomer.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/ICustomer.kt @@ -2,7 +2,7 @@ package net.dankito.banking.ui.model import net.dankito.banking.ui.model.tan.TanMedium import net.dankito.banking.ui.model.tan.TanMediumStatus -import net.dankito.banking.ui.model.tan.TanProcedure +import net.dankito.banking.ui.model.tan.TanMethod import net.dankito.banking.util.sortedByDisplayIndex import net.dankito.utils.multiplatform.BigDecimal import net.dankito.utils.multiplatform.sum @@ -27,8 +27,8 @@ interface ICustomer, TAccountTransac var accounts: List - var supportedTanProcedures: List - var selectedTanProcedure: TanProcedure? + var supportedTanMethods: List + var selectedTanMethod: TanMethod? var tanMedia: List var userSetDisplayName: String? diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/mapper/IModelCreator.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/mapper/IModelCreator.kt index ffe9e37d..398b6355 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/mapper/IModelCreator.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/mapper/IModelCreator.kt @@ -56,9 +56,9 @@ interface IModelCreator { ) : IAccountTransaction - fun createTanProcedure(displayName: String, type: TanProcedureType, bankInternalProcedureCode: String, - maxTanInputLength: Int? = null, allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric): TanProcedure { - return TanProcedure(displayName, type, bankInternalProcedureCode, maxTanInputLength) + fun createTanMethod(displayName: String, type: TanMethodType, bankInternalMethodCode: String, + maxTanInputLength: Int? = null, allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric): TanMethod { + return TanMethod(displayName, type, bankInternalMethodCode, maxTanInputLength) } fun createTanMedium(displayName: String, status: TanMediumStatus): TanMedium { diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt index 70f189c2..68ab6b99 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/AppSettings.kt @@ -2,9 +2,9 @@ package net.dankito.banking.ui.model.settings open class AppSettings( - var flickerCodeSettings: TanProcedureSettings? = null, - var qrCodeSettings: TanProcedureSettings? = null, - var photoTanSettings: TanProcedureSettings? = null + var flickerCodeSettings: TanMethodSettings? = null, + var qrCodeSettings: TanMethodSettings? = null, + var photoTanSettings: TanMethodSettings? = null ) { internal constructor() : this(null, null, null) // for object deserializers diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/ITanView.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/ITanView.kt index d1591f5e..1e25bd4c 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/ITanView.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/ITanView.kt @@ -3,8 +3,8 @@ package net.dankito.banking.ui.model.settings interface ITanView { - val didTanProcedureSettingsChange: Boolean + val didTanMethodSettingsChange: Boolean - val tanProcedureSettings: TanProcedureSettings? + val tanMethodSettings: TanMethodSettings? } \ No newline at end of file diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/TanProcedureSettings.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/TanMethodSettings.kt similarity index 92% rename from ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/TanProcedureSettings.kt rename to ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/TanMethodSettings.kt index 2c323af0..f183668f 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/TanProcedureSettings.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/settings/TanMethodSettings.kt @@ -1,7 +1,7 @@ package net.dankito.banking.ui.model.settings -open class TanProcedureSettings( +open class TanMethodSettings( var width: Int, var height: Int, var space: Int = -1, // only needed for flicker code view diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/EnterTanResult.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/EnterTanResult.kt index cfcae4f2..9f1d683d 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/EnterTanResult.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/EnterTanResult.kt @@ -5,7 +5,7 @@ import net.dankito.banking.ui.model.responses.BankingClientResponse open class EnterTanResult protected constructor( val enteredTan: String?, - val changeTanProcedureTo: TanProcedure? = null, + val changeTanMethodTo: TanMethod? = null, val changeTanMediumTo: TanMedium? = null, val changeTanMediumResultCallback: ((BankingClientResponse) -> Unit)? = null ) { @@ -20,8 +20,8 @@ open class EnterTanResult protected constructor( return EnterTanResult(null) } - fun userAsksToChangeTanProcedure(changeTanProcedureTo: TanProcedure): EnterTanResult { - return EnterTanResult(null, changeTanProcedureTo) + fun userAsksToChangeTanMethod(changeTanMethodTo: TanMethod): EnterTanResult { + return EnterTanResult(null, changeTanMethodTo) } fun userAsksToChangeTanMedium(changeTanMediumTo: TanMedium, changeTanMediumResultCallback: ((BankingClientResponse) -> Unit)?): EnterTanResult { @@ -31,8 +31,8 @@ open class EnterTanResult protected constructor( } override fun toString(): String { - if (changeTanProcedureTo != null) { - return "User asks to change TAN procedure to $changeTanProcedureTo" + if (changeTanMethodTo != null) { + return "User asks to change TAN method to $changeTanMethodTo" } if (changeTanMediumTo != null) { diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/FlickerCodeTanChallenge.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/FlickerCodeTanChallenge.kt index b7e9a0d9..b5320701 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/FlickerCodeTanChallenge.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/FlickerCodeTanChallenge.kt @@ -4,12 +4,12 @@ package net.dankito.banking.ui.model.tan open class FlickerCodeTanChallenge( val flickerCode: FlickerCode, messageToShowToUser: String, - tanProcedure: TanProcedure + tanMethod: TanMethod -) : TanChallenge(messageToShowToUser, tanProcedure) { +) : TanChallenge(messageToShowToUser, tanMethod) { override fun toString(): String { - return "$tanProcedure $flickerCode: $messageToShowToUser" + return "$tanMethod $flickerCode: $messageToShowToUser" } } \ No newline at end of file diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/ImageTanChallenge.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/ImageTanChallenge.kt index b1efab66..f9751a38 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/ImageTanChallenge.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/ImageTanChallenge.kt @@ -4,12 +4,12 @@ package net.dankito.banking.ui.model.tan open class ImageTanChallenge( val image: TanImage, messageToShowToUser: String, - tanProcedure: TanProcedure + tanMethod: TanMethod - ) : TanChallenge(messageToShowToUser, tanProcedure) { + ) : TanChallenge(messageToShowToUser, tanMethod) { override fun toString(): String { - return "$tanProcedure $image: $messageToShowToUser" + return "$tanMethod $image: $messageToShowToUser" } } \ No newline at end of file diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanChallenge.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanChallenge.kt index 014af9f1..a26ad57b 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanChallenge.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanChallenge.kt @@ -3,11 +3,11 @@ package net.dankito.banking.ui.model.tan open class TanChallenge( val messageToShowToUser: String, - val tanProcedure: TanProcedure + val tanMethod: TanMethod ) { override fun toString(): String { - return "$tanProcedure: $messageToShowToUser" + return "$tanMethod: $messageToShowToUser" } } \ No newline at end of file diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanProcedure.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanMethod.kt similarity index 63% rename from ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanProcedure.kt rename to ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanMethod.kt index 326cac21..87e4f8dd 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanProcedure.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanMethod.kt @@ -5,16 +5,21 @@ import net.dankito.utils.multiplatform.UUID import kotlin.jvm.Transient -open class TanProcedure( +open class TanMethod( + @Transient override val displayName: String, - open val type: TanProcedureType, - open val bankInternalProcedureCode: String, + @Transient + open val type: TanMethodType, + @Transient + open val bankInternalMethodCode: String, + @Transient open val maxTanInputLength: Int? = null, + @Transient open val allowedTanFormat: AllowedTanFormat = AllowedTanFormat.Alphanumeric ) : Displayable { - internal constructor() : this("", TanProcedureType.EnterTan, "") // for object deserializers + internal constructor() : this("", TanMethodType.EnterTan, "") // for object deserializers @Transient @@ -26,11 +31,11 @@ open class TanProcedure( override fun equals(other: Any?): Boolean { if (this === other) return true - if (other !is TanProcedure) return false + if (other !is TanMethod) return false if (displayName != other.displayName) return false if (type != other.type) return false - if (bankInternalProcedureCode != other.bankInternalProcedureCode) return false + if (bankInternalMethodCode != other.bankInternalMethodCode) return false return true } @@ -38,13 +43,13 @@ open class TanProcedure( override fun hashCode(): Int { var result = displayName.hashCode() result = 31 * result + type.hashCode() - result = 31 * result + bankInternalProcedureCode.hashCode() + result = 31 * result + bankInternalMethodCode.hashCode() return result } override fun toString(): String { - return "$displayName ($type, ${bankInternalProcedureCode})" + return "$displayName ($type, ${bankInternalMethodCode})" } } \ No newline at end of file diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanProcedureType.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanMethodType.kt similarity index 87% rename from ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanProcedureType.kt rename to ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanMethodType.kt index 4c2a971c..12701b3f 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanProcedureType.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/tan/TanMethodType.kt @@ -1,7 +1,7 @@ package net.dankito.banking.ui.model.tan -enum class TanProcedureType { +enum class TanMethodType { EnterTan, diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt index 2a25e7b8..4b615ed8 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt @@ -48,8 +48,8 @@ open class BankingPresenter( ) { companion object { - val ChipTanTanProcedures = listOf(TanProcedureType.ChipTanManuell, TanProcedureType.ChipTanFlickercode, TanProcedureType.ChipTanUsb, - TanProcedureType.ChipTanQrCode, TanProcedureType.ChipTanPhotoTanMatrixCode) + val ChipTanTanMethods = listOf(TanMethodType.ChipTanManuell, TanMethodType.ChipTanFlickercode, TanMethodType.ChipTanUsb, + TanMethodType.ChipTanQrCode, TanMethodType.ChipTanPhotoTanMatrixCode) protected const val OneDayMillis = 24 * 60 * 60 * 1000L @@ -84,7 +84,7 @@ open class BankingPresenter( } router.getTanFromUserFromNonUiThread(customer, tanChallenge, this@BankingPresenter) { result -> - if (result.changeTanProcedureTo != null || result.changeTanMediumTo != null) { // then either selected TAN medium or procedure will change -> save account on next call to enterTan() as then changes will be visible + if (result.changeTanMethodTo != null || result.changeTanMediumTo != null) { // then either selected TAN medium or method will change -> save account on next call to enterTan() as then changes will be visible saveAccountOnNextEnterTanInvocation = true } @@ -778,11 +778,11 @@ open class BankingPresenter( } - open fun getTanMediaForTanProcedure(bank: TypedCustomer, tanProcedure: TanProcedure): List { - if (ChipTanTanProcedures.contains(tanProcedure.type)) { + open fun getTanMediaForTanMethod(bank: TypedCustomer, tanMethod: TanMethod): List { + if (ChipTanTanMethods.contains(tanMethod.type)) { return bank.tanMediaSorted.filterIsInstance() } - else if (tanProcedure.type == TanProcedureType.SmsTan) { + else if (tanMethod.type == TanMethodType.SmsTan) { return bank.tanMediaSorted.filterIsInstance() } diff --git a/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj b/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj index 0b35be67..c2a3fa8f 100644 --- a/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj +++ b/ui/BankingiOSApp/BankingiOSApp.xcodeproj/project.pbxproj @@ -98,7 +98,7 @@ 36E21ED524DC549800649DC8 /* BankSettingsDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21ED424DC549800649DC8 /* BankSettingsDialog.swift */; }; 36E21ED724DC617200649DC8 /* BankAccountSettingsDialog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21ED624DC617200649DC8 /* BankAccountSettingsDialog.swift */; }; 36E21EDB24DC990300649DC8 /* LabelledUIKitTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDA24DC990300649DC8 /* LabelledUIKitTextField.swift */; }; - 36E21EDD24DCA89100649DC8 /* TanProcedurePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDC24DCA89100649DC8 /* TanProcedurePicker.swift */; }; + 36E21EDD24DCA89100649DC8 /* TanMethodPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDC24DCA89100649DC8 /* TanMethodPicker.swift */; }; 36E21EDF24DCCC2700649DC8 /* CheckmarkListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E21EDE24DCCC2700649DC8 /* CheckmarkListItem.swift */; }; 36E7BA1424B3D05C00757859 /* ViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E7BA1324B3D05C00757859 /* ViewExtensions.swift */; }; 36FC929C24B39A05002B12E9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36FC929B24B39A05002B12E9 /* AppDelegate.swift */; }; @@ -240,7 +240,7 @@ 36E21ED424DC549800649DC8 /* BankSettingsDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankSettingsDialog.swift; sourceTree = ""; }; 36E21ED624DC617200649DC8 /* BankAccountSettingsDialog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankAccountSettingsDialog.swift; sourceTree = ""; }; 36E21EDA24DC990300649DC8 /* LabelledUIKitTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelledUIKitTextField.swift; sourceTree = ""; }; - 36E21EDC24DCA89100649DC8 /* TanProcedurePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TanProcedurePicker.swift; sourceTree = ""; }; + 36E21EDC24DCA89100649DC8 /* TanMethodPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TanMethodPicker.swift; sourceTree = ""; }; 36E21EDE24DCCC2700649DC8 /* CheckmarkListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckmarkListItem.swift; sourceTree = ""; }; 36E7BA1324B3D05C00757859 /* ViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = ""; }; 36E7BA1824B9E70C00757859 /* xcode-frameworks */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "xcode-frameworks"; path = "../../tools/BankFinder/build/xcode-frameworks"; sourceTree = ""; }; @@ -353,7 +353,7 @@ 360782D224F429F70098FEFE /* FlickerCodeStripe.swift */, 3608D6C124FBA9C6006C93A8 /* TrianglePointingDown.swift */, 3608D6C524FBAB41006C93A8 /* TanGeneratorPositionMarker.swift */, - 36E21EDC24DCA89100649DC8 /* TanProcedurePicker.swift */, + 36E21EDC24DCA89100649DC8 /* TanMethodPicker.swift */, 360782CA24E5746A0098FEFE /* FlickerCodeAnimator.swift */, ); path = tan; @@ -754,7 +754,7 @@ 36BCF89524C31F02005BEC29 /* AppData.swift in Sources */, 3642F01A2502931F005186FE /* InstantPaymentInfoView.swift in Sources */, 36B8A44F2503D97D00C15359 /* AuthenticationType.swift in Sources */, - 36E21EDD24DCA89100649DC8 /* TanProcedurePicker.swift in Sources */, + 36E21EDD24DCA89100649DC8 /* TanMethodPicker.swift in Sources */, 3608D6C624FBAB41006C93A8 /* TanGeneratorPositionMarker.swift in Sources */, 36B8A4542503E93B00C15359 /* UIAlert.swift in Sources */, 36BE065B24CA4B3500CBBB68 /* SelectBankDialog.swift in Sources */, diff --git a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents index 99befae4..9083c987 100644 --- a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents +++ b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents @@ -69,20 +69,20 @@ - + - + - + - + @@ -90,8 +90,8 @@ - + - + \ No newline at end of file diff --git a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings index 8857a38a..58095e2a 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings @@ -122,7 +122,7 @@ Unfortunately, Bankmeister cannot know whether a bank charges for instant paymen /* EnterTanDialog */ "Enter TAN Dialog Title" = "Enter TAN"; -"TAN procedure" = "TAN procedure"; +"TAN method" = "TAN method"; "TAN medium" = "TAN medium"; "Tan Generator Frequency" = "Frequency"; "Size" = "Size"; diff --git a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift index 4346273f..fcaa943d 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift +++ b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift @@ -4,15 +4,15 @@ import BankingUiSwift let previewBanks = createPreviewBanks() -let previewTanProcedures = createPreviewTanProcedures() +let previewTanMethods = createPreviewTanMethod() let previewTanMedia = createPreviewTanMedia() -let previewTanChallenge = TanChallenge(messageToShowToUser: "Hier ist eine Nachricht deiner Bank, die dir die Welt erklaert", tanProcedure: previewTanProcedures[0]) +let previewTanChallenge = TanChallenge(messageToShowToUser: "Hier ist eine Nachricht deiner Bank, die dir die Welt erklaert", tanMethod: previewTanMethods[0]) -let previewImageTanChallenge = ImageTanChallenge(image: TanImage(mimeType: "image/png", imageBytes: KotlinByteArray(size: 0), decodingError: nil), messageToShowToUser: "", tanProcedure: previewTanProcedures[1]) +let previewImageTanChallenge = ImageTanChallenge(image: TanImage(mimeType: "image/png", imageBytes: KotlinByteArray(size: 0), decodingError: nil), messageToShowToUser: "", tanMethod: previewTanMethods[1]) -let previewFlickerCodeTanChallenge = FlickerCodeTanChallenge(flickerCode: FlickerCode(challengeHHD_UC: "", parsedDataSet: "", decodingError: nil), messageToShowToUser: "", tanProcedure: previewTanProcedures[0]) +let previewFlickerCodeTanChallenge = FlickerCodeTanChallenge(flickerCode: FlickerCode(challengeHHD_UC: "", parsedDataSet: "", decodingError: nil), messageToShowToUser: "", tanMethod: previewTanMethods[0]) func createPreviewBanks() -> [ICustomer] { @@ -35,11 +35,11 @@ func createPreviewBanks() -> [ICustomer] { } -func createPreviewTanProcedures() -> [TanProcedure] { +func createPreviewTanMethod() -> [TanMethod] { return [ - TanProcedure(displayName: "chipTAN optisch", type: .chiptanflickercode, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .numeric), - TanProcedure(displayName: "chipTAN QR", type: .chiptanqrcode, bankInternalProcedureCode: "", maxTanInputLength: 8, allowedTanFormat: .numeric), - TanProcedure(displayName: "Secure Super Duper Plus", type: .apptan, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .alphanumeric) + TanMethod(displayName: "chipTAN optisch", type: .chiptanflickercode, bankInternalMethodCode: "", maxTanInputLength: 6, allowedTanFormat: .numeric), + TanMethod(displayName: "chipTAN QR", type: .chiptanqrcode, bankInternalMethodCode: "", maxTanInputLength: 8, allowedTanFormat: .numeric), + TanMethod(displayName: "Secure Super Duper Plus", type: .apptan, bankInternalMethodCode: "", maxTanInputLength: 6, allowedTanFormat: .alphanumeric) ] } diff --git a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings index 2b864c5b..29ed0403 100644 --- a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings @@ -122,7 +122,7 @@ Ob eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leid /* EnterTanDialog */ "Enter TAN Dialog Title" = "TAN-Abfrage"; -"TAN procedure" = "TAN Verfahren"; +"TAN method" = "TAN Verfahren"; "TAN medium" = "TAN Medium"; "Tan Generator Frequency" = "Geschw."; "Size" = "Größe"; diff --git a/ui/BankingiOSApp/BankingiOSApp/extensions/Extensions.swift b/ui/BankingiOSApp/BankingiOSApp/extensions/Extensions.swift index 0b617d22..e5fe5124 100644 --- a/ui/BankingiOSApp/BankingiOSApp/extensions/Extensions.swift +++ b/ui/BankingiOSApp/BankingiOSApp/extensions/Extensions.swift @@ -166,8 +166,8 @@ extension Remittee : Identifiable { } -extension TanProcedure : Identifiable { +extension TanMethod : Identifiable { - public var id: String { self.bankInternalProcedureCode } + public var id: String { self.bankInternalMethodCode } } diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift index 707798a2..be55562b 100644 --- a/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift +++ b/ui/BankingiOSApp/BankingiOSApp/persistence/CoreDataBankingPersistence.swift @@ -44,9 +44,9 @@ class CoreDataBankingPersistence: IBankingPersistence, IRemitteeSearcher { } } - for tanProcedure in customer.supportedTanProcedures { - if let mappedTanProcedure = mappedCustomer.supportedTanProcedures?.first { ($0 as! PersistedTanProcedure).bankInternalProcedureCode == tanProcedure.bankInternalProcedureCode } as? PersistedTanProcedure { - tanProcedure.technicalId = mappedTanProcedure.objectIDAsString + for tanMethod in customer.supportedTanMethods { + if let mappedTanMethod = mappedCustomer.supportedTanMethods?.first { ($0 as! PersistedTanMethod).bankInternalMethodCode == tanMethod.bankInternalMethodCode } as? PersistedTanMethod { + tanMethod.technicalId = mappedTanMethod.objectIDAsString } } diff --git a/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift b/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift index 3e5c336c..e61334a6 100644 --- a/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift +++ b/ui/BankingiOSApp/BankingiOSApp/persistence/Mapper.swift @@ -15,8 +15,8 @@ class Mapper { mapped.accounts = map(mapped, customer.accounts?.array as? [PersistedBankAccount]) - mapped.supportedTanProcedures = map(customer.supportedTanProcedures?.array as? [PersistedTanProcedure]) - mapped.selectedTanProcedure = mapped.supportedTanProcedures.first(where: { $0.bankInternalProcedureCode == customer.selectedTanProcedureCode }) + mapped.supportedTanMethods = map(customer.supportedTanMethods?.array as? [PersistedTanMethod]) + mapped.selectedTanMethod = mapped.supportedTanMethods.first(where: { $0.bankInternalMethodCode == customer.selectedTanMethodCode }) mapped.tanMedia = map(customer.tanMedia?.array as? [PersistedTanMedium]) @@ -44,8 +44,8 @@ class Mapper { mapped.accounts = NSOrderedSet(array: map(mapped, customer.accounts, context)) - mapped.supportedTanProcedures = NSOrderedSet(array: map(customer.supportedTanProcedures, context)) - mapped.selectedTanProcedureCode = customer.selectedTanProcedure?.bankInternalProcedureCode + mapped.supportedTanMethods = NSOrderedSet(array: map(customer.supportedTanMethods, context)) + mapped.selectedTanMethodCode = customer.selectedTanMethod?.bankInternalMethodCode mapped.tanMedia = NSOrderedSet(array: map(customer.tanMedia, context)) @@ -203,65 +203,65 @@ class Mapper { } - func map(_ tanProcedures: [PersistedTanProcedure]?) -> [TanProcedure] { - return tanProcedures?.map { map($0) } ?? [] + func map(_ tanMethods: [PersistedTanMethod]?) -> [TanMethod] { + return tanMethods?.map { map($0) } ?? [] } - func map(_ tanProcedure: PersistedTanProcedure) -> TanProcedure { - let mapped = TanProcedure( - displayName: map(tanProcedure.displayName), - type: mapTanProcedureType(tanProcedure.type), - bankInternalProcedureCode: map(tanProcedure.bankInternalProcedureCode), - maxTanInputLength: map(tanProcedure.maxTanInputLength), - allowedTanFormat: tanProcedure.allowedTanFormat == "numeric" ? .numeric : .alphanumeric + func map(_ tanMethod: PersistedTanMethod) -> TanMethod { + let mapped = TanMethod( + displayName: map(tanMethod.displayName), + type: mapTanMethodType(tanMethod.type), + bankInternalMethodCode: map(tanMethod.bankInternalMethodCode), + maxTanInputLength: map(tanMethod.maxTanInputLength), + allowedTanFormat: tanMethod.allowedTanFormat == "numeric" ? .numeric : .alphanumeric ) - mapped.technicalId = tanProcedure.objectIDAsString + mapped.technicalId = tanMethod.objectIDAsString return mapped } - func map(_ tanProcedures: [TanProcedure], _ context: NSManagedObjectContext) -> [PersistedTanProcedure] { - return tanProcedures.map { map($0, context) } + func map(_ tanMethods: [TanMethod], _ context: NSManagedObjectContext) -> [PersistedTanMethod] { + return tanMethods.map { map($0, context) } } - func map(_ tanProcedure: TanProcedure, _ context: NSManagedObjectContext) -> PersistedTanProcedure { - let mapped = context.objectByID(tanProcedure.technicalId) ?? PersistedTanProcedure(context: context) + func map(_ tanMethod: TanMethod, _ context: NSManagedObjectContext) -> PersistedTanMethod { + let mapped = context.objectByID(tanMethod.technicalId) ?? PersistedTanMethod(context: context) - mapped.displayName = tanProcedure.displayName - mapped.type = tanProcedure.type.name - mapped.bankInternalProcedureCode = tanProcedure.bankInternalProcedureCode + mapped.displayName = tanMethod.displayName + mapped.type = tanMethod.type.name + mapped.bankInternalMethodCode = tanMethod.bankInternalMethodCode - mapped.maxTanInputLength = map(tanProcedure.maxTanInputLength) ?? -1 - mapped.allowedTanFormat = tanProcedure.allowedTanFormat.name + mapped.maxTanInputLength = map(tanMethod.maxTanInputLength) ?? -1 + mapped.allowedTanFormat = tanMethod.allowedTanFormat.name return mapped } - func mapTanProcedureType(_ type: String?) -> TanProcedureType { + func mapTanMethodType(_ type: String?) -> TanMethodType { switch type { - case TanProcedureType.entertan.name: - return TanProcedureType.entertan - case TanProcedureType.chiptanmanuell.name: - return TanProcedureType.chiptanmanuell - case TanProcedureType.chiptanflickercode.name: - return TanProcedureType.chiptanflickercode - case TanProcedureType.chiptanusb.name: - return TanProcedureType.chiptanusb - case TanProcedureType.chiptanqrcode.name: - return TanProcedureType.chiptanqrcode - case TanProcedureType.chiptanphototanmatrixcode.name: - return TanProcedureType.chiptanphototanmatrixcode - case TanProcedureType.smstan.name: - return TanProcedureType.smstan - case TanProcedureType.apptan.name: - return TanProcedureType.apptan - case TanProcedureType.phototan.name: - return TanProcedureType.phototan - case TanProcedureType.qrcode.name: - return TanProcedureType.qrcode + case TanMethodType.entertan.name: + return TanMethodType.entertan + case TanMethodType.chiptanmanuell.name: + return TanMethodType.chiptanmanuell + case TanMethodType.chiptanflickercode.name: + return TanMethodType.chiptanflickercode + case TanMethodType.chiptanusb.name: + return TanMethodType.chiptanusb + case TanMethodType.chiptanqrcode.name: + return TanMethodType.chiptanqrcode + case TanMethodType.chiptanphototanmatrixcode.name: + return TanMethodType.chiptanphototanmatrixcode + case TanMethodType.smstan.name: + return TanMethodType.smstan + case TanMethodType.apptan.name: + return TanMethodType.apptan + case TanMethodType.phototan.name: + return TanMethodType.phototan + case TanMethodType.qrcode.name: + return TanMethodType.qrcode default: - return TanProcedureType.entertan + return TanMethodType.entertan } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift index 2d76eea9..5ec83429 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankSettingsDialog.swift @@ -17,7 +17,7 @@ struct BankSettingsDialog: View { @State private var customerId: String @State private var password: String - @State private var selectedTanProcedure: TanProcedure? + @State private var selectedTanMethod: TanMethod? @State private var accountsSorted: [IBankAccount] @@ -28,7 +28,7 @@ struct BankSettingsDialog: View { return bank.displayName != displayName || bank.customerId != customerId || bank.password != password - || bank.selectedTanProcedure != selectedTanProcedure + || bank.selectedTanMethod != selectedTanMethod } @@ -40,7 +40,7 @@ struct BankSettingsDialog: View { _customerId = State(initialValue: bank.customerId) _password = State(initialValue: bank.password) - _selectedTanProcedure = State(initialValue: bank.selectedTanProcedure) + _selectedTanMethod = State(initialValue: bank.selectedTanMethod) _accountsSorted = State(initialValue: bank.accountsSorted) } @@ -59,8 +59,8 @@ struct BankSettingsDialog: View { } Section { - TanProcedurePicker(bank) { selectedTanProcedure in - self.selectedTanProcedure = selectedTanProcedure + TanMethodPicker(bank) { selectedTanMethod in + self.selectedTanMethod = selectedTanMethod } } @@ -133,7 +133,7 @@ struct BankSettingsDialog: View { bank.customerId = customerId bank.password = password - bank.selectedTanProcedure = selectedTanProcedure + bank.selectedTanMethod = selectedTanMethod presenter.accountUpdated(bank: bank) } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/EnterTanDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/EnterTanDialog.swift index 18d171c8..604af40e 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/EnterTanDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/EnterTanDialog.swift @@ -54,7 +54,7 @@ struct EnterTanDialog: View { self.customersTanMedia = customer.tanMediaSorted - self.showSelectTanMediumView = self.customersTanMedia.count > 1 // TODO: use isOpticalTanProcedure && tanMedia.count > 1 + self.showSelectTanMediumView = self.customersTanMedia.count > 1 // TODO: use isOpticalTanMethod && tanMedia.count > 1 self.flickerCodeTanChallenge = tanChallenge as? FlickerCodeTanChallenge self.imageTanChallenge = tanChallenge as? ImageTanChallenge @@ -73,8 +73,8 @@ struct EnterTanDialog: View { var body: some View { Form { Section { - TanProcedurePicker(customer, state.tanChallenge.tanProcedure) { selectedTanProcedure in - self.selectedTanProcedureChanged(selectedTanProcedure) + TanMethodPicker(customer, state.tanChallenge.tanMethod) { selectedTanMethod in + self.selectedTanMethodChanged(selectedTanMethod) } if showSelectTanMediumView { @@ -109,8 +109,8 @@ struct EnterTanDialog: View { .padding(.vertical, 2) Section { - LabelledUIKitTextField(label: "Enter TAN:", text: $enteredTan, keyboardType: tanChallenge.tanProcedure.isNumericTan ? .numberPad : .default, - autocapitalizationType: .none, addDoneButton: tanChallenge.tanProcedure.isNumericTan, actionOnReturnKeyPress: { + LabelledUIKitTextField(label: "Enter TAN:", text: $enteredTan, keyboardType: tanChallenge.tanMethod.isNumericTan ? .numberPad : .default, + autocapitalizationType: .none, addDoneButton: tanChallenge.tanMethod.isNumericTan, actionOnReturnKeyPress: { if self.isRequiredDataEntered() { self.enteringTanDone() return true @@ -143,12 +143,12 @@ struct EnterTanDialog: View { return self.enteredTan.isNotBlank } - private func selectedTanProcedureChanged(_ changeTanProcedureTo: TanProcedure) { - // do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanProcedure()) + private func selectedTanMethodChanged(_ changeTanMethodTo: TanMethod) { + // do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanMethod()) DispatchQueue.main.async { self.dismissDialog() - self.state.callback(EnterTanResult.Companion().userAsksToChangeTanProcedure(changeTanProcedureTo: changeTanProcedureTo)) + self.state.callback(EnterTanResult.Companion().userAsksToChangeTanMethod(changeTanMethodTo: changeTanMethodTo)) } } @@ -216,7 +216,7 @@ struct EnterTanDialog: View { struct EnterTanDialog_Previews: PreviewProvider { static var previews: some View { let customer = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "") - customer.supportedTanProcedures = previewTanProcedures + customer.supportedTanMethods = previewTanMethods customer.tanMedia = previewTanMedia diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/tan/TanMethodPicker.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/tan/TanMethodPicker.swift new file mode 100644 index 00000000..881cf124 --- /dev/null +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/tan/TanMethodPicker.swift @@ -0,0 +1,72 @@ +import SwiftUI +import BankingUiSwift + + +struct TanMethodPicker: View { + + private let bank: ICustomer + + private let selectedTanMethodChanged: (TanMethod) -> Void + + + private var customersTanMethods: [TanMethod] = [] + + private let initiallySelectedTanMethod: TanMethod? + + @State private var selectedTanMethodIndex: Int + + private var selectedTanMethodIndexBinding: Binding { + Binding( + get: { self.selectedTanMethodIndex }, + set: { newValue in + if (self.selectedTanMethodIndex != newValue || self.initiallySelectedTanMethod == nil) { // only if TAN method has really changed + self.selectedTanMethodIndex = newValue + self.dispatchSelectedTanMethodChanged(self.customersTanMethods[newValue]) + } + }) + } + + + init(_ bank: ICustomer, _ initiallySelectedTanMethod: TanMethod? = nil, selectedTanMethodChanged: @escaping (TanMethod) -> Void) { + self.bank = bank + + self.selectedTanMethodChanged = selectedTanMethodChanged + + + self.customersTanMethods = bank.supportedTanMethods.filter( {$0.type != .chiptanusb } ) // USB tan generators are not supported on iOS + + self.initiallySelectedTanMethod = initiallySelectedTanMethod ?? bank.selectedTanMethod + let initiallySelectedTanMethodType = self.initiallySelectedTanMethod?.type + + _selectedTanMethodIndex = State(initialValue: customersTanMethods.firstIndex(where: { $0.type == initiallySelectedTanMethodType } ) + ?? bank.supportedTanMethods.firstIndex(where: { $0.type != .chiptanmanuell && $0.type != .chiptanusb } ) + ?? 0) + } + + + var body: some View { + Picker("TAN method", selection: selectedTanMethodIndexBinding) { + ForEach(0 ..< self.customersTanMethods.count) { index in + Text(self.customersTanMethods[index].displayName) + } + } + } + + + private func dispatchSelectedTanMethodChanged(_ selectedTanMethod: TanMethod) { + // do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanMethod()) + DispatchQueue.main.async { + self.selectedTanMethodChanged(selectedTanMethod) + } + } + +} + + +struct TanMethodPicker_Previews: PreviewProvider { + + static var previews: some View { + TanMethodPicker(previewBanks[0]) { _ in } + } + +} diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/tan/TanProcedurePicker.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/tan/TanProcedurePicker.swift deleted file mode 100644 index d9adcf06..00000000 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/tan/TanProcedurePicker.swift +++ /dev/null @@ -1,72 +0,0 @@ -import SwiftUI -import BankingUiSwift - - -struct TanProcedurePicker: View { - - private let bank: ICustomer - - private let selectedTanProcedureChanged: (TanProcedure) -> Void - - - private var customersTanProcedures: [TanProcedure] = [] - - private let initiallySelectedTanProcedure: TanProcedure? - - @State private var selectedTanProcedureIndex: Int - - private var selectedTanProcedureIndexBinding: Binding { - Binding( - get: { self.selectedTanProcedureIndex }, - set: { newValue in - if (self.selectedTanProcedureIndex != newValue || self.initiallySelectedTanProcedure == nil) { // only if TAN procedure has really changed - self.selectedTanProcedureIndex = newValue - self.dispatchSelectedTanProcedureChanged(self.customersTanProcedures[newValue]) - } - }) - } - - - init(_ bank: ICustomer, _ initiallySelectedTanProcedure: TanProcedure? = nil, selectedTanProcedureChanged: @escaping (TanProcedure) -> Void) { - self.bank = bank - - self.selectedTanProcedureChanged = selectedTanProcedureChanged - - - self.customersTanProcedures = bank.supportedTanProcedures.filter( {$0.type != .chiptanusb } ) // USB tan generators are not supported on iOS - - self.initiallySelectedTanProcedure = initiallySelectedTanProcedure ?? bank.selectedTanProcedure - let initiallySelectedTanProcedureType = self.initiallySelectedTanProcedure?.type - - _selectedTanProcedureIndex = State(initialValue: customersTanProcedures.firstIndex(where: { $0.type == initiallySelectedTanProcedureType } ) - ?? bank.supportedTanProcedures.firstIndex(where: { $0.type != .chiptanmanuell && $0.type != .chiptanusb } ) - ?? 0) - } - - - var body: some View { - Picker("TAN procedure", selection: selectedTanProcedureIndexBinding) { - ForEach(0 ..< self.customersTanProcedures.count) { index in - Text(self.customersTanProcedures[index].displayName) - } - } - } - - - private func dispatchSelectedTanProcedureChanged(_ selectedTanProcedure: TanProcedure) { - // do async as at this point Picker dialog gets dismissed -> this EnterTanDialog would never get dismissed (and dismiss has to be called before callback.changeTanProcedure()) - DispatchQueue.main.async { - self.selectedTanProcedureChanged(selectedTanProcedure) - } - } - -} - - -struct TanProcedurePicker_Previews: PreviewProvider { - - static var previews: some View { - TanProcedurePicker(previewBanks[0]) { _ in } - } - -} diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt index 858b5584..0634b23f 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt @@ -220,7 +220,7 @@ open class fints4kBankingClient( return object : FinTsClientCallback { override fun askUserForTanMethod(supportedTanMethods: List, suggestedTanMethod: TanMethod?, callback: (TanMethod?) -> Unit) { - handleAskUserForTanProcedure(supportedTanMethods, suggestedTanMethod, callback) + handleAskUserForTanMethod(supportedTanMethods, suggestedTanMethod, callback) } override fun enterTan(bank: BankData, tanChallenge: TanChallenge, callback: (EnterTanResult) -> Unit) { @@ -234,13 +234,13 @@ open class fints4kBankingClient( } } - protected open fun handleAskUserForTanProcedure(supportedTanMethods: List, suggestedTanMethod: TanMethod?, callback: (TanMethod?) -> Unit) { + protected open fun handleAskUserForTanMethod(supportedTanMethods: List, suggestedTanMethod: TanMethod?, callback: (TanMethod?) -> Unit) { // we simply return suggestedTanProcedure as even so it's not user's preferred TAN procedure she still can select it in EnterTanDialog callback(suggestedTanMethod) } protected open fun handleEnterTan(bank: BankData, tanChallenge: TanChallenge, enterTanCallback: (EnterTanResult) -> Unit, clientCallback: BankingClientCallback) { - mapper.updateTanMediaAndProcedures(this@fints4kBankingClient.customer, bank) + mapper.updateTanMediaAndMethods(this@fints4kBankingClient.customer, bank) clientCallback.enterTan(this@fints4kBankingClient.customer, mapper.mapTanChallenge(tanChallenge)) { result -> enterTanCallback(mapper.mapEnterTanResult(result, bank)) @@ -248,7 +248,7 @@ open class fints4kBankingClient( } protected open fun handleEnterTanGeneratorAtc(bank: BankData, tanMedium: TanGeneratorTanMedium, enterAtcCallback: (EnterTanGeneratorAtcResult) -> Unit, clientCallback: BankingClientCallback) { - mapper.updateTanMediaAndProcedures(this@fints4kBankingClient.customer, bank) + mapper.updateTanMediaAndMethods(this@fints4kBankingClient.customer, bank) clientCallback.enterTanGeneratorAtc(mapper.mapTanMedium(tanMedium)) { result -> enterAtcCallback(mapper.mapEnterTanGeneratorAtcResult(result)) diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt index f37c4592..94c1f097 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/mapper/fints4kModelMapper.kt @@ -93,7 +93,7 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { bank.bankCode = customer.bankCode - bank.selectedTanMethod = findTanMethod(bank, customer.selectedTanProcedure) ?: bank.selectedTanMethod + bank.selectedTanMethod = findTanMethod(bank, customer.selectedTanMethod) ?: bank.selectedTanMethod } @@ -236,15 +236,15 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { open fun updateTanMediaAndMethods(account: TypedCustomer, bank: BankData) { - account.supportedTanProcedures = bank.tanMethodsAvailableForUser.map { tanMethod -> + account.supportedTanMethods = bank.tanMethodsAvailableForUser.map { tanMethod -> findMappedTanMethod(account, tanMethod) ?: mapTanMethod(tanMethod) } if (bank.isTanMethodSelected) { - account.selectedTanProcedure = findMappedTanMethod(account, bank.selectedTanMethod) + account.selectedTanMethod = findMappedTanMethod(account, bank.selectedTanMethod) } else { - account.selectedTanProcedure = null + account.selectedTanMethod = null } account.tanMedia = bank.tanMedia.map { tanMedium -> @@ -253,12 +253,12 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { } - open fun mapTanMethods(tanMethods: List): List { + open fun mapTanMethods(tanMethods: List): List { return tanMethods.map { mapTanMethod(it) } } - open fun mapTanMethod(tanMethod: net.dankito.banking.fints.model.TanMethod): TanProcedure { - return modelCreator.createTanProcedure( + open fun mapTanMethod(tanMethod: net.dankito.banking.fints.model.TanMethod): TanMethod { + return modelCreator.createTanMethod( tanMethod.displayName, mapTanMethodType(tanMethod.type), tanMethod.securityFunction.code, @@ -267,18 +267,18 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { ) } - open fun mapTanMethodType(type: net.dankito.banking.fints.model.TanMethodType): TanProcedureType { + open fun mapTanMethodType(type: net.dankito.banking.fints.model.TanMethodType): TanMethodType { return when (type) { - net.dankito.banking.fints.model.TanMethodType.EnterTan -> TanProcedureType.EnterTan - net.dankito.banking.fints.model.TanMethodType.ChipTanManuell -> TanProcedureType.ChipTanManuell - net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode -> TanProcedureType.ChipTanFlickercode - net.dankito.banking.fints.model.TanMethodType.ChipTanUsb -> TanProcedureType.ChipTanUsb - net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode -> TanProcedureType.ChipTanQrCode - net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode -> TanProcedureType.ChipTanPhotoTanMatrixCode - net.dankito.banking.fints.model.TanMethodType.SmsTan -> TanProcedureType.SmsTan - net.dankito.banking.fints.model.TanMethodType.AppTan -> TanProcedureType.AppTan - net.dankito.banking.fints.model.TanMethodType.photoTan -> TanProcedureType.photoTan - net.dankito.banking.fints.model.TanMethodType.QrCode -> TanProcedureType.QrCode + net.dankito.banking.fints.model.TanMethodType.EnterTan -> TanMethodType.EnterTan + net.dankito.banking.fints.model.TanMethodType.ChipTanManuell -> TanMethodType.ChipTanManuell + net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode -> TanMethodType.ChipTanFlickercode + net.dankito.banking.fints.model.TanMethodType.ChipTanUsb -> TanMethodType.ChipTanUsb + net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode -> TanMethodType.ChipTanQrCode + net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode -> TanMethodType.ChipTanPhotoTanMatrixCode + net.dankito.banking.fints.model.TanMethodType.SmsTan -> TanMethodType.SmsTan + net.dankito.banking.fints.model.TanMethodType.AppTan -> TanMethodType.AppTan + net.dankito.banking.fints.model.TanMethodType.photoTan -> TanMethodType.photoTan + net.dankito.banking.fints.model.TanMethodType.QrCode -> TanMethodType.QrCode } } @@ -289,16 +289,16 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { } } - protected open fun findMappedTanMethod(customer: TypedCustomer, tanMethod: net.dankito.banking.fints.model.TanMethod): TanProcedure? { - return customer.supportedTanProcedures.firstOrNull { it.bankInternalProcedureCode == tanMethod.securityFunction.code } + protected open fun findMappedTanMethod(customer: TypedCustomer, tanMethod: net.dankito.banking.fints.model.TanMethod): TanMethod? { + return customer.supportedTanMethods.firstOrNull { it.bankInternalMethodCode == tanMethod.securityFunction.code } } - protected open fun findTanMethod(bank: BankData, tanProcedure: TanProcedure?): net.dankito.banking.fints.model.TanMethod? { - if (tanProcedure == null) { + protected open fun findTanMethod(bank: BankData, tanMethod: TanMethod?): net.dankito.banking.fints.model.TanMethod? { + if (tanMethod == null) { return null } - return bank.tanMethodsAvailableForUser.firstOrNull { it.securityFunction.code == tanProcedure.bankInternalProcedureCode } + return bank.tanMethodsAvailableForUser.firstOrNull { it.securityFunction.code == tanMethod.bankInternalMethodCode } } protected open fun findMappedTanMedium(customer: TypedCustomer, tanMedium: net.dankito.banking.fints.messages.datenelemente.implementierte.tan.TanMedium): TanMedium? { @@ -393,29 +393,29 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { } - open fun mapTanMethod(tanProcedure: TanProcedure): net.dankito.banking.fints.model.TanMethod { + open fun mapTanMethod(tanMethod: TanMethod): net.dankito.banking.fints.model.TanMethod { return net.dankito.banking.fints.model.TanMethod( - tanProcedure.displayName, - Sicherheitsfunktion.values().first { it.code == tanProcedure.bankInternalProcedureCode }, - mapTanMethodType(tanProcedure.type), + tanMethod.displayName, + Sicherheitsfunktion.values().first { it.code == tanMethod.bankInternalMethodCode }, + mapTanMethodType(tanMethod.type), null, // TODO: where to get HDD Version from? - tanProcedure.maxTanInputLength, - mapAllowedTanFormat(tanProcedure.allowedTanFormat) + tanMethod.maxTanInputLength, + mapAllowedTanFormat(tanMethod.allowedTanFormat) ) } - open fun mapTanMethodType(type: TanProcedureType): net.dankito.banking.fints.model.TanMethodType { + open fun mapTanMethodType(type: TanMethodType): net.dankito.banking.fints.model.TanMethodType { return when (type) { - TanProcedureType.EnterTan -> net.dankito.banking.fints.model.TanMethodType.EnterTan - TanProcedureType.ChipTanManuell -> net.dankito.banking.fints.model.TanMethodType.ChipTanManuell - TanProcedureType.ChipTanFlickercode -> net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode - TanProcedureType.ChipTanUsb -> net.dankito.banking.fints.model.TanMethodType.ChipTanUsb - TanProcedureType.ChipTanQrCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode - TanProcedureType.ChipTanPhotoTanMatrixCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode - TanProcedureType.SmsTan -> net.dankito.banking.fints.model.TanMethodType.SmsTan - TanProcedureType.AppTan -> net.dankito.banking.fints.model.TanMethodType.AppTan - TanProcedureType.photoTan -> net.dankito.banking.fints.model.TanMethodType.photoTan - TanProcedureType.QrCode -> net.dankito.banking.fints.model.TanMethodType.QrCode + TanMethodType.EnterTan -> net.dankito.banking.fints.model.TanMethodType.EnterTan + TanMethodType.ChipTanManuell -> net.dankito.banking.fints.model.TanMethodType.ChipTanManuell + TanMethodType.ChipTanFlickercode -> net.dankito.banking.fints.model.TanMethodType.ChipTanFlickercode + TanMethodType.ChipTanUsb -> net.dankito.banking.fints.model.TanMethodType.ChipTanUsb + TanMethodType.ChipTanQrCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanQrCode + TanMethodType.ChipTanPhotoTanMatrixCode -> net.dankito.banking.fints.model.TanMethodType.ChipTanPhotoTanMatrixCode + TanMethodType.SmsTan -> net.dankito.banking.fints.model.TanMethodType.SmsTan + TanMethodType.AppTan -> net.dankito.banking.fints.model.TanMethodType.AppTan + TanMethodType.photoTan -> net.dankito.banking.fints.model.TanMethodType.photoTan + TanMethodType.QrCode -> net.dankito.banking.fints.model.TanMethodType.QrCode } } @@ -427,7 +427,7 @@ open class fints4kModelMapper(protected val modelCreator: IModelCreator) { } open fun mapEnterTanResult(result: EnterTanResult, bank: BankData): net.dankito.banking.fints.model.EnterTanResult { - result.changeTanProcedureTo?.let { changeTanMethodTo -> + result.changeTanMethodTo?.let { changeTanMethodTo -> return net.dankito.banking.fints.model.EnterTanResult.userAsksToChangeTanMethod(mapTanMethod(changeTanMethodTo)) }