From 451410346ca193b7f7cc7dd1fcc5c716cd896fed Mon Sep 17 00:00:00 2001 From: Tangem Date: Sun, 8 Sep 2024 08:24:11 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../amountScreen/ui/AmountFieldContainer.kt | 4 +-- .../list/RoundedListWithDividers.kt | 2 +- .../core/ui/extensions/TextReference.kt | 28 +++++++++---------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt index a5017f62a1..caee01e48c 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldContainer.kt @@ -14,9 +14,9 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.text.style.TextAlign import com.tangem.common.ui.amountScreen.models.AmountState import com.tangem.core.ui.components.currency.icon.CurrencyIcon +import com.tangem.core.ui.extensions.orMaskWithStars import com.tangem.core.ui.extensions.resolveReference import com.tangem.core.ui.res.TangemTheme -import com.tangem.utils.StringsSigns.STARS private const val AMOUNT_FIELD_KEY = "amountFieldKey" @@ -41,7 +41,7 @@ internal fun LazyListScope.amountField( .padding(top = TangemTheme.dimens.spacing14), ) - val balance = if (isBalanceHidden) STARS else amountState.walletBalance.resolveReference() + val balance = amountState.walletBalance.orMaskWithStars(isBalanceHidden).resolveReference() AnimatedContent( targetState = balance, label = "Hide Balance Animation", diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/list/RoundedListWithDividers.kt b/core/ui/src/main/java/com/tangem/core/ui/components/list/RoundedListWithDividers.kt index 5f85437fb2..8ace2f0b02 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/list/RoundedListWithDividers.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/list/RoundedListWithDividers.kt @@ -57,7 +57,7 @@ fun LazyListScope.roundedListWithDividersItems( ) { index, row -> InitialInfoContentRow( startText = row.startText.resolveReference(), - endText = row.endText.resolveReference().orMaskWithStars(hideEndText && row.isEndTextHideable), + endText = row.endText.orMaskWithStars(hideEndText && row.isEndTextHideable).resolveReference(), cornersToRound = getCornersToRound(index, rows.size), iconClick = row.iconClick, ) diff --git a/core/ui/src/main/java/com/tangem/core/ui/extensions/TextReference.kt b/core/ui/src/main/java/com/tangem/core/ui/extensions/TextReference.kt index 3f1d59e115..7d941398ac 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/extensions/TextReference.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/extensions/TextReference.kt @@ -233,21 +233,6 @@ operator fun TextReference.plus(ref: TextReference): TextReference { } } - -/** - * Returns the TextReference itself if hide is false, otherwise returns a reference with STARS. - * - * @param mask A boolean flag that determines whether to hide the string. - * If true, the original TextReference will be replaced by reference with STARS. - * If false, the original TextReference will be returned. - * - * @return The original reference if hide is false, or reference with STARS if hide is true. - */ -fun TextReference.orMaskWithStars(mask: Boolean): TextReference { - return if (mask) stringReference(STARS) else this -} - - @Suppress("NOTHING_TO_INLINE") @OptIn(ExperimentalContracts::class) inline fun TextReference?.isNullOrEmpty(): Boolean { @@ -266,4 +251,17 @@ private fun formatAnnotated(rawString: String): AnnotatedString { return buildAnnotatedString { appendMarkdown(markdownText = rawString, node = parsedTree) } +} + +/** + * Returns the TextReference itself if hide is false, otherwise returns a reference with STARS. + * + * @param maskWithStars A boolean flag that determines whether to hide the string. + * If true, the original TextReference will be replaced by reference with STARS. + * If false, the original TextReference will be returned. + * + * @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 } \ No newline at end of file