Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-04 17:51:20 +04:00
parent 1554090a9d
commit 775a03b038
5 changed files with 15 additions and 2 deletions

View file

@ -45,6 +45,10 @@ internal class DefaultTangemPayEligibilityManager @Inject constructor(
.also { isEligible -> if (!isEligible) reset() }
}
override suspend fun isPaeraCustomerForAnyWallet(): Boolean {
return getUserWalletsData().any { it.isPaeraCustomer }
}
private suspend fun getUserWalletsData(): List<UserWalletData> {
cachedEligibleWallets?.let { return it }

View file

@ -6,5 +6,6 @@ interface TangemPayEligibilityManager {
suspend fun getEligibleWallets(shouldExcludePaeraCustomers: Boolean): List<UserWallet>
suspend fun getTangemPayAvailability(): Boolean
suspend fun isPaeraCustomerForAnyWallet(): Boolean
fun reset()
}

View file

@ -7,6 +7,7 @@ sealed class MainCustomerInfoContentState {
object Loading : MainCustomerInfoContentState()
object OnboardingBanner : MainCustomerInfoContentState()
data class Content(val info: MainScreenCustomerInfo) : MainCustomerInfoContentState()
object Empty : MainCustomerInfoContentState()
}
data class MainScreenCustomerInfo(

View file

@ -68,17 +68,21 @@ class TangemPayMainScreenCustomerInfoUseCase(
}
private suspend fun showOnboardingBannerIfEligible(userWalletId: UserWalletId) {
if (eligibilityManager.isPaeraCustomerForAnyWallet()) {
updateState(userWalletId, MainCustomerInfoContentState.Empty.right())
return
}
val isEligible = eligibilityManager
.getEligibleWallets(shouldExcludePaeraCustomers = false)
.any { it.walletId == userWalletId }
if (isEligible) {
if (onboardingRepository.getHideMainOnboardingBanner(userWalletId)) {
updateState(userWalletId, TangemPayCustomerInfoError.UnknownError.left())
updateState(userWalletId, MainCustomerInfoContentState.Empty.right())
} else {
updateState(userWalletId, MainCustomerInfoContentState.OnboardingBanner.right())
}
} else {
updateState(userWalletId, TangemPayCustomerInfoError.UnknownError.left())
updateState(userWalletId, MainCustomerInfoContentState.Empty.right())
}
}

View file

@ -88,6 +88,9 @@ internal class TangemPayMainSubscriber @AssistedInject constructor(
closeOnClick = clickIntents::onOnboardingBannerCloseClick,
),
)
is MainCustomerInfoContentState.Empty -> stateController.update(
transformer = TangemPayHiddenStateTransformer(userWalletId),
)
}
}