Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-10 11:49:44 +03:00
commit 6519ad5568
341 changed files with 6153 additions and 6250 deletions

View file

@ -8,8 +8,6 @@ import com.tangem.domain.models.wallet.isLocked
import com.tangem.domain.models.wallet.isMultiCurrency
import com.tangem.domain.pay.TangemPayEligibilityManager
import com.tangem.domain.pay.repository.OnboardingRepository
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.hot.sdk.model.HotWalletId
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.*
@ -20,9 +18,7 @@ import javax.inject.Inject
internal class DefaultTangemPayEligibilityManager @Inject constructor(
dispatchers: CoroutineDispatcherProvider,
private val userWalletsListManager: UserWalletsListManager,
private val userWalletsListRepository: UserWalletsListRepository,
private val hotWalletFeatureToggles: HotWalletFeatureToggles,
private val onboardingRepository: OnboardingRepository,
) : TangemPayEligibilityManager {
@ -83,12 +79,12 @@ internal class DefaultTangemPayEligibilityManager @Inject constructor(
}
}
private fun getPossibleWalletsForTangemPay(): List<UserWallet> {
val wallets = if (hotWalletFeatureToggles.isHotWalletEnabled) {
userWalletsListRepository.userWallets.value
} else {
userWalletsListManager.userWalletsSync
} ?: return emptyList()
private suspend fun getPossibleWalletsForTangemPay(): List<UserWallet> {
if (!checkTangemPayEligibility()) {
return emptyList()
}
val wallets = userWalletsListRepository.userWallets.value ?: return emptyList()
return wallets.filter { wallet ->
wallet.isMultiCurrency && !wallet.isLocked && wallet.isCompatible()
@ -122,11 +118,7 @@ internal class DefaultTangemPayEligibilityManager @Inject constructor(
private fun resetDataWhenWalletsUpdate() {
coroutineScope.launch {
if (hotWalletFeatureToggles.isHotWalletEnabled) {
userWalletsListRepository.userWallets.collectLatest { reset() }
} else {
userWalletsListManager.userWallets.collectLatest { reset() }
}
userWalletsListRepository.userWallets.collectLatest { reset() }
}
}

View file

@ -19,8 +19,6 @@ import com.tangem.domain.pay.model.CustomerInfo.ProductInstance
import com.tangem.domain.pay.repository.OnboardingRepository
import com.tangem.domain.visa.error.VisaApiError
import com.tangem.domain.visa.model.TangemPayCardFrozenState
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -42,9 +40,7 @@ internal class DefaultOnboardingRepository @Inject constructor(
private val tangemPayStorage: TangemPayStorage,
private val authDataSource: TangemPayAuthDataSource,
private val cardFrozenStateStore: TangemPayCardFrozenStateStore,
private val userWalletsListManager: UserWalletsListManager,
private val userWalletsListRepository: UserWalletsListRepository,
private val hotWalletFeatureToggles: HotWalletFeatureToggles,
) : OnboardingRepository {
// Save data for a session
@ -133,12 +129,8 @@ internal class DefaultOnboardingRepository @Inject constructor(
}
private fun getUserWallet(userWalletId: UserWalletId): UserWallet {
val userWallet = if (hotWalletFeatureToggles.isHotWalletEnabled) {
userWalletsListRepository.userWallets.value?.firstOrNull { it.walletId == userWalletId }
} else {
userWalletsListManager.userWalletsSync.firstOrNull { it.walletId == userWalletId }
} ?: error("no userWallet found")
return userWallet
return userWalletsListRepository.userWallets.value?.firstOrNull { it.walletId == userWalletId }
?: error("no userWallet found")
}
private suspend fun getCustomerInfo(