From b93507349dcb2b6012bce09dad4a5c952790e277 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 11 Aug 2025 21:34:39 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../destination/entity/DestinationTextFieldUM.kt | 9 +++++++++ .../v2/subcomponents/destination/ui/DestinationBlock.kt | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/subcomponents/destination/entity/DestinationTextFieldUM.kt b/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/subcomponents/destination/entity/DestinationTextFieldUM.kt index 55cc94b302..b0bbb0fc76 100644 --- a/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/subcomponents/destination/entity/DestinationTextFieldUM.kt +++ b/features/send-v2/api/src/main/java/com/tangem/features/send/v2/api/subcomponents/destination/entity/DestinationTextFieldUM.kt @@ -3,6 +3,7 @@ package com.tangem.features.send.v2.api.subcomponents.destination.entity import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Immutable import com.tangem.core.ui.extensions.TextReference +import com.tangem.utils.toBriefAddressFormat @Immutable sealed class DestinationTextFieldUM { @@ -27,6 +28,10 @@ sealed class DestinationTextFieldUM { val actualAddress: String get() = blockchainAddress ?: value + + // if value is human-readable address, this field contains the actual brief blockchain address + val briefBlockchainAddress: String? + get() = blockchainAddress?.toBriefAddressFormat(BRIEF_ADDRESS_EDGE_LENGTH, BRIEF_ADDRESS_EDGE_LENGTH) } data class RecipientMemo( @@ -40,4 +45,8 @@ sealed class DestinationTextFieldUM { val isEnabled: Boolean, val isValuePasted: Boolean, ) : DestinationTextFieldUM() + + private companion object { + const val BRIEF_ADDRESS_EDGE_LENGTH = 13 + } } \ No newline at end of file diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt index e1c1b5da9f..5cdfd469ac 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/subcomponents/destination/ui/DestinationBlock.kt @@ -82,7 +82,7 @@ private fun AddressBlock(address: DestinationTextFieldUM.RecipientAddress) { style = TangemTheme.typography.body2, color = TangemTheme.colors.text.primary1, ) - val blockchainAddress = address.blockchainAddress + val blockchainAddress = address.briefBlockchainAddress if (!blockchainAddress.isNullOrBlank()) { Text( text = blockchainAddress, @@ -136,7 +136,7 @@ private fun AddressWithMemoBlock( style = TangemTheme.typography.body2, color = TangemTheme.colors.text.primary1, ) - val blockchainAddress = address.blockchainAddress + val blockchainAddress = address.briefBlockchainAddress if (!blockchainAddress.isNullOrBlank()) { Text( text = blockchainAddress,