Moved BankingClientCallback creation now to MainWindowPresenter
This commit is contained in:
parent
3f4553281d
commit
2f2a34fedf
|
@ -11,8 +11,6 @@ import com.github.clans.fab.FloatingActionMenu
|
||||||
import kotlinx.android.synthetic.main.action_view_account_menu_item.view.*
|
import kotlinx.android.synthetic.main.action_view_account_menu_item.view.*
|
||||||
import net.dankito.banking.fints4java.android.ui.MainWindowPresenter
|
import net.dankito.banking.fints4java.android.ui.MainWindowPresenter
|
||||||
import net.dankito.banking.fints4java.android.ui.dialogs.AddAccountDialog
|
import net.dankito.banking.fints4java.android.ui.dialogs.AddAccountDialog
|
||||||
import net.dankito.banking.fints4java.android.ui.dialogs.EnterAtcDialog
|
|
||||||
import net.dankito.banking.fints4java.android.ui.dialogs.EnterTanDialog
|
|
||||||
import net.dankito.banking.fints4java.android.ui.views.MainActivityFloatingActionMenuButton
|
import net.dankito.banking.fints4java.android.ui.views.MainActivityFloatingActionMenuButton
|
||||||
import net.dankito.banking.fints4java.android.util.Base64ServiceAndroid
|
import net.dankito.banking.fints4java.android.util.Base64ServiceAndroid
|
||||||
import net.dankito.banking.fints4javaBankingClientCreator
|
import net.dankito.banking.fints4javaBankingClientCreator
|
||||||
|
@ -33,20 +31,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
private lateinit var floatingActionMenuButton: MainActivityFloatingActionMenuButton
|
private lateinit var floatingActionMenuButton: MainActivityFloatingActionMenuButton
|
||||||
|
|
||||||
|
|
||||||
val presenter = MainWindowPresenter(fints4javaBankingClientCreator(),
|
val presenter = MainWindowPresenter(fints4javaBankingClientCreator(), Base64ServiceAndroid(), RouterAndroid(this))
|
||||||
Base64ServiceAndroid(), object : BankingClientCallback {
|
|
||||||
|
|
||||||
override fun enterTan(account: Account, tanChallenge: TanChallenge): EnterTanResult {
|
|
||||||
return getTanFromUserOffUiThread(account, tanChallenge)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun enterTanGeneratorAtc(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult {
|
|
||||||
return getAtcFromUserOffUiThread(tanMedium)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
private val router = RouterAndroid(this, presenter)
|
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.dankito.banking.fints4java.android.ui
|
||||||
import net.dankito.banking.ui.BankingClientCallback
|
import net.dankito.banking.ui.BankingClientCallback
|
||||||
import net.dankito.banking.ui.IBankingClient
|
import net.dankito.banking.ui.IBankingClient
|
||||||
import net.dankito.banking.ui.IBankingClientCreator
|
import net.dankito.banking.ui.IBankingClientCreator
|
||||||
|
import net.dankito.banking.ui.IRouter
|
||||||
import net.dankito.banking.ui.model.Account
|
import net.dankito.banking.ui.model.Account
|
||||||
import net.dankito.banking.ui.model.AccountTransaction
|
import net.dankito.banking.ui.model.AccountTransaction
|
||||||
import net.dankito.banking.ui.model.BankAccount
|
import net.dankito.banking.ui.model.BankAccount
|
||||||
|
@ -10,6 +11,10 @@ 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.util.IBase64Service
|
import net.dankito.banking.util.IBase64Service
|
||||||
import net.dankito.fints.banks.BankFinder
|
import net.dankito.fints.banks.BankFinder
|
||||||
import net.dankito.fints.model.BankInfo
|
import net.dankito.fints.model.BankInfo
|
||||||
|
@ -24,7 +29,7 @@ import kotlin.collections.ArrayList
|
||||||
open class MainWindowPresenter(
|
open class MainWindowPresenter(
|
||||||
protected val bankingClientCreator: IBankingClientCreator,
|
protected val bankingClientCreator: IBankingClientCreator,
|
||||||
protected val base64Service: IBase64Service,
|
protected val base64Service: IBase64Service,
|
||||||
protected val callback: BankingClientCallback
|
protected val router: IRouter
|
||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -44,6 +49,19 @@ open class MainWindowPresenter(
|
||||||
protected val retrievedAccountTransactionsResponseListeners = mutableListOf<(BankAccount, GetTransactionsResponse) -> Unit>()
|
protected val retrievedAccountTransactionsResponseListeners = mutableListOf<(BankAccount, GetTransactionsResponse) -> Unit>()
|
||||||
|
|
||||||
|
|
||||||
|
protected val callback: BankingClientCallback = object : BankingClientCallback {
|
||||||
|
|
||||||
|
override fun enterTan(account: Account, tanChallenge: TanChallenge): EnterTanResult {
|
||||||
|
return router.getTanFromUserOffUiThread(account, tanChallenge)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun enterTanGeneratorAtc(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult {
|
||||||
|
return router.getAtcFromUserOffUiThread(tanMedium)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: move BankInfo out of fints4javaLib
|
// TODO: move BankInfo out of fints4javaLib
|
||||||
open fun addAccountAsync(bankInfo: BankInfo, customerId: String, pin: String, callback: (AddAccountResponse) -> Unit) {
|
open fun addAccountAsync(bankInfo: BankInfo, customerId: String, pin: String, callback: (AddAccountResponse) -> Unit) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue