Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-16 17:48:11 +03:00
parent 45ab6836ad
commit 5c56f04c38
52 changed files with 228 additions and 72 deletions

View file

@ -76,7 +76,7 @@ internal class AddToPortfolioBSContentUMFactory(
alreadyAddedNetworks = alreadyAddedNetworks,
onNetworkSwitchClick = onNetworkSwitchClick,
).convert(value = token),
isScanCardNotificationVisible = portfolioUIData.hasMissedDerivations,
isScanCardNotificationVisible = portfolioUIData.needColdWalletInteraction,
continueButtonEnabled = portfolioUIData.addToPortfolioData.isUserAddedNetworks(
userWalletId = selectedWallet.walletId,
),

View file

@ -32,8 +32,8 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.models.wallet.isMultiCurrency
import com.tangem.domain.tokens.GetViewedTokenReceiveWarningUseCase
import com.tangem.domain.transaction.usecase.GetEnsNameUseCase
import com.tangem.domain.wallets.usecase.ColdWalletAndHasMissedDerivationsUseCase
import com.tangem.domain.wallets.usecase.GetSelectedWalletUseCase
import com.tangem.domain.wallets.usecase.HasMissedDerivationsUseCase
import com.tangem.features.markets.impl.R
import com.tangem.features.markets.portfolio.api.MarketsPortfolioComponent
import com.tangem.features.markets.portfolio.impl.analytics.PortfolioAnalyticsEvent
@ -65,7 +65,7 @@ internal class MarketsPortfolioModel @Inject constructor(
private val checkCurrencyUnsupportedUseCase: CheckCurrencyUnsupportedUseCase,
private val getSelectedWalletUseCase: GetSelectedWalletUseCase,
private val portfolioDataLoader: PortfolioDataLoader,
private val hasMissedDerivationsUseCase: HasMissedDerivationsUseCase,
private val coldWalletAndHasMissedDerivationsUseCase: ColdWalletAndHasMissedDerivationsUseCase,
private val saveMarketTokensUseCase: SaveMarketTokensUseCase,
private val addToPortfolioManager: AddToPortfolioManager,
private val analyticsEventHandler: AnalyticsEventHandler,
@ -232,18 +232,18 @@ internal class MarketsPortfolioModel @Inject constructor(
portfolioBSVisibilityModel = portfolioBSVisibilityModel,
selectedWalletId = selectedWalletId,
addToPortfolioData = addToPortfolioData,
hasMissedDerivations = hasMissedDerivations(selectedWalletId, addToPortfolioData),
needColdWalletInteraction = needColdWalletInteraction(selectedWalletId, addToPortfolioData),
)
},
)
}
private suspend fun hasMissedDerivations(
private suspend fun needColdWalletInteraction(
selectedWalletId: UserWalletId?,
addToPortfolioData: AddToPortfolioManager.AddToPortfolioData,
): Boolean {
return if (selectedWalletId != null) {
hasMissedDerivationsUseCase.invoke(
coldWalletAndHasMissedDerivationsUseCase.invoke(
userWalletId = selectedWalletId,
networksWithDerivationPath = addToPortfolioData.addedNetworks[selectedWalletId].orEmpty()
.associate { it.networkId to null },

View file

@ -8,7 +8,7 @@ import com.tangem.domain.models.wallet.UserWalletId
* @property portfolioBSVisibilityModel portfolio bottom sheet visibility model
* @property selectedWalletId selected wallet id
* @property addToPortfolioData add to portfolio data
* @property hasMissedDerivations flag that indicates if user has missed derivations
* @property needColdWalletInteraction flag that indicates if user has missed derivations and has a cold wallet
*
[REDACTED_AUTHOR]
*/
@ -16,5 +16,5 @@ internal data class PortfolioUIData(
val portfolioBSVisibilityModel: PortfolioBSVisibilityModel,
val selectedWalletId: UserWalletId?,
val addToPortfolioData: AddToPortfolioManager.AddToPortfolioData,
val hasMissedDerivations: Boolean,
val needColdWalletInteraction: Boolean,
)