From f536fe0844322fcaff78a822c49005cbcd5c471b Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 10 Jul 2026 05:08:58 -0700 Subject: [PATCH] Updated on 2026-08-14 --- .../DefaultSingleAccountStatusListProducer.kt | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) 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(