Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-07 14:34:37 +01:00
commit b995f180f1
20 changed files with 139 additions and 37 deletions

View file

@ -1,6 +1,9 @@
package com.tangem.features.addressbook.common
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchainsdk.utils.fromNetworkId
import com.tangem.common.ui.account.AccountIconUM
import com.tangem.domain.addressbook.model.AddressEntry
import com.tangem.domain.addressbook.model.Contact
import com.tangem.domain.models.account.CryptoPortfolioIcon
import com.tangem.features.addressbook.MatchedContact
@ -27,7 +30,7 @@ internal object ContactMatcher {
MatchedContact.ContactAddress(
address = entry.address,
memo = entry.memo,
networkName = entry.networkName,
networkName = entry.displayNetworkName(),
)
}.toImmutableList(),
)
@ -40,4 +43,8 @@ internal object ContactMatcher {
color = CryptoPortfolioIcon.Color.entries.firstOrNull { it.name == iconColor }
?: CryptoPortfolioIcon.Color.Azure,
)
/** Display network name is derived from [AddressEntry.networkId] — it is not stored in the encrypted payload. */
private fun AddressEntry.displayNetworkName(): String =
Blockchain.fromNetworkId(networkId.value)?.fullName ?: networkId.value
}

View file

@ -37,7 +37,6 @@ internal class ContactAddressEntriesConverter {
id = AddressEntryId(UUID.randomUUID().toString()),
address = address,
networkId = Network.RawID(rawId),
networkName = blockchain?.fullName ?: rawId,
memo = memo?.takeIf { hasExtrasSupport },
signature = "",
)

View file

@ -63,7 +63,7 @@ internal class DefaultAddressBookListComponent(
is AddressBookListUM.Content -> AddressBookListScreen(
state = addressBookListUM,
onBackClick = router::pop,
modifier = modifier.background(TangemTheme.colors3.bg.primary),
modifier = Modifier.background(TangemTheme.colors3.bg.primary),
)
}
selector.child?.instance?.BottomSheet()

View file

@ -43,7 +43,7 @@ internal fun AddressBookListScreen(
) {
val density = LocalDensity.current
val bottomBarHeight = with(density) { WindowInsets.systemBars.getBottom(this).toDp() }
Column(modifier = modifier) {
Column(modifier = modifier.fillMaxSize()) {
TangemTopBar(
modifier = Modifier.statusBarsPadding(),
title = resourceReference(R.string.address_book_title),

View file

@ -90,7 +90,6 @@ internal class ContactMatcherTest {
networkId = Network.RawID(networkId),
memo = memo,
signature = "sig",
networkName = "Ethereum",
)
private companion object {

View file

@ -808,7 +808,6 @@ internal class EditContactModelTest {
id = AddressEntryId("e-1"),
address = "0xAAA",
networkId = Network.RawID("ethereum"),
networkName = "Ethereum",
memo = null,
signature = "sig",
),
@ -816,7 +815,6 @@ internal class EditContactModelTest {
id = AddressEntryId("e-2"),
address = "0xBBB",
networkId = Network.RawID("bsc"),
networkName = "BSC",
memo = null,
signature = "sig",
),
@ -1016,7 +1014,6 @@ internal class EditContactModelTest {
id = AddressEntryId("e-1"),
address = address,
networkId = Network.RawID("ethereum"),
networkName = "Ethereum",
memo = null,
signature = "sig",
),

View file

@ -186,7 +186,6 @@ internal class AddressBookListModelTest {
id = AddressEntryId("e-$id"),
address = "0xABC",
networkId = Network.RawID("ethereum"),
networkName = "Ethereum",
memo = null,
signature = "sig",
),

View file

@ -172,7 +172,6 @@ internal class UpdateAddressBookListContentTransformerTest {
networkId = Network.RawID("ethereum"),
memo = null,
signature = "sig",
networkName = "Ethereum",
),
),
),