From 07c0b9de8461945612c115b317c11431b5ce885a Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 17 Apr 2023 15:52:40 +0300 Subject: [PATCH 01/11] Updated on 2026-08-14 --- gradle/dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 69151488bc..76ec23cd83 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -68,7 +68,7 @@ kotlinSerialization = "1.4.1" # endregion Other libraries # region Tangem -tangemBlockchainSdk = "develop-189" +tangemBlockchainSdk = "develop-189-hotfix-ada-200" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "develop-209" # tangemCardSdk = "0.0.1" # Keep it! - used for local builds From e4f396d8dfeb96e316b854bed0a6a57c29f14310 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 19 Apr 2023 10:46:42 +0300 Subject: [PATCH 02/11] Updated on 2026-08-14 --- .../implementation/utils/WalletDataOperations.kt | 4 ++++ .../tap/features/wallet/ui/adapters/WalletAdapter.kt | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt index a522228976..2b77d3ba85 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt @@ -157,6 +157,10 @@ internal fun WalletDataModel.updateWithSelf(newWalletData: WalletDataModel): Wal -> newStatus }, existentialDeposit = newWalletData.existentialDeposit, + walletAddresses = newWalletData.walletAddresses?.copy( + selectedAddress = oldWalletData.walletAddresses?.selectedAddress + ?: newWalletData.walletAddresses.selectedAddress, + ), fiatRate = newWalletData.fiatRate ?: oldWalletData.fiatRate, ) } diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt index cbb32572e7..4aec238877 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt @@ -14,10 +14,10 @@ import com.tangem.tap.common.extensions.hide import com.tangem.tap.common.extensions.show import com.tangem.tap.domain.model.WalletDataModel import com.tangem.tap.features.wallet.redux.WalletAction +import com.tangem.tap.features.wallet.ui.images.load import com.tangem.tap.features.wallet.ui.utils.getFormattedAmount import com.tangem.tap.features.wallet.ui.utils.getFormattedFiatAmount import com.tangem.tap.features.wallet.ui.utils.getFormattedFiatRate -import com.tangem.tap.features.wallet.ui.images.load import com.tangem.tap.store import com.tangem.wallet.R import com.tangem.wallet.databinding.ItemCurrencyWalletBinding @@ -96,9 +96,13 @@ class WalletAdapter : ListAdapter Date: Wed, 19 Apr 2023 16:31:52 +0300 Subject: [PATCH 03/11] Updated on 2026-08-14 --- gradle/dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 9e76b50534..1e547ad57e 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -73,7 +73,7 @@ kotlinSerialization = "1.4.1" # region Tangem tangemBlockchainSdk = "develop-203" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds -tangemCardSdk = "develop-218" +tangemCardSdk = "develop-221" # tangemCardSdk = "0.0.1" # Keep it! - used for local builds # endregion Tangem From 2304957cc745d63684102b2e71999b656bf93997 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 20 Apr 2023 17:33:49 +0300 Subject: [PATCH 04/11] Updated on 2026-08-14 --- .../wallet/ui/view/TotalBalanceCard.kt | 21 ++++++++++++------- gradle/dependencies.toml | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt index 605053c7e4..afd1ba8c88 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/view/TotalBalanceCard.kt @@ -34,7 +34,6 @@ import com.tangem.core.ui.components.SpacerW16 import com.tangem.core.ui.components.SpacerW4 import com.tangem.core.ui.res.TangemTheme import com.tangem.tap.common.entities.FiatCurrency -import com.tangem.tap.common.extensions.formatWithSpaces import com.tangem.tap.domain.model.TotalFiatBalance import com.tangem.tap.features.wallet.redux.utils.UNKNOWN_AMOUNT_SIGN import com.tangem.wallet.R @@ -42,6 +41,7 @@ import com.valentinilk.shimmer.shimmer import java.math.BigDecimal import java.math.RoundingMode import java.text.DecimalFormat +import java.text.NumberFormat import java.util.* internal class TotalBalanceCard @JvmOverloads constructor( @@ -231,16 +231,21 @@ private fun LoadedAmount(amount: AnnotatedString, modifier: Modifier = Modifier) private fun buildAmountString(amount: BigDecimal?, fiatCurrencySymbol: String): AnnotatedString { if (amount == null) return AnnotatedString(text = UNKNOWN_AMOUNT_SIGN) - val format = DecimalFormat.getInstance(Locale.getDefault()) as DecimalFormat - val scaledAmount = amount - .setScale(2, RoundingMode.HALF_UP) - .formatWithSpaces() - val integer = scaledAmount.substringBefore('.') - val reminder = scaledAmount.substringAfter('.') + val formatter = NumberFormat.getInstance(Locale.getDefault()) as? DecimalFormat + ?: return AnnotatedString("${amount.toPlainString()} $fiatCurrencySymbol") + val decimalFormat = formatter.apply { + maximumFractionDigits = 2 + minimumFractionDigits = 2 + isGroupingUsed = true + this.roundingMode = RoundingMode.HALF_UP + } + val scaledAmount = decimalFormat.format(amount) + val integer = scaledAmount.substringBefore(decimalFormat.decimalFormatSymbols.decimalSeparator) + val reminder = scaledAmount.substringAfter(decimalFormat.decimalFormatSymbols.decimalSeparator) return buildAnnotatedString { append(integer) - append(format.decimalFormatSymbols.decimalSeparator) + append(decimalFormat.decimalFormatSymbols.decimalSeparator) append( AnnotatedString( text = "$reminder $fiatCurrencySymbol", diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 1e547ad57e..74754dcdc8 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -71,7 +71,7 @@ kotlinSerialization = "1.4.1" # endregion Other libraries # region Tangem -tangemBlockchainSdk = "develop-203" +tangemBlockchainSdk = "develop-205-fix-sending-205" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "develop-221" # tangemCardSdk = "0.0.1" # Keep it! - used for local builds From 97351cf3b79aa20c62f4d523040976161d0bc21b Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 21 Apr 2023 13:53:10 +0300 Subject: [PATCH 05/11] Updated on 2026-08-14 --- .../features/wallet/ui/wallet/SingleWalletView.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt index 744fc34601..9a26ff4057 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt @@ -19,15 +19,15 @@ import com.tangem.tap.features.wallet.models.PendingTransactionType import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletMainButton import com.tangem.tap.features.wallet.redux.WalletState +import com.tangem.tap.features.wallet.ui.BalanceWidget +import com.tangem.tap.features.wallet.ui.MultipleAddressUiHelper +import com.tangem.tap.features.wallet.ui.WalletFragment +import com.tangem.tap.features.wallet.ui.adapters.PendingTransactionsAdapter import com.tangem.tap.features.wallet.ui.utils.getAvailableActions import com.tangem.tap.features.wallet.ui.utils.isAvailableToBuy import com.tangem.tap.features.wallet.ui.utils.isAvailableToSell import com.tangem.tap.features.wallet.ui.utils.mainButton import com.tangem.tap.features.wallet.ui.utils.shouldShowMultipleAddress -import com.tangem.tap.features.wallet.ui.BalanceWidget -import com.tangem.tap.features.wallet.ui.MultipleAddressUiHelper -import com.tangem.tap.features.wallet.ui.WalletFragment -import com.tangem.tap.features.wallet.ui.adapters.PendingTransactionsAdapter import com.tangem.tap.features.wallet.ui.view.WalletDetailsButtonsRow import com.tangem.tap.store import com.tangem.wallet.R @@ -88,7 +88,12 @@ class SingleWalletView : WalletView() { binding?.rvPendingTransaction?.show(knownTransactions.isNotEmpty()) } + // FIXME: Move to model watcher + private var watchedPrimaryWallet: WalletDataModel? = null private fun setupBalance(state: WalletState, primaryWallet: WalletDataModel) { + if (watchedPrimaryWallet == primaryWallet) return + watchedPrimaryWallet = primaryWallet + val fragment = fragment ?: return binding?.apply { lCardBalance.lBalance.root.show() From 6f379ec96fa91cac657bbe05a5e953f71253b3c2 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 21 Apr 2023 13:54:29 +0300 Subject: [PATCH 06/11] Updated on 2026-08-14 --- .../utils/WalletDataOperations.kt | 26 ++++++++++++------- .../wallet/ui/wallet/SingleWalletView.kt | 13 +++++++--- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt index 2b77d3ba85..2d1ab24a3b 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt @@ -205,16 +205,7 @@ internal fun List.updateSelectedAddress( if (index == -1) return this val oldWalletData = this[index] - val addresses = oldWalletData.walletAddresses - ?: return this - val selectedAddress = addresses.list - .firstOrNull { it.type == addressType } - ?: addresses.selectedAddress - val updatedWalletData = oldWalletData.copy( - walletAddresses = addresses.copy( - selectedAddress = selectedAddress, - ), - ) + val updatedWalletData = oldWalletData.updateSelectedAddress(addressType) if (oldWalletData == updatedWalletData) return this return this.toMutableList().apply { @@ -222,6 +213,21 @@ internal fun List.updateSelectedAddress( } } +internal fun WalletDataModel.updateSelectedAddress( + addressType: AddressType, +): WalletDataModel { + val addresses = walletAddresses ?: return this + val selectedAddress = addresses.list + .firstOrNull { it.type == addressType } + ?: addresses.selectedAddress + + return this.copy( + walletAddresses = addresses.copy( + selectedAddress = selectedAddress, + ), + ) +} + internal fun WalletDataModel.isSameWalletData(other: WalletDataModel): Boolean { return this.currency == other.currency } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt index 9a26ff4057..b66b7d3038 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt @@ -183,8 +183,13 @@ class SingleWalletView : WalletView() { } } + // FIXME: Move to model watcher + private var watchedPrimaryWallet: WalletDataModel? = null private fun setupAddressCard(state: WalletState, binding: FragmentWalletBinding) = with(binding.lAddress) { val primaryWallet = state.primaryWalletData + if (primaryWallet == watchedPrimaryWallet) return@with + watchedPrimaryWallet = primaryWallet + if (primaryWallet?.walletAddresses != null && primaryWallet.currency is Currency.Blockchain) { binding.lAddress.root.show() if (primaryWallet.shouldShowMultipleAddress()) { @@ -211,16 +216,16 @@ class SingleWalletView : WalletView() { ), ) } - setupCardInfo(state) + setupCardInfo(primaryWallet) } else { binding.lAddress.root.hide() } } - private fun setupCardInfo(state: WalletState) { + private fun setupCardInfo(walletData: WalletDataModel) { val textView = binding?.lAddress?.tvInfo - val blockchain = state.primaryWalletData?.currency?.blockchain - if (textView != null && blockchain != null) { + val blockchain = walletData.currency.blockchain + if (textView != null) { textView.text = textView.getString( id = R.string.address_qr_code_message_format, blockchain.fullName, From 8b68e88ab4f0eee6f421251fe0ca2865860610fc Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 21 Apr 2023 13:55:21 +0300 Subject: [PATCH 07/11] Updated on 2026-08-14 --- .../send/redux/middlewares/SendMiddleware.kt | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt index 0a528bd856..551d1b67b9 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/SendMiddleware.kt @@ -176,18 +176,29 @@ private fun sendTransaction( scope.launch { val updateWalletResult = walletManager.safeUpdate() if (updateWalletResult is Result.Failure) { - when (val error = updateWalletResult.error) { - is TapError -> store.dispatchErrorNotification(error) - else -> { - val tapError = if (error.message == null) { - TapError.UnknownError - } else { - TapError.CustomError(error.message!!) + withMainContext { + when (val error = updateWalletResult.error) { + is TapError -> store.dispatchErrorNotification(error) + is BlockchainSdkError -> { + updateFeedbackManagerInfo( + walletManager = walletManager, + amountToSend = amountToSend, + feeAmount = feeAmount, + destinationAddress = destinationAddress, + ) + dispatch(SendAction.Dialog.SendTransactionFails.BlockchainSdkError(error = error)) + } + else -> { + val tapError = if (error.message == null) { + TapError.UnknownError + } else { + TapError.CustomError(error.message!!) + } + store.dispatchErrorNotification(tapError) } - store.dispatchErrorNotification(tapError) } + dispatch(SendAction.ChangeSendButtonState(ButtonState.ENABLED)) } - withMainContext { dispatch(SendAction.ChangeSendButtonState(ButtonState.ENABLED)) } return@launch } @@ -250,7 +261,7 @@ private fun sendTransaction( } } is SimpleResult.Failure -> { - store.state.globalState.feedbackManager?.infoHolder?.updateOnSendError( + updateFeedbackManagerInfo( walletManager = walletManager, amountToSend = amountToSend, feeAmount = feeAmount, @@ -306,6 +317,20 @@ private fun sendTransaction( } } +private fun updateFeedbackManagerInfo( + walletManager: WalletManager, + amountToSend: Amount, + feeAmount: Amount, + destinationAddress: String, +) { + store.state.globalState.feedbackManager?.infoHolder?.updateOnSendError( + walletManager = walletManager, + amountToSend = amountToSend, + feeAmount = feeAmount, + destinationAddress = destinationAddress, + ) +} + fun createValidateTransactionError( errorList: EnumSet, walletManager: WalletManager, From dcd29469831dd8fce0d88ee9ca4c1905faba971a Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 21 Apr 2023 14:20:42 +0300 Subject: [PATCH 08/11] Updated on 2026-08-14 --- .../utils/WalletDataOperations.kt | 4 +--- .../wallet/ui/wallet/SingleWalletView.kt | 17 +++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt index 2d1ab24a3b..55d0faa5d2 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletStores/repository/implementation/utils/WalletDataOperations.kt @@ -213,9 +213,7 @@ internal fun List.updateSelectedAddress( } } -internal fun WalletDataModel.updateSelectedAddress( - addressType: AddressType, -): WalletDataModel { +internal fun WalletDataModel.updateSelectedAddress(addressType: AddressType): WalletDataModel { val addresses = walletAddresses ?: return this val selectedAddress = addresses.list .firstOrNull { it.type == addressType } diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt index b66b7d3038..76a46b5ebc 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt @@ -35,6 +35,11 @@ import com.tangem.wallet.databinding.FragmentWalletBinding class SingleWalletView : WalletView() { private lateinit var pendingTransactionAdapter: PendingTransactionsAdapter + + // FIXME: Move to model watcher + private var watchedPrimaryWalletForAddressCard: WalletDataModel? = null + private var watchedPrimaryWalletForBalance: WalletDataModel? = null + override fun changeWalletView(fragment: WalletFragment, binding: FragmentWalletBinding) { setFragment(fragment, binding) onViewCreated() @@ -88,11 +93,9 @@ class SingleWalletView : WalletView() { binding?.rvPendingTransaction?.show(knownTransactions.isNotEmpty()) } - // FIXME: Move to model watcher - private var watchedPrimaryWallet: WalletDataModel? = null private fun setupBalance(state: WalletState, primaryWallet: WalletDataModel) { - if (watchedPrimaryWallet == primaryWallet) return - watchedPrimaryWallet = primaryWallet + if (watchedPrimaryWalletForBalance == primaryWallet) return + watchedPrimaryWalletForBalance = primaryWallet val fragment = fragment ?: return binding?.apply { @@ -183,12 +186,10 @@ class SingleWalletView : WalletView() { } } - // FIXME: Move to model watcher - private var watchedPrimaryWallet: WalletDataModel? = null private fun setupAddressCard(state: WalletState, binding: FragmentWalletBinding) = with(binding.lAddress) { val primaryWallet = state.primaryWalletData - if (primaryWallet == watchedPrimaryWallet) return@with - watchedPrimaryWallet = primaryWallet + if (primaryWallet == watchedPrimaryWalletForAddressCard) return@with + watchedPrimaryWalletForAddressCard = primaryWallet if (primaryWallet?.walletAddresses != null && primaryWallet.currency is Currency.Blockchain) { binding.lAddress.root.show() From 323458a7923d6bc52ab60f4ec99f8794240cbce4 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 25 Apr 2023 07:48:59 +0300 Subject: [PATCH 09/11] Updated on 2026-08-14 --- .../main/java/com/tangem/tap/common/extensions/Specific.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/common/extensions/Specific.kt b/app/src/main/java/com/tangem/tap/common/extensions/Specific.kt index c5a6d6cd4f..bea9728880 100644 --- a/app/src/main/java/com/tangem/tap/common/extensions/Specific.kt +++ b/app/src/main/java/com/tangem/tap/common/extensions/Specific.kt @@ -55,7 +55,7 @@ fun BigDecimal.toFiatRateString(fiatCurrencyName: String, fiatCode: String): Str formatter.currency = currency formatter.maximumFractionDigits = 2 formatter.roundingMode = RoundingMode.HALF_UP - return formatter.format(this) + return formatter.format(this).replace(currency.symbol, "$fiatCurrencyName ") } } catch (e: IllegalArgumentException) { Timber.e(e, "can't parse currency") @@ -96,7 +96,7 @@ fun BigDecimal.toFormattedFiatValue( formatter.currency = currency formatter.maximumFractionDigits = 2 formatter.roundingMode = RoundingMode.HALF_UP - return formatter.format(this) + return formatter.format(this).replace(currency.symbol, "$fiatCurrencyName ") } } catch (e: IllegalArgumentException) { Timber.e(e, "can't parse currency") From cf6a14d2629cfbde110bbb17eaae080ec7041c93 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 25 Apr 2023 15:18:51 +0800 Subject: [PATCH 10/11] Updated on 2026-08-14 --- .../impl/presentation/states/TokenItemState.kt | 14 ++++++++------ .../tokens/impl/presentation/ui/TokenItem.kt | 4 ++-- .../impl/presentation/ui/TokenListPreviewData.kt | 5 +++-- .../impl/presentation/ui/TokensListScreen.kt | 2 +- .../presentation/viewmodels/TokensListViewModel.kt | 7 ++++--- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/states/TokenItemState.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/states/TokenItemState.kt index 603989d157..7c4f94e230 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/states/TokenItemState.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/states/TokenItemState.kt @@ -9,8 +9,8 @@ import kotlinx.collections.immutable.ImmutableList */ sealed interface TokenItemState { - /** Token name */ - val name: String + /** Token full name (name with symbol) */ + val fullName: String /** Token icon url */ val iconUrl: String @@ -21,12 +21,12 @@ sealed interface TokenItemState { /** * Token item state that is available for read * - * @property name token name + * @property fullName token name * @property iconUrl token icon url * @property networks list of networks that is available for read */ data class ReadContent( - override val name: String, + override val fullName: String, override val iconUrl: String, override val networks: ImmutableList, ) : TokenItemState @@ -34,17 +34,19 @@ sealed interface TokenItemState { /** * Token item state that is available for read and manage * - * @property name token name + * @property fullName token name * @property iconUrl token icon url * @property networks list of networks is available for read and edit * @property id token id + * @property name token name * @property symbol token brief name */ data class ManageContent( - override val name: String, + override val fullName: String, override val iconUrl: String, override val networks: ImmutableList, val id: String, + val name: String, val symbol: String, ) : TokenItemState } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt index 3545c6a2a5..9f3c695bb2 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt @@ -60,7 +60,7 @@ internal fun TokenItem(model: TokenItemState) { val spacing6 = TangemTheme.dimens.spacing6 Icon( - name = model.name, + name = model.fullName, iconUrl = model.iconUrl, modifier = Modifier.constrainAs(icon) { top.linkTo(parent.top) @@ -69,7 +69,7 @@ internal fun TokenItem(model: TokenItemState) { ) Title( - title = model.name, + title = model.fullName, modifier = Modifier.constrainAs(title) { top.linkTo(parent.top) start.linkTo(icon.end, margin = spacing16) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenListPreviewData.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenListPreviewData.kt index 3fb8f93097..6341c4bd13 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenListPreviewData.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenListPreviewData.kt @@ -15,17 +15,18 @@ object TokenListPreviewData { fun createManageToken(): TokenItemState.ManageContent { return TokenItemState.ManageContent( - name = "Tether (USDT)", + fullName = "Tether (USDT)", iconUrl = "https://s3.eu-central-1.amazonaws.com/tangem.api/coins/large/tether.png", networks = createManageNetworksList(), id = "", + name = "Tether", symbol = "", ) } fun createReadToken(): TokenItemState.ReadContent { return TokenItemState.ReadContent( - name = "Tether (USDT)", + fullName = "Tether (USDT)", iconUrl = "https://s3.eu-central-1.amazonaws.com/tangem.api/coins/large/tether.png", networks = createReadNetworksList(), ) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt index 08d9d6978c..3e7e01c845 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt @@ -113,7 +113,7 @@ private fun TokensListContent( item { DifferentAddressesWarning() } } - items(items = tokens, key = TokenItemState::name) { + items(items = tokens, key = TokenItemState::fullName) { it?.let { TokenItem(model = it) } } } diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/viewmodels/TokensListViewModel.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/viewmodels/TokensListViewModel.kt index 543e23d996..eff8dd3e7d 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/viewmodels/TokensListViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/viewmodels/TokensListViewModel.kt @@ -126,10 +126,11 @@ internal class TokensListViewModel @Inject constructor( private fun createManageTokenContent(token: Token): TokenItemState.ManageContent { return TokenItemState.ManageContent( - name = getTokenName(token), + fullName = getTokenFullName(token), iconUrl = token.iconUrl, networks = token.networks.map(::createManageNetworkContent).toImmutableList(), id = token.id, + name = token.name, symbol = token.symbol, ) } @@ -156,7 +157,7 @@ internal class TokensListViewModel @Inject constructor( private fun createReadTokenContent(token: Token): TokenItemState.ReadContent { return TokenItemState.ReadContent( - name = getTokenName(token), + fullName = getTokenFullName(token), iconUrl = token.iconUrl, networks = token.networks.map(::createReadNetworkContent).toImmutableList(), ) @@ -171,7 +172,7 @@ internal class TokensListViewModel @Inject constructor( ) } - private fun getTokenName(token: Token) = "${token.name} (${token.symbol})" + private fun getTokenFullName(token: Token) = "${token.name} (${token.symbol})" private fun getNetworkProtocolName(network: Network): String { return if (network.address == null) { From d2b6c524ef7ffe7887a46720d7b898e46eae737e Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 25 Apr 2023 10:25:00 +0300 Subject: [PATCH 11/11] Updated on 2026-08-14 --- .../tap/features/wallet/ui/wallet/SingleWalletView.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt index 76a46b5ebc..5edef28db5 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/SingleWalletView.kt @@ -47,6 +47,8 @@ class SingleWalletView : WalletView() { } private fun showSingleWalletView(binding: FragmentWalletBinding) = with(binding) { + watchedPrimaryWalletForAddressCard = null + watchedPrimaryWalletForBalance = null lSaltPayWallet.root.hide() tvTwinCardNumber.hide() rvMultiwallet.hide() @@ -66,6 +68,12 @@ class SingleWalletView : WalletView() { setupTransactionsRecyclerView() } + override fun onDestroyFragment() { + super.onDestroyFragment() + watchedPrimaryWalletForAddressCard = null + watchedPrimaryWalletForBalance = null + } + private fun setupTransactionsRecyclerView() { val fragment = fragment ?: return pendingTransactionAdapter = PendingTransactionsAdapter()