Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-14 11:31:03 +04:00
parent 951226f28f
commit c7792de43b
10 changed files with 30 additions and 81 deletions

View file

@ -15,7 +15,6 @@ import com.tangem.domain.wallets.repository.WalletsRepository
import com.tangem.domain.wallets.usecase.*
import com.tangem.feature.wallet.presentation.wallet.domain.IsWalletNFTEnabledSyncUseCase
import com.tangem.feature.wallet.presentation.wallet.domain.WalletNameMigrationUseCase
import com.tangem.features.nft.NFTFeatureToggles
import com.tangem.operations.attestation.CardArtworksProvider
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import dagger.Module
@ -195,14 +194,8 @@ internal object WalletsDomainModule {
@Provides
@Singleton
fun providesIsWalletNFTEnabledSyncUseCase(
walletsRepository: WalletsRepository,
nftFeatureToggles: NFTFeatureToggles,
): IsWalletNFTEnabledSyncUseCase {
return IsWalletNFTEnabledSyncUseCase(
walletsRepository = walletsRepository,
nftFeatureToggles = nftFeatureToggles,
)
fun providesIsWalletNFTEnabledSyncUseCase(walletsRepository: WalletsRepository): IsWalletNFTEnabledSyncUseCase {
return IsWalletNFTEnabledSyncUseCase(walletsRepository = walletsRepository)
}
@Provides

View file

@ -11,18 +11,6 @@
"name": "STAKING_TON_ENABLED",
"version": "undefined"
},
{
"name": "NFT_ENABLED",
"version": "5.25.0"
},
{
"name": "NFT_EVM_ENABLED",
"version": "5.25.0"
},
{
"name": "NFT_SOLANA_ENABLED",
"version": "5.25.0"
},
{
"name": "NFT_MEDIA_CONTENT_ENABLED",
"version": "undefined"

View file

@ -29,7 +29,6 @@ import com.tangem.domain.nft.repository.NFTRepository
import com.tangem.domain.walletmanager.WalletManagersFacade
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.wallets.models.requireColdWallet
import com.tangem.features.nft.NFTFeatureToggles
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.coroutines.JobHolder
import com.tangem.utils.coroutines.saveIn
@ -50,7 +49,6 @@ internal class DefaultNFTRepository @Inject constructor(
private val walletManagersFacade: WalletManagersFacade,
private val dispatchers: CoroutineDispatcherProvider,
private val userWalletsStore: UserWalletsStore,
private val nftFeatureToggles: NFTFeatureToggles,
private val networkFactory: NetworkFactory,
private val excludedBlockchains: ExcludedBlockchains,
resources: Resources,
@ -545,13 +543,9 @@ internal class DefaultNFTRepository @Inject constructor(
private fun Network.canHandleNFTs(userWalletId: UserWalletId): Boolean {
val scanResponse = userWalletsStore.getSyncStrict(userWalletId).requireColdWallet().scanResponse
val blockchain = Blockchain.fromNetworkId(backendId)
return when {
blockchain == null -> false
blockchain.isEvm() && !nftFeatureToggles.isNFTEVMEnabled -> false
blockchain == Blockchain.Solana && !nftFeatureToggles.isNFTSolanaEnabled -> false
else -> blockchain.canHandleNFTs() &&
scanResponse.card.canHandleToken(blockchain, scanResponse.cardTypesResolver, excludedBlockchains)
}
val blockchain = Blockchain.fromNetworkId(backendId) ?: return false
return blockchain.canHandleNFTs() &&
scanResponse.card.canHandleToken(blockchain, scanResponse.cardTypesResolver, excludedBlockchains)
}
}

View file

@ -9,7 +9,6 @@ import com.tangem.datasource.local.nft.NFTRuntimeStoreFactory
import com.tangem.datasource.local.userwallet.UserWalletsStore
import com.tangem.domain.nft.repository.NFTRepository
import com.tangem.domain.walletmanager.WalletManagersFacade
import com.tangem.features.nft.NFTFeatureToggles
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import dagger.Module
import dagger.Provides
@ -32,7 +31,6 @@ internal object NFTDataModule {
dispatchers: CoroutineDispatcherProvider,
excludedBlockchains: ExcludedBlockchains,
userWalletsStore: UserWalletsStore,
nftFeatureToggles: NFTFeatureToggles,
networkFactory: NetworkFactory,
): NFTRepository = DefaultNFTRepository(
nftPersistenceStoreFactory = nftPersistenceStoreFactory,
@ -41,7 +39,6 @@ internal object NFTDataModule {
dispatchers = dispatchers,
excludedBlockchains = excludedBlockchains,
userWalletsStore = userWalletsStore,
nftFeatureToggles = nftFeatureToggles,
networkFactory = networkFactory,
resources = context.resources,
)

View file

@ -1,8 +1,6 @@
package com.tangem.features.nft
interface NFTFeatureToggles {
val isNFTEnabled: Boolean
val isNFTEVMEnabled: Boolean
val isNFTSolanaEnabled: Boolean
val isNFTMediaContentEnabled: Boolean
}

View file

@ -5,14 +5,6 @@ import com.tangem.core.configtoggle.feature.FeatureTogglesManager
internal class DefaultNFTFeatureToggles(
private val featureTogglesManager: FeatureTogglesManager,
) : NFTFeatureToggles {
override val isNFTEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled(name = "NFT_ENABLED")
override val isNFTEVMEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled(name = "NFT_EVM_ENABLED")
override val isNFTSolanaEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled(name = "NFT_SOLANA_ENABLED")
override val isNFTMediaContentEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled(name = "NFT_MEDIA_CONTENT_ENABLED")

View file

@ -16,7 +16,9 @@ import com.tangem.core.decompose.navigation.Router
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.navigation.settings.SettingsManager
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.message.*
import com.tangem.core.ui.message.DialogMessage
import com.tangem.core.ui.message.EventMessageAction
import com.tangem.core.ui.message.SnackbarMessage
import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.demo.IsDemoCardUseCase
import com.tangem.domain.models.scan.CardDTO
@ -39,7 +41,6 @@ import com.tangem.feature.walletsettings.entity.WalletSettingsItemUM
import com.tangem.feature.walletsettings.entity.WalletSettingsUM
import com.tangem.feature.walletsettings.impl.R
import com.tangem.feature.walletsettings.utils.ItemsBuilder
import com.tangem.features.nft.NFTFeatureToggles
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.collections.immutable.PersistentList
@ -63,12 +64,11 @@ internal class WalletSettingsModel @Inject constructor(
private val analyticsContextProxy: AnalyticsContextProxy,
private val getShouldSaveUserWalletsSyncUseCase: ShouldSaveUserWalletsSyncUseCase,
private val isDemoCardUseCase: IsDemoCardUseCase,
private val nftFeatureToggles: NFTFeatureToggles,
private val getWalletNFTEnabledUseCase: GetWalletNFTEnabledUseCase,
getWalletNFTEnabledUseCase: GetWalletNFTEnabledUseCase,
private val enableWalletNFTUseCase: EnableWalletNFTUseCase,
private val disableWalletNFTUseCase: DisableWalletNFTUseCase,
private val notificationsToggles: NotificationsFeatureToggles,
private val getWalletNotificationsEnabledUseCase: GetWalletNotificationsEnabledUseCase,
getWalletNotificationsEnabledUseCase: GetWalletNotificationsEnabledUseCase,
private val setNotificationsEnabledUseCase: SetNotificationsEnabledUseCase,
private val settingsManager: SettingsManager,
private val permissionsRepository: PermissionRepository,
@ -101,7 +101,6 @@ internal class WalletSettingsModel @Inject constructor(
userWallet = wallet,
dialogNavigation = dialogNavigation,
isRenameWalletAvailable = isRenameWalletAvailable,
isNFTFeatureEnabled = nftFeatureToggles.isNFTEnabled,
isNFTEnabled = nftEnabled,
isNotificationsEnabled = notificationsEnabled,
isNotificationsFeatureEnabled = notificationsToggles.isNotificationsEnabled,
@ -127,7 +126,6 @@ internal class WalletSettingsModel @Inject constructor(
userWallet: UserWallet,
dialogNavigation: SlotNavigation<DialogConfig>,
isRenameWalletAvailable: Boolean,
isNFTFeatureEnabled: Boolean,
isNFTEnabled: Boolean,
isNotificationsFeatureEnabled: Boolean,
isNotificationsEnabled: Boolean,
@ -141,7 +139,7 @@ internal class WalletSettingsModel @Inject constructor(
isManageTokensAvailable = userWallet.isMultiCurrency,
isRenameWalletAvailable = isRenameWalletAvailable,
renameWallet = { openRenameWalletDialog(userWallet, dialogNavigation) },
isNFTFeatureEnabled = isNFTFeatureEnabled && userWallet.isMultiCurrency,
isNFTFeatureEnabled = userWallet.isMultiCurrency,
isNFTEnabled = isNFTEnabled,
onCheckedNFTChange = ::onCheckedNFTChange,
forgetWallet = {

View file

@ -2,21 +2,17 @@ package com.tangem.feature.wallet.presentation.wallet.domain
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.wallets.repository.WalletsRepository
import com.tangem.features.nft.NFTFeatureToggles
import kotlinx.coroutines.flow.firstOrNull
class IsWalletNFTEnabledSyncUseCase(
private val walletsRepository: WalletsRepository,
private val nftFeatureToggles: NFTFeatureToggles,
) {
suspend operator fun invoke(userWalletId: UserWalletId): Boolean = if (nftFeatureToggles.isNFTEnabled) {
walletsRepository
.nftEnabledStatuses()
suspend operator fun invoke(userWalletId: UserWalletId): Boolean {
val isNFTEnabled = walletsRepository.nftEnabledStatuses()
.firstOrNull()
?.let { it[userWalletId] }
?: false
} else {
false
?.get(userWalletId)
return isNFTEnabled == true
}
}

View file

@ -21,11 +21,6 @@ import com.tangem.feature.wallet.presentation.wallet.domain.MultiWalletTokenList
import com.tangem.feature.wallet.presentation.wallet.domain.WalletWithFundsChecker
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
import com.tangem.feature.wallet.presentation.wallet.subscribers.*
import com.tangem.feature.wallet.presentation.wallet.subscribers.MultiWalletActionButtonsSubscriber
import com.tangem.feature.wallet.presentation.wallet.subscribers.MultiWalletTokenListSubscriber
import com.tangem.feature.wallet.presentation.wallet.subscribers.MultiWalletWarningsSubscriber
import com.tangem.feature.wallet.presentation.wallet.subscribers.WalletSubscriber
import com.tangem.features.nft.NFTFeatureToggles
@Suppress("LongParameterList")
@ModelScoped
@ -46,7 +41,6 @@ internal class MultiWalletContentLoader(
private val shouldSaveUserWalletsUseCase: ShouldSaveUserWalletsUseCase,
private val getStoryContentUseCase: GetStoryContentUseCase,
private val deepLinksRegistry: DeepLinksRegistry,
private val nftFeatureToggles: NFTFeatureToggles,
private val walletsRepository: WalletsRepository,
private val currenciesRepository: CurrenciesRepository,
private val routingFeatureToggle: RoutingFeatureToggle,
@ -67,16 +61,16 @@ internal class MultiWalletContentLoader(
deepLinksRegistry = deepLinksRegistry,
routingFeatureToggle = routingFeatureToggle,
).let(::add)
if (nftFeatureToggles.isNFTEnabled) {
WalletNFTListSubscriber(
userWallet = userWallet,
getNFTCollectionsUseCase = getNFTCollectionsUseCase,
stateHolder = stateHolder,
walletsRepository = walletsRepository,
clickIntents = clickIntents,
currenciesRepository = currenciesRepository,
).let(::add)
}
WalletNFTListSubscriber(
userWallet = userWallet,
getNFTCollectionsUseCase = getNFTCollectionsUseCase,
stateHolder = stateHolder,
walletsRepository = walletsRepository,
clickIntents = clickIntents,
currenciesRepository = currenciesRepository,
).let(::add)
MultiWalletWarningsSubscriber(
userWallet = userWallet,
stateHolder = stateHolder,
@ -85,11 +79,13 @@ internal class MultiWalletContentLoader(
walletWarningsAnalyticsSender = walletWarningsAnalyticsSender,
walletWarningsSingleEventSender = walletWarningsSingleEventSender,
).let(::add)
MultiWalletActionButtonsSubscriber(
userWallet = userWallet,
stateHolder = stateHolder,
getStoryContentUseCase = getStoryContentUseCase,
).let(::add)
WalletDropDownItemsSubscriber(
stateHolder = stateHolder,
shouldSaveUserWalletsUseCase = shouldSaveUserWalletsUseCase,

View file

@ -20,7 +20,6 @@ import com.tangem.feature.wallet.presentation.wallet.domain.GetMultiWalletWarnin
import com.tangem.feature.wallet.presentation.wallet.domain.MultiWalletTokenListStore
import com.tangem.feature.wallet.presentation.wallet.domain.WalletWithFundsChecker
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
import com.tangem.features.nft.NFTFeatureToggles
import javax.inject.Inject
@Suppress("LongParameterList")
@ -39,7 +38,6 @@ internal class MultiWalletContentLoaderFactory @Inject constructor(
private val shouldSaveUserWalletsUseCase: ShouldSaveUserWalletsUseCase,
private val getStoryContentUseCase: GetStoryContentUseCase,
private val deepLinksRegistry: DeepLinksRegistry,
private val nftFeatureToggles: NFTFeatureToggles,
private val walletsRepository: WalletsRepository,
private val getNFTCollectionsUseCase: GetNFTCollectionsUseCase,
private val routingFeatureToggle: RoutingFeatureToggle,
@ -63,7 +61,6 @@ internal class MultiWalletContentLoaderFactory @Inject constructor(
getStoryContentUseCase = getStoryContentUseCase,
shouldSaveUserWalletsUseCase = shouldSaveUserWalletsUseCase,
deepLinksRegistry = deepLinksRegistry,
nftFeatureToggles = nftFeatureToggles,
walletsRepository = walletsRepository,
getNFTCollectionsUseCase = getNFTCollectionsUseCase,
routingFeatureToggle = routingFeatureToggle,