Updated on 2026-08-14
This commit is contained in:
parent
737bb507d9
commit
f9d1e222af
2 changed files with 8 additions and 8 deletions
|
|
@ -27,6 +27,7 @@ import com.tangem.domain.yield.supply.models.YieldMarketToken
|
||||||
import com.tangem.domain.yield.supply.models.YieldSupplyEnterStatus
|
import com.tangem.domain.yield.supply.models.YieldSupplyEnterStatus
|
||||||
import com.tangem.domain.yield.supply.models.YieldSupplyMarketChartData
|
import com.tangem.domain.yield.supply.models.YieldSupplyMarketChartData
|
||||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||||
|
import com.tangem.utils.coroutines.runSuspendCatching
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
@ -155,7 +156,7 @@ internal class DefaultYieldSupplyRepository(
|
||||||
override suspend fun getTokenPendingStatus(
|
override suspend fun getTokenPendingStatus(
|
||||||
userWalletId: UserWalletId,
|
userWalletId: UserWalletId,
|
||||||
cryptoCurrencyStatus: CryptoCurrencyStatus,
|
cryptoCurrencyStatus: CryptoCurrencyStatus,
|
||||||
): YieldSupplyEnterStatus? = try {
|
): YieldSupplyEnterStatus? = runSuspendCatching {
|
||||||
val cryptoCurrency = cryptoCurrencyStatus.currency
|
val cryptoCurrency = cryptoCurrencyStatus.currency
|
||||||
val walletManager = walletManagersFacade.getOrCreateWalletManager(
|
val walletManager = walletManagersFacade.getOrCreateWalletManager(
|
||||||
userWalletId = userWalletId,
|
userWalletId = userWalletId,
|
||||||
|
|
@ -174,10 +175,9 @@ internal class DefaultYieldSupplyRepository(
|
||||||
hasRecentYieldExitTxs -> YieldSupplyEnterStatus.Exit
|
hasRecentYieldExitTxs -> YieldSupplyEnterStatus.Exit
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
}.onFailure { exception ->
|
||||||
Timber.e(e, "Failed to get pending yield supply status")
|
Timber.w(exception, "Failed to get pending yield supply status")
|
||||||
null
|
}.getOrNull()
|
||||||
}
|
|
||||||
|
|
||||||
override fun getShouldShowYieldPromoBanner(): Flow<Boolean> {
|
override fun getShouldShowYieldPromoBanner(): Flow<Boolean> {
|
||||||
return appPreferencesStore.get(PreferencesKeys.YIELD_SUPPLY_SHOULD_SHOW_MAIN_PROMO_KEY, true)
|
return appPreferencesStore.get(PreferencesKeys.YIELD_SUPPLY_SHOULD_SHOW_MAIN_PROMO_KEY, true)
|
||||||
|
|
|
||||||
|
|
@ -176,14 +176,14 @@ private fun ColumnScope.Content(state: MarketsListUM, modifier: Modifier = Modif
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val marketsNotificationUM = state.marketsNotificationUM
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
state.list !is ListUM.LoadingError &&
|
state.list !is ListUM.LoadingError &&
|
||||||
state.isInSearchMode.not() && state.selectedSortBy != SortByTypeUM.YieldSupply,
|
state.isInSearchMode.not() && state.selectedSortBy != SortByTypeUM.YieldSupply,
|
||||||
) {
|
) {
|
||||||
val wrappedNotification = remember(this) { state.marketsNotificationUM }
|
|
||||||
val showMore = stringResourceSafe(R.string.common_show_more)
|
val showMore = stringResourceSafe(R.string.common_show_more)
|
||||||
|
|
||||||
when (wrappedNotification) {
|
when (marketsNotificationUM) {
|
||||||
is MarketsNotificationUM.YieldSupplyPromo -> {
|
is MarketsNotificationUM.YieldSupplyPromo -> {
|
||||||
val description = stringResourceSafe(
|
val description = stringResourceSafe(
|
||||||
R.string.markets_yield_supply_banner_description,
|
R.string.markets_yield_supply_banner_description,
|
||||||
|
|
@ -199,7 +199,7 @@ private fun ColumnScope.Content(state: MarketsListUM, modifier: Modifier = Modif
|
||||||
}
|
}
|
||||||
|
|
||||||
YieldSupplyInMarketsPromoNotification(
|
YieldSupplyInMarketsPromoNotification(
|
||||||
config = wrappedNotification.config.copy(
|
config = marketsNotificationUM.config.copy(
|
||||||
subtitle = clickableDescription,
|
subtitle = clickableDescription,
|
||||||
),
|
),
|
||||||
modifier = Modifier.padding(bottom = TangemTheme.dimens.spacing12),
|
modifier = Modifier.padding(bottom = TangemTheme.dimens.spacing12),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue