Moved FinTsClientCallback creation from MainWindowPresenter to MainActivity

This commit is contained in:
dankl 2019-10-26 01:04:44 +02:00 committed by dankito
parent 9e6b8841aa
commit 2c95f06a13
2 changed files with 20 additions and 16 deletions

View File

@ -10,12 +10,26 @@ import android.view.Menu
import androidx.navigation.findNavController
import net.dankito.banking.fints4java.android.ui.MainWindowPresenter
import net.dankito.banking.fints4java.android.ui.dialogs.AddAccountDialog
import net.dankito.fints.FinTsClientCallback
import net.dankito.fints.model.TanChallenge
import net.dankito.fints.model.TanProcedure
class MainActivity : AppCompatActivity() {
// private lateinit var appBarConfiguration: AppBarConfiguration
val presenter = MainWindowPresenter()
val presenter = MainWindowPresenter(callback = object : FinTsClientCallback {
override fun askUserForTanProcedure(supportedTanProcedures: List<TanProcedure>): TanProcedure? {
// TODO: show dialog and ask user
return supportedTanProcedures.first()
}
override fun enterTan(tanChallenge: TanChallenge): String? {
return null
}
})
override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -4,7 +4,10 @@ import net.dankito.banking.fints4java.android.Base64ServiceAndroid
import net.dankito.fints.FinTsClient
import net.dankito.fints.FinTsClientCallback
import net.dankito.fints.banks.BankFinder
import net.dankito.fints.model.*
import net.dankito.fints.model.BankData
import net.dankito.fints.model.BankInfo
import net.dankito.fints.model.CustomerData
import net.dankito.fints.model.GetTransactionsParameter
import net.dankito.fints.model.mapper.BankDataMapper
import net.dankito.fints.response.client.FinTsClientResponse
import net.dankito.fints.response.client.GetTransactionsResponse
@ -12,20 +15,7 @@ import net.dankito.utils.IThreadPool
import net.dankito.utils.ThreadPool
open class MainWindowPresenter {
protected val callback = object : FinTsClientCallback {
override fun askUserForTanProcedure(supportedTanProcedures: List<TanProcedure>): TanProcedure? {
// TODO: show dialog and ask user
return supportedTanProcedures.first()
}
override fun enterTan(tanChallenge: TanChallenge): String? {
return null
}
}
open class MainWindowPresenter(callback: FinTsClientCallback) {
protected val finTsClient = FinTsClient(callback, Base64ServiceAndroid())