Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-06 10:59:48 +04:00
parent e2721b21e1
commit a67ca6279f
14 changed files with 24 additions and 614 deletions

View file

@ -20,7 +20,6 @@ import com.tangem.core.decompose.context.childByContext
import com.tangem.core.decompose.navigation.inner.InnerRouter
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.domain.models.PortfolioId
import com.tangem.features.account.PortfolioFetcher
import com.tangem.features.account.PortfolioSelectorComponent
import com.tangem.features.account.PortfolioSelectorController
@ -160,13 +159,13 @@ internal class DefaultNFTComponent @AssistedInject constructor(
if (portfolioData.isSingleChoice) {
val mainAccountId = portfolioData.balances.values.first()
.accountsBalance.mainAccount.account.accountId
innerRouter.push(NFTRoute.Receive(portfolioId = PortfolioId(mainAccountId)))
innerRouter.push(NFTRoute.Receive(accountId = mainAccountId))
} else {
bottomSheetNavigation.activate(Unit)
val selectedAccountId = portfolioSelectorController.selectedAccount
.filterNotNull().first()
bottomSheetNavigation.dismiss()
innerRouter.push(NFTRoute.Receive(portfolioId = PortfolioId(selectedAccountId)))
innerRouter.push(NFTRoute.Receive(accountId = selectedAccountId))
}
}.saveIn(onReceiveClickJob)
@ -176,7 +175,7 @@ internal class DefaultNFTComponent @AssistedInject constructor(
): ComposableContentComponent = NFTReceiveComponent(
context = factoryContext,
params = NFTReceiveComponent.Params(
portfolioId = route.portfolioId,
accountId = route.accountId,
onBackClick = ::onChildBack,
),
tokenReceiveComponentFactory = tokenReceiveComponentFactory,

View file

@ -1,10 +1,10 @@
package com.tangem.features.nft.common
import com.tangem.core.decompose.navigation.Route
import com.tangem.domain.models.PortfolioId
import com.tangem.domain.models.account.AccountId
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.nft.models.NFTAsset
import com.tangem.domain.nft.models.NFTCollection
import com.tangem.domain.models.wallet.UserWalletId
import kotlinx.serialization.Serializable
internal sealed class NFTRoute : Route {
@ -15,9 +15,7 @@ internal sealed class NFTRoute : Route {
) : NFTRoute()
@Serializable
data class Receive(
val portfolioId: PortfolioId,
) : NFTRoute()
data class Receive(val accountId: AccountId) : NFTRoute()
@Serializable
data class Details(

View file

@ -13,8 +13,8 @@ import com.tangem.core.decompose.context.childByContext
import com.tangem.core.decompose.model.getOrCreateModel
import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
import com.tangem.core.ui.decompose.ComposableContentComponent
import com.tangem.domain.models.PortfolioId
import com.tangem.domain.models.TokenReceiveConfig
import com.tangem.domain.models.account.AccountId
import com.tangem.features.nft.receive.model.NFTReceiveModel
import com.tangem.features.nft.receive.ui.NFTReceive
import com.tangem.features.tokenreceive.TokenReceiveComponent
@ -57,7 +57,7 @@ internal class NFTReceiveComponent @AssistedInject constructor(
)
data class Params(
val portfolioId: PortfolioId,
val accountId: AccountId,
val onBackClick: () -> Unit,
)
}

View file

@ -18,7 +18,6 @@ import com.tangem.core.ui.message.DialogMessage
import com.tangem.domain.account.producer.SingleAccountProducer
import com.tangem.domain.account.supplier.SingleAccountSupplier
import com.tangem.domain.account.usecase.IsAccountsModeEnabledUseCase
import com.tangem.domain.models.PortfolioId
import com.tangem.domain.models.TokenReceiveConfig
import com.tangem.domain.models.account.AccountId
import com.tangem.domain.models.network.Network
@ -88,14 +87,12 @@ internal class NFTReceiveModel @Inject constructor(
}
private fun loadPortfolioName() = modelScope.launch(dispatchers.default) {
val appBarSubtitle = when (val portfolioId = params.portfolioId) {
is PortfolioId.Wallet -> loadWalletName(portfolioId.userWalletId)
is PortfolioId.Account -> if (isAccountsModeEnabledUseCase.invokeSync()) {
loadAccountName(portfolioId.accountId)
} else {
loadWalletName(portfolioId.userWalletId)
}
val appBarSubtitle = if (isAccountsModeEnabledUseCase.invokeSync()) {
loadAccountName(params.accountId)
} else {
loadWalletName(params.accountId.userWalletId)
}
_state.update { it.copy(appBarSubtitle = appBarSubtitle) }
}
@ -121,7 +118,7 @@ internal class NFTReceiveModel @Inject constructor(
private fun subscribeToNFTAvailableNetworks() {
combine(
flow = getNFTNetworksUseCase(params.portfolioId),
flow = getNFTNetworksUseCase(params.accountId),
flow2 = searchManager.query.distinctUntilChanged(),
) { networks, query ->
filterNFTAvailableNetworksUseCase(networks, query)
@ -173,7 +170,7 @@ internal class NFTReceiveModel @Inject constructor(
analyticsEventHandler.send(NFTAnalyticsEvent.Receive.BlockchainChosen(network.name))
val networkStatus = getNFTNetworkStatusUseCase.invoke(
userWalletId = params.portfolioId.userWalletId,
userWalletId = params.accountId.userWalletId,
network = network,
) ?: return@launch
@ -198,7 +195,7 @@ internal class NFTReceiveModel @Inject constructor(
private suspend fun configureReceiveAddresses(addresses: NetworkAddress, network: Network): TokenReceiveConfig {
val cryptoCurrency = getNFTCurrencyUseCase.invoke(network)
return receiveAddressesFactory.createForNft(
userWalletId = params.portfolioId.userWalletId,
userWalletId = params.accountId.userWalletId,
addresses = addresses,
network = network,
nft = cryptoCurrency,