From c7792de43bc50bfd3c9fe0743f3e4974dc224be0 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 14 Jul 2025 11:31:03 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../tap/di/domain/WalletsDomainModule.kt | 11 ++------ .../configs/feature_toggles_config.json | 12 -------- .../tangem/data/nft/DefaultNFTRepository.kt | 14 +++------- .../com/tangem/data/nft/di/NFTDataModule.kt | 3 -- .../tangem/features/nft/NFTFeatureToggles.kt | 4 +-- .../features/nft/DefaultNFTFeatureToggles.kt | 8 ------ .../model/WalletSettingsModel.kt | 14 ++++------ .../domain/IsWalletNFTEnabledSyncUseCase.kt | 14 ++++------ .../implementors/MultiWalletContentLoader.kt | 28 ++++++++----------- .../MultiWalletContentLoaderFactory.kt | 3 -- 10 files changed, 30 insertions(+), 81 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/di/domain/WalletsDomainModule.kt b/app/src/main/java/com/tangem/tap/di/domain/WalletsDomainModule.kt index 516a089afa..26467ac00e 100644 --- a/app/src/main/java/com/tangem/tap/di/domain/WalletsDomainModule.kt +++ b/app/src/main/java/com/tangem/tap/di/domain/WalletsDomainModule.kt @@ -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 diff --git a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json index 58acd094db..aba93f0e66 100644 --- a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json +++ b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json @@ -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" diff --git a/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt b/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt index 6887f4016e..5ce4e785c3 100644 --- a/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt +++ b/data/nft/src/main/kotlin/com/tangem/data/nft/DefaultNFTRepository.kt @@ -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) } } \ No newline at end of file diff --git a/data/nft/src/main/kotlin/com/tangem/data/nft/di/NFTDataModule.kt b/data/nft/src/main/kotlin/com/tangem/data/nft/di/NFTDataModule.kt index d91a537605..beeca8c0c2 100644 --- a/data/nft/src/main/kotlin/com/tangem/data/nft/di/NFTDataModule.kt +++ b/data/nft/src/main/kotlin/com/tangem/data/nft/di/NFTDataModule.kt @@ -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, ) diff --git a/features/nft/api/src/main/kotlin/com/tangem/features/nft/NFTFeatureToggles.kt b/features/nft/api/src/main/kotlin/com/tangem/features/nft/NFTFeatureToggles.kt index f982bc3abb..36689ae915 100644 --- a/features/nft/api/src/main/kotlin/com/tangem/features/nft/NFTFeatureToggles.kt +++ b/features/nft/api/src/main/kotlin/com/tangem/features/nft/NFTFeatureToggles.kt @@ -1,8 +1,6 @@ package com.tangem.features.nft interface NFTFeatureToggles { - val isNFTEnabled: Boolean - val isNFTEVMEnabled: Boolean - val isNFTSolanaEnabled: Boolean + val isNFTMediaContentEnabled: Boolean } \ No newline at end of file diff --git a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/DefaultNFTFeatureToggles.kt b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/DefaultNFTFeatureToggles.kt index d59d0d8472..6ee99738ee 100644 --- a/features/nft/impl/src/main/kotlin/com/tangem/features/nft/DefaultNFTFeatureToggles.kt +++ b/features/nft/impl/src/main/kotlin/com/tangem/features/nft/DefaultNFTFeatureToggles.kt @@ -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") diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt index b85bb4de06..b6d2f0e7dd 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt @@ -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, 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 = { diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/IsWalletNFTEnabledSyncUseCase.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/IsWalletNFTEnabledSyncUseCase.kt index e931183ffe..3a7aca03bb 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/IsWalletNFTEnabledSyncUseCase.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/IsWalletNFTEnabledSyncUseCase.kt @@ -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 } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoader.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoader.kt index 007c74fcc6..6a6bd30b0b 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoader.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoader.kt @@ -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, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoaderFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoaderFactory.kt index 9cdb3f5767..71d7be251c 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoaderFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/loaders/implementors/MultiWalletContentLoaderFactory.kt @@ -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,