Updated on 2026-08-14
This commit is contained in:
parent
acf110dbcc
commit
6910f74fd9
242 changed files with 866 additions and 732 deletions
|
|
@ -53,7 +53,7 @@ class AmountReduceByTransformer(
|
|||
|
||||
val checkValue = if (amountTextField.isFiatValue) fiatValue else cryptoValue
|
||||
val isExceedBalance = checkValue.checkExceedBalance(maxEnterAmount, amountTextField)
|
||||
val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } ?: false
|
||||
val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } == true
|
||||
val isZero = if (amountTextField.isFiatValue) {
|
||||
decimalFiatValue.isNullOrZero()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class AmountReduceToTransformer(
|
|||
|
||||
val checkValue = if (amountTextField.isFiatValue) fiatValue else cryptoValue
|
||||
val isExceedBalance = checkValue.checkExceedBalance(maxEnterAmount, amountTextField)
|
||||
val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } ?: false
|
||||
val isLessThanMinimumIfProvided = minimumTransactionAmount?.amount?.let { decimalCryptoValue < it } == true
|
||||
val isZero = if (amountTextField.isFiatValue) decimalFiatValue.isNullOrZero() else value.isNullOrZero()
|
||||
val isCheckFailed = isExceedBalance || isLessThanMinimumIfProvided
|
||||
return prevState.copy(
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class AmountStateConverter(
|
|||
val status = cryptoCurrencyStatusProvider()
|
||||
val fiat = maxEnterAmount.fiatAmount.format { fiat(appCurrency.code, appCurrency.symbol) }
|
||||
val crypto = maxEnterAmount.amount.format { crypto(status.currency) }
|
||||
val noFeeRate = status.value.fiatRate.isNullOrZero()
|
||||
val hasNoFeeRate = status.value.fiatRate.isNullOrZero()
|
||||
|
||||
return AmountState.Data(
|
||||
title = value.title,
|
||||
|
|
@ -69,7 +69,7 @@ class AmountStateConverter(
|
|||
title = stringReference(status.currency.symbol),
|
||||
iconState = iconStateConverter.convertCustom(
|
||||
value = status,
|
||||
forceGrayscale = noFeeRate,
|
||||
forceGrayscale = hasNoFeeRate,
|
||||
showCustomTokenBadge = false,
|
||||
),
|
||||
isFiat = false,
|
||||
|
|
@ -80,7 +80,7 @@ class AmountStateConverter(
|
|||
isFiat = true,
|
||||
),
|
||||
),
|
||||
isSegmentedButtonsEnabled = !noFeeRate,
|
||||
isSegmentedButtonsEnabled = !hasNoFeeRate,
|
||||
selectedButton = 0,
|
||||
isRedesignEnabled = false,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -88,12 +88,12 @@ private fun GiveTxPermissionBottomSheetContent(content: GiveTxPermissionBottomSh
|
|||
PrimaryButtonIconEnd(
|
||||
text = stringResourceSafe(id = R.string.common_approve),
|
||||
iconResId = content.walletInteractionIcon,
|
||||
showProgress = data.approveButton.loading,
|
||||
showProgress = data.approveButton.isLoading,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = TangemTheme.dimens.spacing16),
|
||||
onClick = data.approveButton.onClick,
|
||||
enabled = data.approveButton.enabled,
|
||||
enabled = data.approveButton.isEnabled,
|
||||
)
|
||||
|
||||
SpacerH12()
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ enum class ApproveType(val text: TextReference) {
|
|||
}
|
||||
|
||||
data class ApprovePermissionButton(
|
||||
val enabled: Boolean,
|
||||
val loading: Boolean = false,
|
||||
val isEnabled: Boolean,
|
||||
val isLoading: Boolean = false,
|
||||
val onClick: () -> Unit,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -105,9 +105,9 @@ private fun Info(
|
|||
)
|
||||
}
|
||||
|
||||
notifications.fastForEach {
|
||||
key(it.hashCode()) {
|
||||
Notification(config = it)
|
||||
notifications.fastForEach { notificationConfig ->
|
||||
key(notificationConfig.hashCode()) {
|
||||
Notification(config = notificationConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ fun NavigationPrimaryButton(primaryButton: NavigationButton?, modifier: Modifier
|
|||
}
|
||||
button.onClick()
|
||||
},
|
||||
showProgress = button.showProgress,
|
||||
showProgress = button.shouldShowProgress,
|
||||
colors = color,
|
||||
textStyle = TangemTheme.typography.subtitle1,
|
||||
icon = icon,
|
||||
|
|
@ -232,7 +232,7 @@ private fun rememberNavigationButton(button: NavigationButton?): MutableState<Na
|
|||
button?.iconRes,
|
||||
button?.isIconVisible,
|
||||
button?.isEnabled,
|
||||
button?.showProgress,
|
||||
button?.shouldShowProgress,
|
||||
button?.textReference,
|
||||
) { mutableStateOf(button) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,22 +16,22 @@ sealed class NavigationButtonsState {
|
|||
}
|
||||
|
||||
/**
|
||||
* @property textReference text
|
||||
* @property iconRes icon resource id
|
||||
* @property isSecondary should set secondary color scheme
|
||||
* @property isIconVisible determines whether icon is visible
|
||||
* @property showProgress indicates progress state of button
|
||||
* @property isEnabled enabled
|
||||
* @property isDimmed determines whether the button content will be dimmed.
|
||||
* @property textReference text
|
||||
* @property iconRes icon resource id
|
||||
* @property isSecondary should set secondary color scheme
|
||||
* @property isIconVisible determines whether icon is visible
|
||||
* @property shouldShowProgress indicates progress state of button
|
||||
* @property isEnabled enabled
|
||||
* @property isDimmed determines whether the button content will be dimmed.
|
||||
* This property will be ignored if [isEnabled] is `false`.
|
||||
* @property onClick lambda be invoked when action component is clicked
|
||||
* @property onClick lambda be invoked when action component is clicked
|
||||
*/
|
||||
data class NavigationButton(
|
||||
val textReference: TextReference,
|
||||
@DrawableRes val iconRes: Int? = null,
|
||||
val isSecondary: Boolean = false,
|
||||
val isIconVisible: Boolean = false,
|
||||
val showProgress: Boolean = false,
|
||||
val shouldShowProgress: Boolean = false,
|
||||
val isEnabled: Boolean = true,
|
||||
val isDimmed: Boolean = false,
|
||||
val isHapticClick: Boolean = false,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ internal object NavigationButtonsPreview {
|
|||
iconRes = R.drawable.ic_tangem_24,
|
||||
isSecondary = true,
|
||||
isIconVisible = true,
|
||||
showProgress = false,
|
||||
shouldShowProgress = false,
|
||||
isEnabled = true,
|
||||
onClick = {},
|
||||
) to NavigationButton(
|
||||
|
|
@ -21,7 +21,7 @@ internal object NavigationButtonsPreview {
|
|||
iconRes = R.drawable.ic_tangem_24,
|
||||
isSecondary = true,
|
||||
isIconVisible = true,
|
||||
showProgress = false,
|
||||
shouldShowProgress = false,
|
||||
isEnabled = true,
|
||||
onClick = {},
|
||||
)
|
||||
|
|
@ -31,7 +31,7 @@ internal object NavigationButtonsPreview {
|
|||
iconRes = R.drawable.ic_back_24,
|
||||
isSecondary = true,
|
||||
isIconVisible = true,
|
||||
showProgress = false,
|
||||
shouldShowProgress = false,
|
||||
isEnabled = true,
|
||||
onClick = {},
|
||||
)
|
||||
|
|
@ -40,7 +40,7 @@ internal object NavigationButtonsPreview {
|
|||
textReference = resourceReference(R.string.common_close),
|
||||
isSecondary = false,
|
||||
isIconVisible = false,
|
||||
showProgress = false,
|
||||
shouldShowProgress = false,
|
||||
isEnabled = true,
|
||||
onClick = {},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ sealed class NotificationUM(val config: NotificationConfig) {
|
|||
val feeName: String,
|
||||
val feeSymbol: String,
|
||||
val networkName: String,
|
||||
val mergeFeeNetworkName: Boolean = false,
|
||||
val shouldMergeFeeNetworkName: Boolean = false,
|
||||
val onClick: (() -> Unit)? = null,
|
||||
) : Error(
|
||||
title = resourceReference(
|
||||
|
|
@ -101,7 +101,7 @@ sealed class NotificationUM(val config: NotificationConfig) {
|
|||
text = resourceReference(
|
||||
R.string.common_buy_currency,
|
||||
wrappedList(
|
||||
if (mergeFeeNetworkName) {
|
||||
if (shouldMergeFeeNetworkName) {
|
||||
"$currencyName ($feeSymbol)"
|
||||
} else {
|
||||
feeName
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ object NotificationsFactory {
|
|||
currencyName = tokenStatus.currency.name,
|
||||
feeName = coinStatus.currency.name,
|
||||
feeSymbol = coinStatus.currency.symbol,
|
||||
mergeFeeNetworkName = false,
|
||||
shouldMergeFeeNetworkName = false,
|
||||
onClick = {
|
||||
onClick(coinStatus.currency)
|
||||
},
|
||||
|
|
@ -303,7 +303,7 @@ object NotificationsFactory {
|
|||
currencyName = cryptoCurrencyStatus.currency.name,
|
||||
feeName = cryptoCurrencyWarning.coinCurrency.name,
|
||||
feeSymbol = cryptoCurrencyWarning.coinCurrency.symbol,
|
||||
mergeFeeNetworkName = shouldMergeFeeNetworkName,
|
||||
shouldMergeFeeNetworkName = shouldMergeFeeNetworkName,
|
||||
onClick = {
|
||||
onClick(cryptoCurrencyWarning.coinCurrency)
|
||||
},
|
||||
|
|
@ -320,9 +320,9 @@ object NotificationsFactory {
|
|||
feeName = cryptoCurrencyWarning.feeCurrencyName,
|
||||
feeSymbol = cryptoCurrencyWarning.feeCurrencySymbol,
|
||||
networkName = cryptoCurrencyWarning.networkName,
|
||||
mergeFeeNetworkName = shouldMergeFeeNetworkName,
|
||||
shouldMergeFeeNetworkName = shouldMergeFeeNetworkName,
|
||||
onClick = {
|
||||
currency?.let {
|
||||
if (currency != null) {
|
||||
onClick(currency)
|
||||
}
|
||||
},
|
||||
|
|
@ -381,20 +381,22 @@ object NotificationsFactory {
|
|||
add(NotificationUM.Cardano.InsufficientBalanceToTransferToken(sendingCurrency.name))
|
||||
}
|
||||
BlockchainSdkError.Cardano.InsufficientRemainingBalanceToWithdrawTokens -> {
|
||||
when (sendingCurrency) {
|
||||
is CryptoCurrency.Coin -> NotificationUM.Cardano.InsufficientBalanceToTransferCoin
|
||||
is CryptoCurrency.Token -> {
|
||||
NotificationUM.Cardano.InsufficientBalanceToTransferToken(sendingCurrency.name)
|
||||
}
|
||||
}.let(::add)
|
||||
add(
|
||||
when (sendingCurrency) {
|
||||
is CryptoCurrency.Coin -> NotificationUM.Cardano.InsufficientBalanceToTransferCoin
|
||||
is CryptoCurrency.Token -> {
|
||||
NotificationUM.Cardano.InsufficientBalanceToTransferToken(sendingCurrency.name)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
BlockchainSdkError.Cardano.InsufficientRemainingBalance,
|
||||
BlockchainSdkError.Cardano.InsufficientSendingAdaAmount,
|
||||
-> {
|
||||
dustValue?.let {
|
||||
dustValue?.let { value ->
|
||||
add(
|
||||
NotificationUM.Error.MinimumAmountError(
|
||||
amount = it.format { crypto(sendingCurrency) },
|
||||
amount = value.format { crypto(sendingCurrency) },
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,15 +219,19 @@ class TokenItemStateConverter(
|
|||
isFlickering = status.value.isFlickering(),
|
||||
icons = buildList {
|
||||
if (!status.getStakedBalance().isZero()) {
|
||||
TokenItemState.FiatAmountState.Content.IconUM(
|
||||
iconRes = R.drawable.ic_staking_24,
|
||||
tint = IconTint.Accent,
|
||||
).let(::add)
|
||||
add(
|
||||
TokenItemState.FiatAmountState.Content.IconUM(
|
||||
iconRes = R.drawable.ic_staking_24,
|
||||
tint = IconTint.Accent,
|
||||
),
|
||||
)
|
||||
}
|
||||
if (status.value.sources.total == StatusSource.ONLY_CACHE) {
|
||||
TokenItemState.FiatAmountState.Content.IconUM(
|
||||
iconRes = R.drawable.ic_error_sync_24,
|
||||
).let(::add)
|
||||
add(
|
||||
TokenItemState.FiatAmountState.Content.IconUM(
|
||||
iconRes = R.drawable.ic_error_sync_24,
|
||||
),
|
||||
)
|
||||
}
|
||||
}.toImmutableList(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ fun TokenPriceText(price: String, modifier: Modifier = Modifier, priceChangeType
|
|||
val generalColor = TangemTheme.colors.text.primary1
|
||||
|
||||
val color = remember(generalColor) { Animatable(generalColor) }
|
||||
var animationSkipped by remember { mutableStateOf(false) }
|
||||
var isAnimationSkipped by remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(price) {
|
||||
if (animationSkipped.not()) {
|
||||
animationSkipped = true
|
||||
if (isAnimationSkipped.not()) {
|
||||
isAnimationSkipped = true
|
||||
return@LaunchedEffect
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue