Fixed using of IAsyncRunner instead of IThreadPool
This commit is contained in:
parent
f4312c52db
commit
b05d927356
|
@ -25,7 +25,6 @@ import net.dankito.text.extraction.info.invoice.IInvoiceDataExtractor
|
||||||
import net.dankito.text.extraction.info.invoice.InvoiceDataExtractor
|
import net.dankito.text.extraction.info.invoice.InvoiceDataExtractor
|
||||||
import net.dankito.text.extraction.pdf.PdfBoxAndroidPdfTextExtractor
|
import net.dankito.text.extraction.pdf.PdfBoxAndroidPdfTextExtractor
|
||||||
import net.dankito.text.extraction.pdf.iText2PdfTextExtractor
|
import net.dankito.text.extraction.pdf.iText2PdfTextExtractor
|
||||||
import net.dankito.utils.IThreadPool
|
|
||||||
import net.dankito.utils.ThreadPool
|
import net.dankito.utils.ThreadPool
|
||||||
import net.dankito.utils.web.client.IWebClient
|
import net.dankito.utils.web.client.IWebClient
|
||||||
import net.dankito.utils.web.client.OkHttpWebClient
|
import net.dankito.utils.web.client.OkHttpWebClient
|
||||||
|
@ -92,9 +91,9 @@ class BankingModule(private val applicationContext: Context) {
|
||||||
@Named(DataFolderKey) dataFolder: File,
|
@Named(DataFolderKey) dataFolder: File,
|
||||||
persister: IBankingPersistence, remitteeSearcher: IRemitteeSearcher, bankIconFinder: IBankIconFinder,
|
persister: IBankingPersistence, remitteeSearcher: IRemitteeSearcher, bankIconFinder: IBankIconFinder,
|
||||||
textExtractorRegistry: ITextExtractorRegistry, router: IRouter, invoiceDataExtractor: IInvoiceDataExtractor,
|
textExtractorRegistry: ITextExtractorRegistry, router: IRouter, invoiceDataExtractor: IInvoiceDataExtractor,
|
||||||
serializer: ISerializer, threadPool: IThreadPool) : BankingPresenter {
|
serializer: ISerializer, asyncRunner: IAsyncRunner) : BankingPresenter {
|
||||||
return BankingPresenter(bankingClientCreator, bankFinder, dataFolder, persister,
|
return BankingPresenter(bankingClientCreator, bankFinder, dataFolder, persister,
|
||||||
remitteeSearcher, bankIconFinder, textExtractorRegistry, router, invoiceDataExtractor, serializer, threadPool)
|
remitteeSearcher, bankIconFinder, textExtractorRegistry, router, invoiceDataExtractor, serializer, asyncRunner)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@ -170,14 +169,14 @@ class BankingModule(private val applicationContext: Context) {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideBase64Service() : net.dankito.banking.util.IBase64Service {
|
fun provideBase64Service() : IBase64Service {
|
||||||
return Base64ServiceAndroid()
|
return Base64ServiceAndroid()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideThreadPool() : IThreadPool {
|
fun provideAsyncRunner() : IAsyncRunner {
|
||||||
return ThreadPool()
|
return ThreadPoolAsyncRunner(ThreadPool())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,10 +3,8 @@ package net.dankito.banking
|
||||||
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.util.IBase64Service
|
|
||||||
import net.dankito.banking.bankfinder.BankInfo
|
import net.dankito.banking.bankfinder.BankInfo
|
||||||
import net.dankito.utils.IThreadPool
|
import net.dankito.banking.util.IAsyncRunner
|
||||||
import net.dankito.utils.web.client.IWebClient
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +15,7 @@ open class fints4kBankingClientCreator : IBankingClientCreator {
|
||||||
customerId: String,
|
customerId: String,
|
||||||
pin: String,
|
pin: String,
|
||||||
dataFolder: File,
|
dataFolder: File,
|
||||||
threadPool: IThreadPool,
|
asyncRunner: IAsyncRunner,
|
||||||
callback: BankingClientCallback
|
callback: BankingClientCallback
|
||||||
): IBankingClient {
|
): IBankingClient {
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.dankito.banking.ui.model.responses.GetTransactionsResponse
|
||||||
import net.dankito.banking.util.AccountTransactionMapper
|
import net.dankito.banking.util.AccountTransactionMapper
|
||||||
import net.dankito.banking.util.hbci4jModelMapper
|
import net.dankito.banking.util.hbci4jModelMapper
|
||||||
import net.dankito.banking.bankfinder.BankInfo
|
import net.dankito.banking.bankfinder.BankInfo
|
||||||
import net.dankito.utils.IThreadPool
|
import net.dankito.banking.util.*
|
||||||
import net.dankito.utils.ThreadPool
|
import net.dankito.utils.ThreadPool
|
||||||
import org.kapott.hbci.GV.HBCIJob
|
import org.kapott.hbci.GV.HBCIJob
|
||||||
import org.kapott.hbci.GV_Result.GVRKUms
|
import org.kapott.hbci.GV_Result.GVRKUms
|
||||||
|
@ -37,7 +37,7 @@ open class hbci4jBankingClient(
|
||||||
customerId: String,
|
customerId: String,
|
||||||
pin: String,
|
pin: String,
|
||||||
protected val dataFolder: File,
|
protected val dataFolder: File,
|
||||||
protected val threadPool: IThreadPool = ThreadPool(),
|
protected val asyncRunner: IAsyncRunner = ThreadPoolAsyncRunner(ThreadPool()),
|
||||||
protected val callback: BankingClientCallback
|
protected val callback: BankingClientCallback
|
||||||
) : IBankingClient {
|
) : IBankingClient {
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ open class hbci4jBankingClient(
|
||||||
|
|
||||||
|
|
||||||
override fun addAccountAsync(callback: (AddAccountResponse) -> Unit) {
|
override fun addAccountAsync(callback: (AddAccountResponse) -> Unit) {
|
||||||
threadPool.runAsync {
|
asyncRunner.runAsync {
|
||||||
callback(addAccount())
|
callback(addAccount())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ open class hbci4jBankingClient(
|
||||||
* or not.
|
* or not.
|
||||||
*/
|
*/
|
||||||
open fun getTransactionsOfLast90DaysAsync(bankAccount: BankAccount, callback: (GetTransactionsResponse) -> Unit) {
|
open fun getTransactionsOfLast90DaysAsync(bankAccount: BankAccount, callback: (GetTransactionsResponse) -> Unit) {
|
||||||
threadPool.runAsync {
|
asyncRunner.runAsync {
|
||||||
callback(getTransactionsOfLast90Days(bankAccount))
|
callback(getTransactionsOfLast90Days(bankAccount))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ open class hbci4jBankingClient(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTransactionsAsync(bankAccount: BankAccount, parameter: GetTransactionsParameter, callback: (GetTransactionsResponse) -> Unit) {
|
override fun getTransactionsAsync(bankAccount: BankAccount, parameter: GetTransactionsParameter, callback: (GetTransactionsResponse) -> Unit) {
|
||||||
threadPool.runAsync {
|
asyncRunner.runAsync {
|
||||||
callback(getTransactions(bankAccount, parameter))
|
callback(getTransactions(bankAccount, parameter))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ open class hbci4jBankingClient(
|
||||||
|
|
||||||
|
|
||||||
override fun transferMoneyAsync(data: TransferMoneyData, bankAccount: BankAccount, callback: (BankingClientResponse) -> Unit) {
|
override fun transferMoneyAsync(data: TransferMoneyData, bankAccount: BankAccount, callback: (BankingClientResponse) -> Unit) {
|
||||||
threadPool.runAsync {
|
asyncRunner.runAsync {
|
||||||
callback(transferMoney(data, bankAccount))
|
callback(transferMoney(data, bankAccount))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ 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.bankfinder.BankInfo
|
import net.dankito.banking.bankfinder.BankInfo
|
||||||
import net.dankito.utils.IThreadPool
|
import net.dankito.banking.util.IAsyncRunner
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ open class hbci4jBankingClientCreator : IBankingClientCreator {
|
||||||
customerId: String,
|
customerId: String,
|
||||||
pin: String,
|
pin: String,
|
||||||
dataFolder: File,
|
dataFolder: File,
|
||||||
threadPool: IThreadPool,
|
asyncRunner: IAsyncRunner,
|
||||||
callback: BankingClientCallback
|
callback: BankingClientCallback
|
||||||
): IBankingClient {
|
): IBankingClient {
|
||||||
|
|
||||||
return hbci4jBankingClient(bankInfo, customerId, pin, dataFolder, threadPool, callback)
|
return hbci4jBankingClient(bankInfo, customerId, pin, dataFolder, asyncRunner, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue