Implemented to not close dialogs when adding a new account to speed things up a bit

This commit is contained in:
dankito 2020-05-16 19:26:49 +02:00
parent 124b3ca9f6
commit 0e9097f8cc
1 changed files with 11 additions and 2 deletions

View File

@ -56,6 +56,8 @@ open class FinTsClient @JvmOverloads constructor(
} }
open var areWeThatGentleToCloseDialogs: Boolean = true
protected val messageLogField = CopyOnWriteArrayList<MessageLogEntry>() protected val messageLogField = CopyOnWriteArrayList<MessageLogEntry>()
open val messageLog: List<MessageLogEntry> open val messageLog: List<MessageLogEntry>
@ -99,7 +101,8 @@ open class FinTsClient @JvmOverloads constructor(
protected open fun closeAnonymousDialog(dialogContext: DialogContext, response: Response) { protected open fun closeAnonymousDialog(dialogContext: DialogContext, response: Response) {
if (dialogContext.didBankCloseDialog) { // bank already closed dialog -> there's no need to send dialog end message // bank already closed dialog -> there's no need to send dialog end message
if (areWeThatGentleToCloseDialogs == false || dialogContext.didBankCloseDialog) {
return return
} }
@ -170,6 +173,9 @@ open class FinTsClient @JvmOverloads constructor(
open fun addAccount(bank: BankData, customer: CustomerData): AddAccountResponse { open fun addAccount(bank: BankData, customer: CustomerData): AddAccountResponse {
val originalAreWeThatGentleToCloseDialogs = areWeThatGentleToCloseDialogs
areWeThatGentleToCloseDialogs = false
/* First dialog: Get user's basic data like her TAN procedures */ /* First dialog: Get user's basic data like her TAN procedures */
val newUserInfoResponse = getBankAndCustomerInfoForNewUser(bank, customer) val newUserInfoResponse = getBankAndCustomerInfoForNewUser(bank, customer)
@ -220,6 +226,8 @@ open class FinTsClient @JvmOverloads constructor(
customer.resetSelectedTanProcedure() customer.resetSelectedTanProcedure()
} }
areWeThatGentleToCloseDialogs = originalAreWeThatGentleToCloseDialogs
val supportsRetrievingTransactionsOfLast90DaysWithoutTan = transactionsOfLast90DaysResponses.firstOrNull { it.isSuccessful } != null val supportsRetrievingTransactionsOfLast90DaysWithoutTan = transactionsOfLast90DaysResponses.firstOrNull { it.isSuccessful } != null
val unbookedTransactions = transactionsOfLast90DaysResponses.flatMap { it.unbookedTransactions } val unbookedTransactions = transactionsOfLast90DaysResponses.flatMap { it.unbookedTransactions }
val bookedTransactions = transactionsOfLast90DaysResponses.flatMap { it.bookedTransactions } val bookedTransactions = transactionsOfLast90DaysResponses.flatMap { it.bookedTransactions }
@ -486,7 +494,8 @@ open class FinTsClient @JvmOverloads constructor(
protected open fun closeDialog(dialogContext: DialogContext) { protected open fun closeDialog(dialogContext: DialogContext) {
if (dialogContext.didBankCloseDialog) { // bank already closed dialog -> there's no need to send dialog end message // bank already closed dialog -> there's no need to send dialog end message
if (areWeThatGentleToCloseDialogs == false || dialogContext.didBankCloseDialog) {
return return
} }