Updated on 2026-08-14
This commit is contained in:
parent
72cf995bd6
commit
6962716694
13 changed files with 39 additions and 56 deletions
|
|
@ -10,8 +10,8 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.RectangleShimmer
|
||||
import com.tangem.core.ui.extensions.orMaskWithStars
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.utils.StringsSigns
|
||||
import com.tangem.core.ui.components.token.state.TokenItemState.CryptoAmountState as TokenCryptoAmountState
|
||||
|
||||
@Composable
|
||||
|
|
@ -23,7 +23,7 @@ internal fun TokenCryptoAmount(
|
|||
when (state) {
|
||||
is TokenCryptoAmountState.Content -> {
|
||||
CryptoAmountText(
|
||||
amount = if (isBalanceHidden) StringsSigns.STARS else state.text,
|
||||
amount = state.text.orMaskWithStars(isBalanceHidden),
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import androidx.compose.ui.res.vectorResource
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.RectangleShimmer
|
||||
import com.tangem.core.ui.extensions.orMaskWithStars
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.utils.StringsSigns
|
||||
import com.tangem.core.ui.components.token.state.TokenItemState.FiatAmountState as TokenFiatAmountState
|
||||
|
||||
@Composable
|
||||
|
|
@ -25,7 +25,7 @@ internal fun TokenFiatAmount(state: TokenFiatAmountState?, isBalanceHidden: Bool
|
|||
when (state) {
|
||||
is TokenFiatAmountState.Content -> {
|
||||
FiatAmountText(
|
||||
text = if (isBalanceHidden) StringsSigns.STARS else state.text,
|
||||
text = state.text.orMaskWithStars(isBalanceHidden),
|
||||
hasStaked = state.hasStaked,
|
||||
modifier = modifier,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,13 +28,9 @@ import com.tangem.core.ui.components.RectangleShimmer
|
|||
import com.tangem.core.ui.components.transactions.state.TransactionState
|
||||
import com.tangem.core.ui.components.transactions.state.TransactionState.Content.Direction
|
||||
import com.tangem.core.ui.components.transactions.state.TransactionState.Content.Status
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.extensions.*
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.utils.StringsSigns
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
|
|
@ -258,7 +254,7 @@ private fun Amount(state: TransactionState, isBalanceHidden: Boolean, modifier:
|
|||
when (state) {
|
||||
is TransactionState.Content -> {
|
||||
Text(
|
||||
text = if (isBalanceHidden) StringsSigns.STARS else state.amount,
|
||||
text = state.amount.orMaskWithStars(isBalanceHidden),
|
||||
modifier = modifier,
|
||||
textAlign = TextAlign.End,
|
||||
color = when (state.status) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.google.zxing.BarcodeFormat
|
|||
import com.google.zxing.EncodeHintType
|
||||
import com.google.zxing.qrcode.QRCodeWriter
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||
import com.tangem.utils.StringsSigns.STARS
|
||||
import java.util.Hashtable
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
|
|
@ -35,5 +34,7 @@ fun String.toQrCode(sizePx: Int = 256, paddingPx: Int = 0): Bitmap {
|
|||
fun String.capitalize(): String = replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
|
||||
|
||||
fun String.orMaskWithStars(maskWithStars: Boolean): String {
|
||||
return if (maskWithStars) STARS else this
|
||||
}
|
||||
return if (maskWithStars) THREE_STARS else this
|
||||
}
|
||||
|
||||
internal const val THREE_STARS = "\u2217\u2217\u2217"
|
||||
|
|
@ -11,7 +11,6 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.AnnotatedString.Builder
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import com.tangem.utils.StringsSigns.STARS
|
||||
import org.intellij.markdown.MarkdownElementTypes
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
|
@ -68,6 +67,9 @@ sealed interface TextReference {
|
|||
|
||||
/** Empty string as [TextReference] */
|
||||
val EMPTY: TextReference by lazy(mode = LazyThreadSafetyMode.NONE) { Str(value = "") }
|
||||
|
||||
/** Stars string as [TextReference] */
|
||||
val STARS: TextReference by lazy(mode = LazyThreadSafetyMode.NONE) { Str(value = THREE_STARS) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -263,5 +265,5 @@ private fun formatAnnotated(rawString: String): AnnotatedString {
|
|||
* @return The original reference if hide is false, or reference with STARS if hide is true.
|
||||
*/
|
||||
fun TextReference.orMaskWithStars(maskWithStars: Boolean): TextReference {
|
||||
return if (maskWithStars) stringReference(STARS) else this
|
||||
return if (maskWithStars) stringReference(THREE_STARS) else this
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue