From fcf967c8b8fec761c8ff6f9e35cb3dfb516f2d05 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 10 Jul 2026 13:36:38 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../tangempay/model/TangemPayDetailsModel.kt | 3 ++- .../utils/PaymentAccountStatusExt.kt | 19 ------------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt index 0ad2010e54..076230a318 100644 --- a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt +++ b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/model/TangemPayDetailsModel.kt @@ -164,7 +164,8 @@ internal class TangemPayDetailsModel @Inject constructor( override fun onClickAddFunds() { analytics.send(TangemPayAnalyticsEvents.AddFundsClicked()) val balance = currentStatus.value.balanceOrNull() - if (balance == null) { + val address = currentStatus.value.ifLoadedOrNull { it.depositAddress } + if (balance == null || address.isNullOrEmpty()) { showBottomSheetError(TangemPayDetailsErrorType.Receive) } else { bottomSheetNavigation.activate( diff --git a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/utils/PaymentAccountStatusExt.kt b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/utils/PaymentAccountStatusExt.kt index afd9d0f07a..9c7503bc7d 100644 --- a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/utils/PaymentAccountStatusExt.kt +++ b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/utils/PaymentAccountStatusExt.kt @@ -1,11 +1,8 @@ package com.tangem.features.tangempay.utils -import com.tangem.domain.models.StatusSource import com.tangem.domain.models.account.AccountStatus import com.tangem.domain.models.account.PaymentAccountStatusValue -import com.tangem.domain.models.account.findCardWithId import com.tangem.domain.models.currency.CryptoCurrency -import com.tangem.domain.models.pay.TangemPayCard import com.tangem.domain.models.wallet.UserWalletId internal val AccountStatus.Payment.userWalletId: UserWalletId @@ -41,20 +38,4 @@ internal fun AccountStatus.Payment.balanceOrNull(): PaymentAccountStatusValue.Ba is PaymentAccountStatusValue.Loaded -> v.balance is PaymentAccountStatusValue.Deactivated -> v.balance else -> null -} - -internal fun AccountStatus.Payment.findCard( - initialCardId: String, - initialStatus: AccountStatus.Payment, -): TangemPayCard? { - val value = value - - if (value !is PaymentAccountStatusValue.Loaded || value.source != StatusSource.ACTUAL) return null - - val initialCard = value.findCardWithId(initialCardId) - val newCards = initialStatus.ifLoadedOrNull { status -> - val initialCardIds = status.cards.mapTo(mutableSetOf()) { it.id } - value.cards.filterNot { it.id in initialCardIds } - } - return initialCard ?: newCards?.firstOrNull() } \ No newline at end of file