Updated on 2026-08-14

This commit is contained in:
Tangem 2024-09-13 12:28:51 +03:00
parent 06cf8cad51
commit 06d139362e
5 changed files with 23 additions and 9 deletions

View file

@ -4,6 +4,7 @@ import android.icu.text.CompactDecimalFormat
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.utils.StringsSigns.DASH_SIGN
import com.tangem.utils.StringsSigns.LOWER_SIGN
import com.tangem.utils.StringsSigns.TILDE_SIGN
import timber.log.Timber
import java.math.BigDecimal
import java.math.RoundingMode
@ -167,6 +168,7 @@ object BigDecimalFormatter {
fiatCurrencySymbol: String,
decimals: Int = FIAT_MARKET_DEFAULT_DIGITS,
locale: Locale = Locale.getDefault(),
withApproximateSign: Boolean = false,
): String {
if (fiatAmount == null) return EMPTY_BALANCE_SIGN
@ -187,8 +189,17 @@ object BigDecimalFormatter {
)
}
} else {
formatter.format(fiatAmount)
val formattedAmount = formatter.format(fiatAmount)
.replace(formatterCurrency.getSymbol(locale), fiatCurrencySymbol)
if (withApproximateSign) {
buildString {
append(TILDE_SIGN)
append(formattedAmount)
}
} else {
formattedAmount
}
}
}

View file

@ -64,6 +64,7 @@ internal class SetConfirmationStateLoadingTransformer(
fiatAmount = potentialReward,
fiatCurrencyCode = appCurrency.code,
fiatCurrencySymbol = appCurrency.symbol,
withApproximateSign = true,
)
return if (isEnterAction && amountDecimal != null && potentialReward != null) {
resourceReference(

View file

@ -41,19 +41,20 @@ internal object SetTitleTransformer : Transformer<StakingUiState> {
val confirmationState = prevState.confirmationState as? StakingStates.ConfirmationState.Data
val title = confirmationState?.pendingAction?.type?.getPendingActionTitle()
title?.takeIf { it.isNullOrEmpty() }
title.takeIf { !it.isNullOrEmpty() }
?: resourceReference(
R.string.staking_title_stake,
wrappedList(prevState.cryptoCurrencyName),
id = R.string.staking_title_stake,
formatArgs = wrappedList(prevState.cryptoCurrencyName),
)
}
}
}
}
val subtitle = when (currentStep) {
StakingStep.Confirmation -> stringReference(prevState.walletName)
else -> null
val subtitle = if (currentStep == StakingStep.Confirmation && actionType == StakingActionCommonType.ENTER) {
stringReference(prevState.walletName)
} else {
null
}
return prevState.copy(

View file

@ -59,8 +59,8 @@ internal fun StakingConfirmationContent(
}
AmountBlock(
amountState = amountState,
isClickDisabled = !isEnterAction,
isEditingDisabled = !isEnterAction || isTransactionSent,
isClickDisabled = !isEnterAction || isTransactionSent,
isEditingDisabled = !isEnterAction && state.innerState != InnerConfirmationStakingState.COMPLETED,
onClick = clickIntents::onPrevClick,
)
if (isEnterAction) {

View file

@ -83,6 +83,7 @@ internal fun StakingFeeBlock(feeState: FeeState, isTransactionSent: Boolean) {
titleRes = R.string.common_fee_selector_option_market,
iconRes = R.drawable.ic_bird_24,
paddingValues = PaddingValues(),
showDivider = false,
)
FeeLoading(feeState)
}