diff --git a/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt b/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt index 75fcbfe749..20fb3ef396 100644 --- a/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt +++ b/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt @@ -146,38 +146,14 @@ internal class DefaultSingleAccountStatusListProducer @AssistedInject constructo flattenCurrency = flattenCurrency, ) - val accounts = accountListFlow.value.accounts - val hasPaymentAccount = accounts.any { it is Account.Payment } - val hasVirtualAccount = accounts.any { it is Account.Virtual } - logger.i("flattenFlow[$walletId]: payment=$hasPaymentAccount, virtual=$hasVirtualAccount") - val specialStatusFlows = buildList> { - if (hasPaymentAccount) { - add( - paymentAccountStatusSupplier.invoke(userWalletId = walletId) - .onEach { status -> - logger.i( - "flattenFlow[$walletId]: paymentAccountStatus emitted " + - "valueType=${status.value::class.simpleName}", - ) - }, - ) - } - if (hasVirtualAccount) { - add( - virtualAccountStatusSupplier.invoke(userWalletId = walletId) - .onEach { status -> - logger.i( - "flattenFlow[$walletId]: virtualAccountStatus emitted " + - "valueType=${status.value::class.simpleName}", - ) - }, - ) - } - } - val specialStatusesFlow: Flow> = if (specialStatusFlows.isEmpty()) { - flowOf(emptyMap()) - } else { - combine(specialStatusFlows) { statuses -> statuses.associateBy(AccountStatus::accountId) } + val specialStatusesFlow: Flow> = combine( + paymentAccountStatusSupplier.invoke(userWalletId = walletId), + virtualAccountStatusSupplier.invoke(userWalletId = walletId), + ) { paymentStatus, virtualStatus -> + mapOf( + paymentStatus.accountId to paymentStatus, + virtualStatus.accountId to virtualStatus, + ) } combine(