Updated on 2026-08-14
This commit is contained in:
parent
1e85dbe6f7
commit
1006477fd7
5 changed files with 46 additions and 22 deletions
|
|
@ -56,6 +56,7 @@ internal class PortfolioDataLoader @Inject constructor(
|
|||
ids = portfolioData.walletsWithCurrencies.keys.map(UserWallet::walletId),
|
||||
)
|
||||
.map { portfolioData.copy(walletsWithBalance = it) }
|
||||
.onEmpty { emit(portfolioData) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,6 +94,19 @@ internal class PortfolioDataLoader @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
.onEmpty {
|
||||
emit(
|
||||
walletsWithStatuses.mapValues { (wallet, statuses) ->
|
||||
statuses.map {
|
||||
PortfolioData.CryptoCurrencyData(
|
||||
userWallet = wallet,
|
||||
status = it,
|
||||
actions = emptyList(),
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,21 +72,16 @@ internal class MyPortfolioUMFactory(
|
|||
portfolioData: PortfolioData,
|
||||
portfolioUIData: PortfolioUIData,
|
||||
): TangemBottomSheetConfig {
|
||||
val walletId = portfolioUIData.selectedWalletId
|
||||
?: portfolioData.walletsWithCurrencies.keys.firstOrNull { it.isMultiCurrency }?.walletId
|
||||
|
||||
val selectedWallet = portfolioData.walletsWithCurrencies.keys
|
||||
.firstOrNull { it.walletId == walletId }
|
||||
?: error("portfolioModel.walletsWithCurrencyStatuses doesn't contain selected wallet: $walletId")
|
||||
.firstOrNull { it.walletId == portfolioUIData.selectedWalletId }
|
||||
?: portfolioData.walletsWithCurrencies.keys.firstOrNull { it.isMultiCurrency }
|
||||
?: error("walletsWithCurrencies don't contain selected wallet or any multi-currency wallet")
|
||||
|
||||
val availableNetworks = portfolioUIData.addToPortfolioData.availableNetworks.orEmpty()
|
||||
|
||||
val alreadyAddedNetworks = requireNotNull(
|
||||
value = portfolioData.walletsWithCurrencies
|
||||
.filterAvailableNetworks(availableNetworks)[selectedWallet],
|
||||
lazyMessage = {
|
||||
"portfolioModel.walletsWithCurrencyStatuses doesn't contain selected wallet: $walletId"
|
||||
},
|
||||
value = portfolioData.walletsWithCurrencies.filterAvailableNetworks(availableNetworks)[selectedWallet],
|
||||
lazyMessage = { "walletsWithCurrencies don't contain ${selectedWallet.walletId}" },
|
||||
)
|
||||
.map { it.status.currency.network.backendId }
|
||||
.toSet()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue