From 8f7f7c85ca530acdd7dfbf83b1c58dfd167435c3 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 8 Feb 2024 22:00:38 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../domain/tokens/GetCurrencyWarningsUseCase.kt | 3 ++- .../wallet/domain/GetMultiWalletWarningsFactory.kt | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt index 3e5b6a3ed4..f8f9049833 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyWarningsUseCase.kt @@ -84,11 +84,12 @@ class GetCurrencyWarningsUseCase( ): Flow { val currency = currencyStatus.currency val cryptoStatuses = operations.getCurrenciesStatusesSync() + val promoBanner = promoRepository.getChangellyPromoBanner() return combine( showSwapPromoTokenUseCase().conflate(), flowOf(marketCryptoCurrencyRepository.isExchangeable(userWalletId, currency)).conflate(), ) { shouldShowSwapPromo, isExchangeable -> - val promoBanner = promoRepository.getChangellyPromoBanner() ?: return@combine null + promoBanner ?: return@combine null val showPromo = promoBanner.isActive && shouldShowSwapPromo if (showPromo && isExchangeable && currencyStatus.value !is CryptoCurrencyStatus.Unreachable) { cryptoStatuses.fold( diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt index e4bec421bb..281f54a762 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt @@ -22,10 +22,7 @@ import dagger.hilt.android.scopes.ViewModelScoped import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.combine -import kotlinx.coroutines.flow.conflate -import kotlinx.coroutines.flow.flowOf +import kotlinx.coroutines.flow.* import timber.log.Timber import javax.inject.Inject @@ -54,14 +51,14 @@ internal class GetMultiWalletWarningsFactory @Inject constructor( val cardTypesResolver = userWallet.scanResponse.cardTypesResolver + val promoFlow = flow { emit(promoRepository.getChangellyPromoBanner()) } return combine( flow = getTokenListUseCase(userWallet.walletId).conflate(), flow2 = isReadyToShowRateAppUseCase().conflate(), flow3 = isNeedToBackupUseCase(userWallet.walletId).conflate(), flow4 = shouldShowSwapPromoWalletUseCase().conflate(), - ) { maybeTokenList, isReadyToShowRating, isNeedToBackup, shouldShowPromo -> - - val promoBanner = promoRepository.getChangellyPromoBanner() + flow5 = promoFlow, + ) { maybeTokenList, isReadyToShowRating, isNeedToBackup, shouldShowPromo, promoBanner -> readyForRateAppNotification = true buildList {