Updated on 2026-08-14
This commit is contained in:
commit
c3214d41f8
25 changed files with 391 additions and 187 deletions
|
|
@ -70,7 +70,6 @@ internal class AvailableToAddDataConverter @Inject constructor(
|
|||
val availableToAddAccount = accountStatus.getAvailableToAddAccount(wallet) ?: return@mapNotNull null
|
||||
accountStatus.account.accountId to availableToAddAccount
|
||||
}
|
||||
.filter { (_, account) -> account.availableToAddNetworks.isNotEmpty() }
|
||||
.toMap()
|
||||
return AvailableToAddWallet(
|
||||
userWallet = wallet,
|
||||
|
|
|
|||
|
|
@ -344,9 +344,10 @@ internal class AddToPortfolioModel @Inject constructor(
|
|||
portfolioSelectorController.isEnabled.value = isEnabled@{ userWallet, accountStatus ->
|
||||
val availableWallet = state.availableToAddData.availableToAddWallets[userWallet.walletId]
|
||||
?: return@isEnabled false
|
||||
val availableAccount =
|
||||
val isAvailableAccount =
|
||||
availableWallet.availableToAddAccounts[accountStatus.account.accountId]
|
||||
return@isEnabled availableAccount != null
|
||||
?.isAvailableToAdd == true
|
||||
return@isEnabled isAvailableAccount
|
||||
}
|
||||
AddToPortfolioManager.State.Init,
|
||||
AddToPortfolioManager.State.NothingToAdd,
|
||||
|
|
|
|||
|
|
@ -25,15 +25,19 @@ internal class UpdateGlobalFeedStateTransformer(
|
|||
prevState.news.newsUMState == NewsUMState.ERROR
|
||||
|
||||
val hasLoadingInCharts = loadingStatesByOrder.values.any { it }
|
||||
val hasErrorInCharts = errorStatesByOrder.values.any { it != null }
|
||||
val hasAllErrorInCharts = errorStatesByOrder.values.isNotEmpty() && errorStatesByOrder.values.all { it != null }
|
||||
val hasErrorInMarketChart = errorStatesByOrder[SortByTypeUM.Rating] != null
|
||||
val hasErrorInMarketPulseChart = errorStatesByOrder
|
||||
.any { it.key != SortByTypeUM.Rating && it.value != null }
|
||||
|
||||
val areAllChartsLoading = loadingStatesByOrder.values.isNotEmpty() && loadingStatesByOrder.values.all { it }
|
||||
val areAllChartsError = hasAllErrorInCharts || hasErrorInCharts && hasLoadingInCharts
|
||||
val areAllChartsError = when {
|
||||
hasErrorInMarketChart && hasErrorInMarketPulseChart -> true
|
||||
hasErrorInMarketPulseChart && hasLoadingInCharts -> true
|
||||
hasErrorInMarketChart && hasLoadingInCharts -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
val newGlobalState = when {
|
||||
isNewsLoading && areAllChartsError -> GlobalFeedState.Loading
|
||||
isNewsLoading && areAllChartsLoading -> GlobalFeedState.Loading
|
||||
isNewsError && areAllChartsLoading -> GlobalFeedState.Loading
|
||||
isNewsError && areAllChartsError -> {
|
||||
if (previousGlobalState !is GlobalFeedState.Error) {
|
||||
|
|
@ -43,18 +47,11 @@ internal class UpdateGlobalFeedStateTransformer(
|
|||
onRetryClicked = onRetryClicked,
|
||||
)
|
||||
}
|
||||
isNewsLoading && areAllChartsError -> GlobalFeedState.Loading
|
||||
isNewsLoading && areAllChartsLoading -> GlobalFeedState.Loading
|
||||
else -> GlobalFeedState.Content
|
||||
}
|
||||
|
||||
return prevState.copy(
|
||||
globalState = newGlobalState,
|
||||
news = prevState.news.copy(
|
||||
newsUMState = when {
|
||||
isNewsError -> NewsUMState.ERROR
|
||||
else -> NewsUMState.CONTENT
|
||||
},
|
||||
),
|
||||
)
|
||||
return prevState.copy(globalState = newGlobalState)
|
||||
}
|
||||
|
||||
private fun sendErrorAnalytics() {
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ private fun Charts(
|
|||
) {
|
||||
BlockCard(
|
||||
modifier = modifier,
|
||||
colors = TangemBlockCardColors.copy(containerColor = TangemTheme.colors.background.action),
|
||||
colors = TangemBlockCardColors.copy(containerColor = TangemTheme.colors.background.primary),
|
||||
) {
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
when (marketChart) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue