Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-23 13:39:33 +05:00
parent a3a18854c8
commit 92794cb2f6
14 changed files with 35 additions and 13 deletions

View file

@ -406,7 +406,10 @@ internal class ChildFactory @Inject constructor(
is AppRoute.NFT ->
createComponentChild(
context = context,
params = NFTComponent.Params(userWalletId = route.userWalletId),
params = NFTComponent.Params(
userWalletId = route.userWalletId,
walletName = route.walletName,
),
componentFactory = nftComponentFactory,
)
is AppRoute.NFTSend -> {
@ -757,7 +760,10 @@ internal class ChildFactory @Inject constructor(
is AppRoute.NFT ->
route.asComponentChild(
contextProvider = contextProvider(route, contextFactory),
params = NFTComponent.Params(userWalletId = route.userWalletId),
params = NFTComponent.Params(
userWalletId = route.userWalletId,
walletName = route.walletName,
),
componentFactory = nftComponentFactory,
)
is AppRoute.NFTSend -> {

View file

@ -283,6 +283,7 @@ sealed class AppRoute(val path: String) : Route {
@Serializable
data class NFT(
val userWalletId: UserWalletId,
val walletName: String,
) : AppRoute(path = "/nft/${userWalletId.stringValue}")
@Serializable

View file

@ -518,7 +518,6 @@
<string name="nft_details_traits">特徴</string>
<string name="nft_empty_search">結果がありません。別のリクエストをお試しください。</string>
<string name="nft_receive_choose_network">ネットワークを選択</string>
<string name="nft_receive_subtitle">私のウォレットへ</string>
<string name="nft_receive_title">NFTを受け取る</string>
<string name="nft_wallet_count">%1$dコレクションの%2$dNFT</string>
<string name="nft_wallet_receive_nft">ここをタップして最初のNFTを受け取ります</string>

View file

@ -527,7 +527,6 @@
<string name="nft_details_traits">Traits</string>
<string name="nft_empty_search">No results. Please try another request.</string>
<string name="nft_receive_choose_network">Choose network</string>
<string name="nft_receive_subtitle">To My wallet</string>
<string name="nft_receive_title">Receive NFT</string>
<string name="nft_traits_title">Traits</string>
<string name="nft_wallet_count">%1$d NFTs in %2$d collection</string>

View file

@ -8,6 +8,7 @@ interface NFTComponent : ComposableContentComponent {
data class Params(
val userWalletId: UserWalletId,
val walletName: String,
)
interface Factory : ComponentFactory<Params, NFTComponent>

View file

@ -122,6 +122,7 @@ internal class DefaultNFTComponent @AssistedInject constructor(
context = factoryContext,
params = NFTReceiveComponent.Params(
userWalletId = route.userWalletId,
walletName = params.walletName,
onBackClick = ::onChildBack,
),
)

View file

@ -29,6 +29,7 @@ internal class NFTReceiveComponent @AssistedInject constructor(
data class Params(
val userWalletId: UserWalletId,
val walletName: String,
val onBackClick: () -> Unit,
)
}

View file

@ -3,10 +3,12 @@ package com.tangem.features.nft.receive.entity
import androidx.compose.runtime.Immutable
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.fields.entity.SearchBarUM
import com.tangem.core.ui.extensions.TextReference
import kotlinx.collections.immutable.ImmutableList
internal data class NFTReceiveUM(
val onBackClick: () -> Unit,
val appBarSubtitle: TextReference,
val search: SearchBarUM,
val networks: Networks,
val bottomSheetConfig: TangemBottomSheetConfig?,

View file

@ -9,6 +9,7 @@ import com.tangem.core.ui.clipboard.ClipboardManager
import com.tangem.core.ui.components.fields.InputManager
import com.tangem.core.ui.components.fields.entity.SearchBarUM
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.nft.FilterNFTAvailableNetworksUseCase
import com.tangem.domain.nft.GetNFTAvailableNetworksUseCase
import com.tangem.domain.nft.GetNFTNetworkStatusUseCase
@ -47,6 +48,10 @@ internal class NFTReceiveModel @Inject constructor(
private val _state = MutableStateFlow(
value = NFTReceiveUM(
onBackClick = params.onBackClick,
appBarSubtitle = resourceReference(
R.string.hot_crypto_add_token_subtitle,
formatArgs = wrappedList(params.walletName),
),
search = getInitialSearchBar(),
networks = NFTReceiveUM.Networks.Content(persistentListOf()),
bottomSheetConfig = null,

View file

@ -13,6 +13,7 @@ import com.tangem.core.ui.components.appbar.models.TopAppBarButtonUM
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.components.fields.SearchBar
import com.tangem.core.ui.components.fields.TangemSearchBarDefaults
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.extensions.stringResourceSafe
import com.tangem.core.ui.res.TangemTheme
import com.tangem.features.nft.impl.R
@ -33,7 +34,7 @@ internal fun NFTReceive(state: NFTReceiveUM, modifier: Modifier = Modifier) {
onIconClicked = state.onBackClick,
),
title = stringResourceSafe(id = R.string.nft_receive_title),
subtitle = stringResourceSafe(id = R.string.nft_receive_subtitle),
subtitle = state.appBarSubtitle.resolveReference(),
)
},
content = { innerPadding ->

View file

@ -14,7 +14,6 @@ import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.domain.tokens.model.TokenActionsState
import com.tangem.domain.txhistory.usecase.GetExplorerTransactionUrlUseCase
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.feature.wallet.presentation.wallet.domain.OnrampStatusFactory
import com.tangem.feature.wallet.presentation.wallet.domain.unwrap
@ -59,7 +58,7 @@ internal interface WalletContentClickIntents {
fun onDisposeExpressStatus()
fun onNFTClick(userWalletId: UserWalletId)
fun onNFTClick(userWallet: UserWallet)
}
@Suppress("LongParameterList")
@ -242,7 +241,7 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
stateHolder.update(CloseBottomSheetTransformer(userWalletId))
}
override fun onNFTClick(userWalletId: UserWalletId) {
override fun onNFTClick(userWallet: UserWallet) {
val selectedWallet = stateHolder.getSelectedWallet() as? WalletState.MultiCurrency.Content ?: return
val analyticsState = when (val nftState = selectedWallet.nftState) {
is WalletNFTItemUM.Content -> NFTAnalyticsEvent.NFTListScreenOpened.State.Full(nftState.assetsCount)
@ -256,6 +255,6 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
analyticsEventHandler.send(NFTAnalyticsEvent.NFTListScreenOpened(analyticsState))
}
router.openNFT(userWalletId)
router.openNFT(userWallet)
}
}

View file

@ -10,6 +10,7 @@ import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.redux.ReduxStateHolder
import com.tangem.domain.redux.StateDialog
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.feature.wallet.navigation.WalletRoute
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletDialogConfig
@ -116,7 +117,12 @@ internal class DefaultWalletRouter @Inject constructor(
reduxStateHolder.dispatchDialogShow(StateDialog.ScanFailsDialog(StateDialog.ScanFailsSource.MAIN, onTryAgain))
}
override fun openNFT(userWalletId: UserWalletId) {
router.push(AppRoute.NFT(userWalletId))
override fun openNFT(userWallet: UserWallet) {
router.push(
AppRoute.NFT(
userWalletId = userWallet.walletId,
walletName = userWallet.name,
),
)
}
}

View file

@ -4,6 +4,7 @@ import androidx.compose.runtime.Stable
import com.arkivanov.decompose.router.slot.SlotNavigation
import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.feature.wallet.navigation.WalletRoute
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletDialogConfig
@ -58,5 +59,5 @@ internal interface InnerWalletRouter {
fun openScanFailedDialog(onTryAgain: () -> Unit)
/** Open NFT collections screen */
fun openNFT(userWalletId: UserWalletId)
fun openNFT(userWallet: UserWallet)
}

View file

@ -37,7 +37,7 @@ internal class WalletNFTListSubscriber(
SetNFTCollectionsTransformer(
userWalletId = userWallet.walletId,
nftCollections = it,
onItemClick = { clickIntents.onNFTClick(userWallet.walletId) },
onItemClick = { clickIntents.onNFTClick(userWallet) },
),
)
}