Updated on 2026-08-14
This commit is contained in:
parent
2c2fcd2758
commit
64693f66ca
4 changed files with 51 additions and 25 deletions
|
|
@ -3,7 +3,9 @@ package com.tangem.domain.account.supplier
|
|||
import com.tangem.domain.account.models.AccountList
|
||||
import com.tangem.domain.account.producer.MultiAccountListProducer
|
||||
import com.tangem.domain.core.flow.FlowCachingSupplier
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
/**
|
||||
* Supplier that provides a list of [AccountList]s for all user wallets.
|
||||
|
|
@ -18,4 +20,12 @@ abstract class MultiAccountListSupplier(
|
|||
operator fun invoke(): Flow<List<AccountList>> {
|
||||
return super.invoke(params = Unit)
|
||||
}
|
||||
|
||||
fun invokeMap(): Flow<LinkedHashMap<UserWalletId, AccountList>> = invoke()
|
||||
.map { accountLists ->
|
||||
accountLists.associateByTo(
|
||||
destination = linkedMapOf(),
|
||||
keySelector = { accountList -> accountList.userWalletId },
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue