From 075db99e510f784d2d89bc5220bbea9ed1f579cc Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 19 Jun 2026 17:02:56 +0400 Subject: [PATCH] Updated on 2026-08-14 --- data/express/build.gradle.kts | 1 + .../com/tangem/data/express/DefaultExpressRepository.kt | 6 +++++- .../java/com/tangem/data/express/di/ExpressDataModule.kt | 3 +++ data/onramp/build.gradle.kts | 1 + .../com/tangem/data/onramp/DefaultOnrampRepository.kt | 8 ++++++-- .../java/com/tangem/data/onramp/di/OnrampDataModule.kt | 3 +++ .../tangem/domain}/txhistory/TxHistoryFeatureToggles.kt | 2 +- features/swap/data/build.gradle.kts | 1 + .../java/com/tangem/feature/swap/DefaultSwapRepository.kt | 6 +++++- .../java/com/tangem/feature/swap/di/SwapDataModule.kt | 3 +++ .../txhistory/di/DefaultTxHistoryFeatureToggles.kt | 2 +- .../features/txhistory/di/TxHistoryFeatureModule.kt | 2 +- .../com/tangem/features/txhistory/model/TxHistoryModel.kt | 2 +- 13 files changed, 32 insertions(+), 8 deletions(-) rename {features/txhistory/api/src/main/kotlin/com/tangem/features => domain/txhistory/src/main/kotlin/com/tangem/domain}/txhistory/TxHistoryFeatureToggles.kt (75%) diff --git a/data/express/build.gradle.kts b/data/express/build.gradle.kts index 473892eedf..994d34af6d 100644 --- a/data/express/build.gradle.kts +++ b/data/express/build.gradle.kts @@ -25,6 +25,7 @@ dependencies { implementation(projects.domain.express.models) implementation(projects.domain.express) implementation(projects.domain.wallets.models) + implementation(projects.domain.txhistory) api(projects.domain.models) /** Other */ diff --git a/data/express/src/main/java/com/tangem/data/express/DefaultExpressRepository.kt b/data/express/src/main/java/com/tangem/data/express/DefaultExpressRepository.kt index fd4abccfa9..ff1be9d939 100644 --- a/data/express/src/main/java/com/tangem/data/express/DefaultExpressRepository.kt +++ b/data/express/src/main/java/com/tangem/data/express/DefaultExpressRepository.kt @@ -12,6 +12,7 @@ import com.tangem.domain.express.ExpressRepository import com.tangem.domain.express.models.ExpressProvider import com.tangem.domain.express.models.ExpressProviderType import com.tangem.domain.models.wallet.UserWallet +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.extensions.filterIf import com.tangem.utils.logging.TangemLogger @@ -21,6 +22,7 @@ internal class DefaultExpressRepository( private val expressHistoryDao: ExpressHistoryDao, private val appPreferencesStore: AppPreferencesStore, private val dispatchers: CoroutineDispatcherProvider, + private val txHistoryFeatureToggles: TxHistoryFeatureToggles, ) : ExpressRepository { override suspend fun getProviders( @@ -37,7 +39,9 @@ internal class DefaultExpressRepository( ), ).getOrThrow() - expressHistoryDao.upsertProviders(providers.map { it.toEntity() }) + if (txHistoryFeatureToggles.isNewTxHistoryEnabled) { + expressHistoryDao.upsertProviders(providers.map { it.toEntity() }) + } providers.map(ExpressProviderConverter()::convert) .filterIf(filterProviderTypes.isNotEmpty()) { it.type in filterProviderTypes } diff --git a/data/express/src/main/java/com/tangem/data/express/di/ExpressDataModule.kt b/data/express/src/main/java/com/tangem/data/express/di/ExpressDataModule.kt index 0814d23c42..4e4f456658 100644 --- a/data/express/src/main/java/com/tangem/data/express/di/ExpressDataModule.kt +++ b/data/express/src/main/java/com/tangem/data/express/di/ExpressDataModule.kt @@ -13,6 +13,7 @@ import com.tangem.datasource.local.txhistory.db.dao.ExpressHistoryDao import com.tangem.domain.express.ExpressErrorResolver import com.tangem.domain.express.ExpressRepository import com.tangem.domain.express.ExpressServiceFetcher +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.utils.coroutines.CoroutineDispatcherProvider import dagger.Module import dagger.Provides @@ -40,12 +41,14 @@ internal object ExpressDataModule { expressHistoryDao: ExpressHistoryDao, appPreferencesStore: AppPreferencesStore, dispatchers: CoroutineDispatcherProvider, + txHistoryFeatureToggles: TxHistoryFeatureToggles, ): ExpressRepository { return DefaultExpressRepository( tangemExpressApi = tangemExpressApi, expressHistoryDao = expressHistoryDao, appPreferencesStore = appPreferencesStore, dispatchers = dispatchers, + txHistoryFeatureToggles = txHistoryFeatureToggles, ) } diff --git a/data/onramp/build.gradle.kts b/data/onramp/build.gradle.kts index c61541ce6a..7a531ff97e 100644 --- a/data/onramp/build.gradle.kts +++ b/data/onramp/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { implementation(projects.domain.appTheme.models) implementation(projects.domain.models) implementation(projects.domain.express.models) + implementation(projects.domain.txhistory) // region DI diff --git a/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt b/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt index 41c0e75aa1..e783308ca6 100644 --- a/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt +++ b/data/onramp/src/main/java/com/tangem/data/onramp/DefaultOnrampRepository.kt @@ -26,11 +26,11 @@ import com.tangem.datasource.crypto.DataSignatureVerifier import com.tangem.datasource.exchangeservice.swap.ExpressUtils import com.tangem.datasource.local.converter.toEntity import com.tangem.datasource.local.onramp.countries.OnrampCountriesStore +import com.tangem.datasource.local.onramp.country.OnrampCurrentCountryByIPStore import com.tangem.datasource.local.onramp.currencies.OnrampCurrenciesStore import com.tangem.datasource.local.onramp.pairs.OnrampPairsStore import com.tangem.datasource.local.onramp.paymentmethods.OnrampPaymentMethodsStore import com.tangem.datasource.local.onramp.quotes.OnrampQuotesStore -import com.tangem.datasource.local.onramp.country.OnrampCurrentCountryByIPStore import com.tangem.datasource.local.preferences.AppPreferencesStore import com.tangem.datasource.local.preferences.PreferencesKeys import com.tangem.datasource.local.preferences.utils.getObject @@ -48,6 +48,7 @@ import com.tangem.domain.onramp.model.error.OnrampPairsError import com.tangem.domain.onramp.model.error.OnrampRedirectError import com.tangem.domain.onramp.repositories.OnrampRepository import com.tangem.domain.tokens.model.Amount +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.logging.TangemLogger @@ -75,6 +76,7 @@ internal class DefaultOnrampRepository( private val walletManagersFacade: WalletManagersFacade, private val dataSignatureVerifier: DataSignatureVerifier, private val expressHistoryDao: ExpressHistoryDao, + private val txHistoryFeatureToggles: TxHistoryFeatureToggles, moshi: Moshi, ) : OnrampRepository { @@ -165,7 +167,9 @@ internal class DefaultOnrampRepository( ) .getOrThrow() - expressHistoryDao.upsertOnramps(listOf(response.toEntity(ownerAddress = response.payoutAddress))) + if (txHistoryFeatureToggles.isNewTxHistoryEnabled) { + expressHistoryDao.upsertOnramps(listOf(response.toEntity(ownerAddress = response.payoutAddress))) + } statusConverter.convert(response) } diff --git a/data/onramp/src/main/java/com/tangem/data/onramp/di/OnrampDataModule.kt b/data/onramp/src/main/java/com/tangem/data/onramp/di/OnrampDataModule.kt index 5b8c718f93..0cab59284f 100644 --- a/data/onramp/src/main/java/com/tangem/data/onramp/di/OnrampDataModule.kt +++ b/data/onramp/src/main/java/com/tangem/data/onramp/di/OnrampDataModule.kt @@ -30,6 +30,7 @@ import com.tangem.datasource.local.txhistory.db.dao.ExpressHistoryDao import com.tangem.domain.common.wallets.UserWalletsListRepository import com.tangem.utils.coroutines.AppCoroutineScope import com.tangem.domain.onramp.repositories.* +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.utils.coroutines.CoroutineDispatcherProvider import dagger.Module @@ -58,6 +59,7 @@ internal object OnrampDataModule { dataSignatureVerifier: DataSignatureVerifier, onrampCurrentCountryByIPStore: OnrampCurrentCountryByIPStore, expressHistoryDao: ExpressHistoryDao, + txHistoryFeatureToggles: TxHistoryFeatureToggles, @NetworkMoshi moshi: Moshi, ): OnrampRepository { return DefaultOnrampRepository( @@ -74,6 +76,7 @@ internal object OnrampDataModule { walletManagersFacade = walletManagersFacade, dataSignatureVerifier = dataSignatureVerifier, expressHistoryDao = expressHistoryDao, + txHistoryFeatureToggles = txHistoryFeatureToggles, moshi = moshi, ) } diff --git a/features/txhistory/api/src/main/kotlin/com/tangem/features/txhistory/TxHistoryFeatureToggles.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/TxHistoryFeatureToggles.kt similarity index 75% rename from features/txhistory/api/src/main/kotlin/com/tangem/features/txhistory/TxHistoryFeatureToggles.kt rename to domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/TxHistoryFeatureToggles.kt index 64b805af2b..7cf937781c 100644 --- a/features/txhistory/api/src/main/kotlin/com/tangem/features/txhistory/TxHistoryFeatureToggles.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/TxHistoryFeatureToggles.kt @@ -1,4 +1,4 @@ -package com.tangem.features.txhistory +package com.tangem.domain.txhistory interface TxHistoryFeatureToggles { val isSolanaTxHistoryEnabled: Boolean diff --git a/features/swap/data/build.gradle.kts b/features/swap/data/build.gradle.kts index 052c18df35..83b9f7209f 100644 --- a/features/swap/data/build.gradle.kts +++ b/features/swap/data/build.gradle.kts @@ -43,6 +43,7 @@ dependencies { implementation(projects.domain.transaction.models) implementation(projects.domain.express.models) implementation(projects.domain.account.status) + implementation(projects.domain.txhistory) implementation(projects.libs.blockchainSdk) implementation(projects.libs.crypto) diff --git a/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt b/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt index 4d35b9c0fe..c72fb74d8c 100644 --- a/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt +++ b/features/swap/data/src/main/java/com/tangem/feature/swap/DefaultSwapRepository.kt @@ -29,6 +29,7 @@ import com.tangem.domain.express.models.ExpressOperationType import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.feature.swap.converters.* import com.tangem.feature.swap.domain.api.SwapRepository @@ -55,6 +56,7 @@ internal class DefaultSwapRepository( private val appPreferencesStore: AppPreferencesStore, private val rampStateManager: RampStateManager, private val expressHistoryDao: ExpressHistoryDao, + private val txHistoryFeatureToggles: TxHistoryFeatureToggles, moshi: Moshi, ) : SwapRepository { @@ -253,7 +255,9 @@ internal class DefaultSwapRepository( .getOrThrow() val entity = response.toEntity(ownerAddress = response.fromAddress.orEmpty()) - expressHistoryDao.upsertExchanges(listOf(entity)) + if (txHistoryFeatureToggles.isNewTxHistoryEnabled) { + expressHistoryDao.upsertExchanges(listOf(entity)) + } exchangeStatusConverter.convert(response) }, diff --git a/features/swap/data/src/main/java/com/tangem/feature/swap/di/SwapDataModule.kt b/features/swap/data/src/main/java/com/tangem/feature/swap/di/SwapDataModule.kt index ca24786ea1..df600ee9ad 100644 --- a/features/swap/data/src/main/java/com/tangem/feature/swap/di/SwapDataModule.kt +++ b/features/swap/data/src/main/java/com/tangem/feature/swap/di/SwapDataModule.kt @@ -13,6 +13,7 @@ import com.tangem.datasource.local.preferences.AppPreferencesStore import com.tangem.datasource.local.txhistory.db.dao.ExpressHistoryDao import com.tangem.domain.account.supplier.SingleAccountListSupplier import com.tangem.domain.exchange.RampStateManager +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.domain.walletmanager.WalletManagersFacade import com.tangem.feature.swap.DefaultSwapFeedbackRepository import com.tangem.feature.swap.DefaultSwapRepository @@ -45,6 +46,7 @@ internal class SwapDataModule { appPreferencesStore: AppPreferencesStore, rampStateManager: RampStateManager, expressHistoryDao: ExpressHistoryDao, + txHistoryFeatureToggles: TxHistoryFeatureToggles, ): SwapRepository { return DefaultSwapRepository( tangemExpressApi = tangemExpressApi, @@ -56,6 +58,7 @@ internal class SwapDataModule { appPreferencesStore = appPreferencesStore, rampStateManager = rampStateManager, expressHistoryDao = expressHistoryDao, + txHistoryFeatureToggles = txHistoryFeatureToggles, ) } diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/DefaultTxHistoryFeatureToggles.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/DefaultTxHistoryFeatureToggles.kt index 96448a0f83..6eaf006671 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/DefaultTxHistoryFeatureToggles.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/DefaultTxHistoryFeatureToggles.kt @@ -2,7 +2,7 @@ package com.tangem.features.txhistory.di import com.tangem.core.configtoggle.FeatureToggles import com.tangem.core.configtoggle.feature.FeatureTogglesManager -import com.tangem.features.txhistory.TxHistoryFeatureToggles +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import javax.inject.Inject internal class DefaultTxHistoryFeatureToggles @Inject constructor( diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/TxHistoryFeatureModule.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/TxHistoryFeatureModule.kt index bb46e57bfb..fafee1ffa7 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/TxHistoryFeatureModule.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/di/TxHistoryFeatureModule.kt @@ -1,6 +1,6 @@ package com.tangem.features.txhistory.di -import com.tangem.features.txhistory.TxHistoryFeatureToggles +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.features.txhistory.component.DefaultTxHistoryComponent import com.tangem.features.txhistory.component.DefaultTxHistoryDetailsComponent import com.tangem.features.txhistory.component.TxHistoryComponent diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt index 76c93935a5..b64a5d10d9 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt @@ -26,7 +26,7 @@ import com.tangem.domain.txhistory.repository.TxHistoryRepositoryV2 import com.tangem.domain.txhistory.usecase.GetExplorerTransactionUrlUseCase import com.tangem.domain.txhistory.usecase.GetTxHistoryItemsCountUseCase import com.tangem.domain.wallets.usecase.GetWalletIconUseCase -import com.tangem.features.txhistory.TxHistoryFeatureToggles +import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.features.txhistory.component.TxHistoryComponent import com.tangem.features.txhistory.converter.TxHistoryInfoToTransactionItemUMConverter import com.tangem.features.txhistory.converter.TxHistoryItemToTransactionItemUMConverter