Updated on 2026-08-14

This commit is contained in:
Tangem 2025-02-19 17:35:03 +04:00
parent 36e7f2d07f
commit 6f47e7d742
8 changed files with 42 additions and 7 deletions

View file

@ -20,6 +20,7 @@ import com.tangem.core.ui.R
import com.tangem.core.ui.components.RectangleShimmer
import com.tangem.core.ui.components.SpacerW4
import com.tangem.core.ui.components.SpacerW6
import com.tangem.core.ui.components.flicker
import com.tangem.core.ui.components.marketprice.PriceChangeType
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringReference
@ -37,6 +38,7 @@ internal fun TokenPrice(state: TokenPriceState?, modifier: Modifier = Modifier)
price = state.price,
type = state.type,
priceChangePercent = state.priceChangePercent,
isFlickering = state.isFlickering,
)
}
is TokenPriceState.TextContent -> {
@ -58,11 +60,12 @@ internal fun TokenPrice(state: TokenPriceState?, modifier: Modifier = Modifier)
@Composable
private fun PriceBlock(
price: String,
isFlickering: Boolean,
modifier: Modifier = Modifier,
type: PriceChangeType? = null,
priceChangePercent: String? = null,
) {
Row(modifier = modifier, verticalAlignment = Alignment.CenterVertically) {
Row(modifier = modifier.flicker(isFlickering), verticalAlignment = Alignment.CenterVertically) {
PriceText(text = price, modifier = Modifier.weight(weight = 1f, fill = false))
SpacerW6()
@ -149,16 +152,19 @@ private class TokenPriceChangeStateProvider : CollectionPreviewParameterProvider
price = "1.234",
priceChangePercent = "2.5%",
type = PriceChangeType.UP,
isFlickering = false,
),
TokenPriceState.CryptoPriceContent(
price = "1.234",
priceChangePercent = "2.5%",
type = PriceChangeType.DOWN,
isFlickering = false,
),
TokenPriceState.CryptoPriceContent(
price = "1.234",
priceChangePercent = "2.5%",
type = PriceChangeType.NEUTRAL,
isFlickering = false,
),
TokenPriceState.TextContent(value = stringReference(value = "Subtitle"), isAvailable = true),
TokenPriceState.Unknown,

View file

@ -181,6 +181,7 @@ sealed class TokenItemState {
val price: String,
val priceChangePercent: String,
val type: PriceChangeType,
val isFlickering: Boolean = false,
) : SubtitleState()
data class TextContent(val value: TextReference, val isAvailable: Boolean = true) : SubtitleState()

View file

@ -58,6 +58,7 @@ internal class WalletWarningsAnalyticsSender @Inject constructor(
is WalletNotification.Warning.LowSignatures,
is WalletNotification.Warning.SomeNetworksUnreachable,
is WalletNotification.Warning.NetworksUnreachable,
is WalletNotification.UsedOutdatedData,
-> null
is WalletNotification.Critical.SeedPhraseNotification -> MainScreen.NoticeSeedPhraseSupport
is WalletNotification.Critical.SeedPhraseSecondNotification -> MainScreen.NoticeSeedPhraseSupportSecond

View file

@ -4,6 +4,7 @@ import com.tangem.domain.common.CardTypesResolver
import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.core.lce.Lce
import com.tangem.domain.demo.IsDemoCardUseCase
import com.tangem.domain.models.StatusSource
import com.tangem.domain.settings.IsReadyToShowRateAppUseCase
import com.tangem.domain.tokens.error.TokenListError
import com.tangem.domain.tokens.model.CryptoCurrency
@ -45,6 +46,8 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
flow4 = seedPhraseNotificationUseCase(userWalletId = userWallet.walletId),
) { maybeTokenList, isReadyToShowRating, isNeedToBackup, seedPhraseIssueStatus ->
buildList {
addUsedOutdatedDataNotification(maybeTokenList)
addCriticalNotifications(userWallet, seedPhraseIssueStatus, clickIntents)
addInformationalNotifications(cardTypesResolver, maybeTokenList, clickIntents)
@ -62,6 +65,22 @@ internal class GetMultiWalletWarningsFactory @Inject constructor(
}
}
private fun MutableList<WalletNotification>.addUsedOutdatedDataNotification(
maybeTokenList: Lce<TokenListError, TokenList>,
) {
val tokenList = maybeTokenList.getOrNull(isPartialContentAccepted = false)?.flattenCurrencies().orEmpty()
val hasOnlyCachedData = tokenList.any {
when (val value = it.value) {
is CryptoCurrencyStatus.Loaded -> value.source == StatusSource.ONLY_CACHE
is CryptoCurrencyStatus.NoAccount -> value.source == StatusSource.ONLY_CACHE
else -> false
}
}
addIf(element = WalletNotification.UsedOutdatedData, condition = hasOnlyCachedData)
}
private fun MutableList<WalletNotification>.addCriticalNotifications(
userWallet: UserWallet,
seedPhraseIssueStatus: SeedPhraseNotificationsStatus,

View file

@ -234,4 +234,11 @@ sealed class WalletNotification(val config: NotificationConfig) {
),
),
)
data object UsedOutdatedData : WalletNotification(
config = NotificationConfig(
subtitle = resourceReference(R.string.warning_some_token_balances_not_updated),
iconResId = R.drawable.ic_error_sync_24,
),
)
}

View file

@ -3,9 +3,9 @@ package com.tangem.feature.wallet.presentation.wallet.state.model
import androidx.compose.runtime.Immutable
import com.tangem.common.ui.expressStatus.state.ExpressTransactionStateUM
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.containers.pullToRefresh.PullToRefreshConfig
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
import com.tangem.core.ui.components.transactions.state.TxHistoryState
import com.tangem.core.ui.components.containers.pullToRefresh.PullToRefreshConfig
import com.tangem.feature.wallet.presentation.wallet.state.model.holder.LockedTxHistoryStateHolder
import com.tangem.feature.wallet.presentation.wallet.state.model.holder.LockedWalletStateHolder
import com.tangem.feature.wallet.presentation.wallet.state.model.holder.TxHistoryStateHolder

View file

@ -279,21 +279,21 @@ private fun TitleText(text: String, modifier: Modifier = Modifier) {
@Composable
private fun Balance(state: WalletCardState, isBalanceHidden: Boolean, modifier: Modifier = Modifier) {
AnimatedContent(
targetState = state,
targetState = (state as? WalletCardState.Content)?.balance?.orMaskWithStars(isBalanceHidden).orEmpty(),
label = "Update the balance",
modifier = modifier,
transitionSpec = {
fadeIn(animationSpec = tween(durationMillis = 220, delayMillis = 90)) togetherWith
fadeOut(animationSpec = tween(durationMillis = 90))
},
) { walletCardState ->
when (walletCardState) {
) { balance ->
when (state) {
is WalletCardState.Content -> {
ResizableText(
modifier = Modifier
.defaultMinSize(minHeight = TangemTheme.dimens.size32)
.flicker(isFlickering = walletCardState.isBalanceFlickering),
text = walletCardState.balance.orMaskWithStars(isBalanceHidden),
.flicker(isFlickering = state.isBalanceFlickering),
text = balance,
fontSizeRange = FontSizeRange(min = 16.sp, max = TangemTheme.typography.h2.fontSize),
color = TangemTheme.colors.text.primary1,
overflow = TextOverflow.Ellipsis,

View file

@ -43,6 +43,7 @@ internal fun LazyListScope.notifications(configs: ImmutableList<WalletNotificati
is WalletNotification.Informational -> TangemTheme.colors.icon.accent
is WalletNotification.RateApp -> TangemTheme.colors.icon.attention
is WalletNotification.UnlockWallets -> TangemTheme.colors.icon.primary1
is WalletNotification.UsedOutdatedData -> TangemTheme.colors.text.attention
else -> null
},
)