Updated on 2026-08-14
This commit is contained in:
parent
76c129f205
commit
a13a54accd
32 changed files with 665 additions and 35 deletions
|
|
@ -108,4 +108,8 @@ interface YieldSupplyRepository {
|
|||
userWalletId: UserWalletId,
|
||||
cryptoCurrencyStatus: CryptoCurrencyStatus,
|
||||
): YieldSupplyEnterStatus?
|
||||
|
||||
fun getShouldShowYieldPromoBanner(): Flow<Boolean>
|
||||
|
||||
suspend fun setShouldShowYieldPromoBanner(shouldShow: Boolean)
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.tangem.domain.yield.supply.usecase
|
|||
import com.tangem.domain.yield.supply.YieldSupplyRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import java.math.BigDecimal
|
||||
|
||||
/**
|
||||
* Emits a map of APY values per token.
|
||||
|
|
@ -15,11 +16,11 @@ class YieldSupplyApyFlowUseCase(
|
|||
private val yieldSupplyRepository: YieldSupplyRepository,
|
||||
) {
|
||||
|
||||
operator fun invoke(): Flow<Map<String, String>> {
|
||||
operator fun invoke(): Flow<Map<String, BigDecimal>> {
|
||||
return yieldSupplyRepository.getMarketsFlow()
|
||||
.map { yieldMarketTokenList ->
|
||||
yieldMarketTokenList.filter { it.isActive }.associate { token ->
|
||||
token.yieldSupplyKey to token.apy.toString()
|
||||
token.yieldSupplyKey to token.apy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.tangem.domain.yield.supply.usecase
|
||||
|
||||
import com.tangem.domain.yield.supply.YieldSupplyRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class YieldSupplyGetShouldShowMainPromoUseCase(
|
||||
private val yieldSupplyRepository: YieldSupplyRepository,
|
||||
) {
|
||||
|
||||
operator fun invoke(): Flow<Boolean> {
|
||||
return yieldSupplyRepository.getShouldShowYieldPromoBanner()
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.tangem.domain.yield.supply.usecase
|
||||
|
||||
import com.tangem.domain.yield.supply.YieldSupplyRepository
|
||||
|
||||
class YieldSupplySetShouldShowMainPromoUseCase(
|
||||
private val yieldSupplyRepository: YieldSupplyRepository,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(shouldShow: Boolean) {
|
||||
yieldSupplyRepository.setShouldShowYieldPromoBanner(shouldShow)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue