Updated on 2026-08-14
This commit is contained in:
parent
3e7108d417
commit
451410346c
3 changed files with 16 additions and 18 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue