Updated on 2026-08-14
This commit is contained in:
parent
165bf516e6
commit
cdf7469dec
38 changed files with 92 additions and 258 deletions
|
|
@ -2,26 +2,6 @@
|
|||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>BooleanPropertyNaming:YieldSupplyApyComponent.kt$YieldSupplyApyComponent$val state by loadingState.collectAsState()</ID>
|
||||
<ID>BooleanPropertyNaming:YieldSupplyModel.kt$YieldSupplyModel$val processing = uiState.value is YieldSupplyUM.Processing</ID>
|
||||
<ID>BooleanPropertyNaming:YieldSupplyModel.kt$YieldSupplyModel$val showWarningIcon = !yieldSupplyStatus.isAllowedToSpend</ID>
|
||||
<ID>BooleanPropertyNaming:YieldSupplyUM.kt$YieldSupplyUM.Content$val showInfoIcon: Boolean</ID>
|
||||
<ID>BooleanPropertyNaming:YieldSupplyUM.kt$YieldSupplyUM.Content$val showWarningIcon: Boolean</ID>
|
||||
<ID>MultilineLambdaItParameter:YieldSupplyApproveModel.kt$YieldSupplyApproveModel${ Timber.e(it) return }</ID>
|
||||
<ID>MultilineLambdaItParameter:YieldSupplyModel.kt$YieldSupplyModel${ Timber.e(it) uiState.update { YieldSupplyUM.Initial } }</ID>
|
||||
<ID>MultilineLambdaItParameter:YieldSupplyModel.kt$YieldSupplyModel${ Timber.w(it.toString()) return@launch }</ID>
|
||||
<ID>MultilineLambdaItParameter:YieldSupplyStartEarningModel.kt$YieldSupplyStartEarningModel${ Timber.w(it.toString()) showAlertError() }</ID>
|
||||
<ID>NamedArguments:YieldSupplyActiveContent.kt$Icon( painterResource(R.drawable.ic_arrow_up_8), tint = TangemTheme.colors.text.accent, contentDescription = null, modifier = Modifier .padding(end = 6.dp) .size(12.dp), )</ID>
|
||||
<ID>NamedArguments:YieldSupplyActiveContent.kt$Icon( painterResource(R.drawable.ic_token_info_24), contentDescription = null, modifier = Modifier.size(20.dp), tint = TangemTheme.colors.text.warning, )</ID>
|
||||
<ID>NamedArguments:YieldSupplyChartUM.kt$YieldSupplyMarketChartDataUM.Companion$YieldSupplyMarketChartDataUM(y = y, x = x, avr = 5.15, "%.1f")</ID>
|
||||
<ID>NoNameShadowing:YieldSupplyStopEarningModel.kt$YieldSupplyStopEarningModel$fee</ID>
|
||||
<ID>NullableToStringCall:YieldSupplyModel.kt$YieldSupplyModel$$tokenPendingStatus</ID>
|
||||
<ID>NullableToStringCall:YieldSupplyModel.kt$YieldSupplyModel$$tokenProtocolStatus</ID>
|
||||
<ID>NullableToStringCall:YieldSupplyModel.kt$YieldSupplyModel$$yieldSupplyStatus</ID>
|
||||
<ID>ReusedModifierInstance:YieldSupplyActiveContent.kt$Text( modifier = modifier, text = apyText, style = TangemTheme.typography.h2, color = TangemTheme.colors.text.accent, )</ID>
|
||||
<ID>ReusedModifierInstance:YieldSupplyActiveContent.kt$TextShimmer( modifier = modifier.width(94.dp), text = "", style = TangemTheme.typography.h2, )</ID>
|
||||
<ID>UnnecessaryEventHandlerParameter:YieldSupplyPromoContent.kt$onClick: (String) -> Unit</ID>
|
||||
<ID>VarCouldBeVal:YieldSupplyApproveModel.kt$YieldSupplyApproveModel$private var userWallet = params.userWallet</ID>
|
||||
<ID>VarCouldBeVal:YieldSupplyStopEarningModel.kt$YieldSupplyStopEarningModel$private var userWallet = params.userWallet</ID>
|
||||
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
|
|||
|
|
@ -153,14 +153,14 @@ private fun CurrentApy(apy: TextReference?, modifier: Modifier = Modifier) {
|
|||
) { apyText ->
|
||||
if (apyText == null) {
|
||||
TextShimmer(
|
||||
modifier = modifier.width(94.dp),
|
||||
modifier = Modifier.width(94.dp),
|
||||
text = "",
|
||||
style = TangemTheme.typography.h2,
|
||||
)
|
||||
} else {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
painterResource(R.drawable.ic_arrow_up_8),
|
||||
painter = painterResource(R.drawable.ic_arrow_up_8),
|
||||
tint = TangemTheme.colors.text.accent,
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
|
|
@ -168,7 +168,7 @@ private fun CurrentApy(apy: TextReference?, modifier: Modifier = Modifier) {
|
|||
.size(12.dp),
|
||||
)
|
||||
Text(
|
||||
modifier = modifier,
|
||||
modifier = Modifier,
|
||||
text = apyText,
|
||||
style = TangemTheme.typography.h2,
|
||||
color = TangemTheme.colors.text.accent,
|
||||
|
|
@ -345,7 +345,7 @@ private fun HighComissionInfoRow(title: TextReference, info: TextReference?, isH
|
|||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
) {
|
||||
Icon(
|
||||
painterResource(R.drawable.ic_token_info_24),
|
||||
painter = painterResource(R.drawable.ic_token_info_24),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(20.dp),
|
||||
tint = TangemTheme.colors.text.warning,
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ internal class YieldSupplyApyComponent(
|
|||
|
||||
@Composable
|
||||
override fun BottomSheet() {
|
||||
val state by loadingState.collectAsState()
|
||||
val isLoadingState by loadingState.collectAsState()
|
||||
YieldSupplyApyContent(
|
||||
apy = stringReference("${params.apy}%"),
|
||||
isLoading = state,
|
||||
isLoading = isLoadingState,
|
||||
onBackClick = params.onBackClick,
|
||||
chartComponent = chartComponent,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ internal data class YieldSupplyMarketChartDataUM(
|
|||
4.2, 6.7, 3.5, 2.5, 4.5, 3.4,
|
||||
).toImmutableList()
|
||||
val x = List(y.size) { 1.0 }.toImmutableList()
|
||||
return YieldSupplyMarketChartDataUM(y = y, x = x, avr = 5.15, "%.1f")
|
||||
return YieldSupplyMarketChartDataUM(y = y, x = x, avr = 5.15, percentFormat = "%.1f")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +27,8 @@ internal sealed class YieldSupplyUM {
|
|||
val subtitle: TextReference,
|
||||
val rewardsApy: TextReference,
|
||||
val onClick: () -> Unit,
|
||||
val showWarningIcon: Boolean,
|
||||
val showInfoIcon: Boolean,
|
||||
val shouldShowWarningIcon: Boolean,
|
||||
val shouldShowInfoIcon: Boolean,
|
||||
) : YieldSupplyUM()
|
||||
|
||||
@Immutable
|
||||
|
|
|
|||
|
|
@ -261,9 +261,9 @@ internal class YieldSupplyModel @Inject constructor(
|
|||
yieldSupplyStatus: YieldSupplyStatus,
|
||||
) {
|
||||
val cryptoCurrencyToken = cryptoCurrency as? CryptoCurrency.Token ?: return
|
||||
val showWarningIcon = !yieldSupplyStatus.isAllowedToSpend
|
||||
val shouldShowWarningIcon = !yieldSupplyStatus.isAllowedToSpend
|
||||
val isShowInfoIconPrevState = when (val state = uiStateLegacy.value) {
|
||||
is YieldSupplyUM.Content -> state.showInfoIcon
|
||||
is YieldSupplyUM.Content -> state.shouldShowInfoIcon
|
||||
else -> false
|
||||
}
|
||||
if (!yieldSupplyStatus.isAllowedToSpend) {
|
||||
|
|
@ -291,8 +291,8 @@ internal class YieldSupplyModel @Inject constructor(
|
|||
stringReference(" ${tokenStatus.apy}%"),
|
||||
),
|
||||
onClick = ::onActiveClick,
|
||||
showWarningIcon = showWarningIcon,
|
||||
showInfoIcon = isShowInfoIconPrevState,
|
||||
shouldShowWarningIcon = shouldShowWarningIcon,
|
||||
shouldShowInfoIcon = isShowInfoIconPrevState,
|
||||
apy = tokenStatus.apy.toString(),
|
||||
)
|
||||
}
|
||||
|
|
@ -309,8 +309,8 @@ internal class YieldSupplyModel @Inject constructor(
|
|||
),
|
||||
rewardsApy = TextReference.EMPTY,
|
||||
onClick = ::onActiveClick,
|
||||
showWarningIcon = showWarningIcon,
|
||||
showInfoIcon = isShowInfoIconPrevState,
|
||||
shouldShowWarningIcon = shouldShowWarningIcon,
|
||||
shouldShowInfoIcon = isShowInfoIconPrevState,
|
||||
apy = "",
|
||||
)
|
||||
}
|
||||
|
|
@ -338,7 +338,7 @@ internal class YieldSupplyModel @Inject constructor(
|
|||
}
|
||||
uiStateLegacy.update { state ->
|
||||
when (state) {
|
||||
is YieldSupplyUM.Content -> state.copy(showInfoIcon = isShowInfoIcon)
|
||||
is YieldSupplyUM.Content -> state.copy(shouldShowInfoIcon = isShowInfoIcon)
|
||||
else -> state
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ internal class YieldSupplyToEarnBlockConverter : Converter<YieldSupplyUM, EarnBl
|
|||
}
|
||||
|
||||
private fun buildTitleIcon(value: YieldSupplyUM.Content): EarnBlockUM.TitleUM.IconUM? = when {
|
||||
value.showWarningIcon -> EarnBlockUM.TitleUM.IconUM(tone = EarnBlockUM.TitleUM.IconTone.Warning)
|
||||
value.showInfoIcon -> EarnBlockUM.TitleUM.IconUM(tone = EarnBlockUM.TitleUM.IconTone.Info)
|
||||
value.shouldShowWarningIcon -> EarnBlockUM.TitleUM.IconUM(tone = EarnBlockUM.TitleUM.IconTone.Warning)
|
||||
value.shouldShowInfoIcon -> EarnBlockUM.TitleUM.IconUM(tone = EarnBlockUM.TitleUM.IconTone.Info)
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,12 +213,12 @@ private fun SupplyContent(supplyUM: YieldSupplyUM.Content, modifier: Modifier =
|
|||
targetState = supplyUM,
|
||||
) { currentState ->
|
||||
when {
|
||||
currentState.showWarningIcon -> Icon(
|
||||
currentState.shouldShowWarningIcon -> Icon(
|
||||
imageVector = ImageVector.vectorResource(R.drawable.ic_alert_triangle_20),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.attention,
|
||||
)
|
||||
currentState.showInfoIcon -> Icon(
|
||||
currentState.shouldShowInfoIcon -> Icon(
|
||||
imageVector = ImageVector.vectorResource(R.drawable.ic_alert_circle_red_20),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors.icon.accent,
|
||||
|
|
@ -432,8 +432,8 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
|
|||
rewardsApy = stringReference("APY 5.1%"),
|
||||
onClick = {},
|
||||
apy = "5.1",
|
||||
showWarningIcon = false,
|
||||
showInfoIcon = true,
|
||||
shouldShowWarningIcon = false,
|
||||
shouldShowInfoIcon = true,
|
||||
),
|
||||
YieldSupplyUM.Content(
|
||||
title = stringReference("Aave lending is active "),
|
||||
|
|
@ -441,8 +441,8 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
|
|||
rewardsApy = stringReference("APY 5.1%"),
|
||||
onClick = {},
|
||||
apy = "5.1",
|
||||
showWarningIcon = true,
|
||||
showInfoIcon = false,
|
||||
shouldShowWarningIcon = true,
|
||||
shouldShowInfoIcon = false,
|
||||
),
|
||||
YieldSupplyUM.Loading,
|
||||
YieldSupplyUM.Processing.Enter,
|
||||
|
|
|
|||
|
|
@ -324,6 +324,7 @@ private fun PromoItem(@DrawableRes icon: Int, title: TextReference, subtitle: Te
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("UnnecessaryEventHandlerParameter")
|
||||
@Composable
|
||||
private fun YieldSupplyTosText(
|
||||
tosLink: String,
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import com.tangem.domain.appcurrency.model.AppCurrency
|
|||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
import com.tangem.domain.models.wallet.isHotWallet
|
||||
import com.tangem.domain.transaction.usecase.CreateApprovalTransactionUseCase
|
||||
import com.tangem.domain.transaction.error.SendTransactionError
|
||||
import com.tangem.domain.transaction.usecase.CreateApprovalTransactionUseCase
|
||||
import com.tangem.domain.transaction.usecase.GetFeeUseCase
|
||||
import com.tangem.domain.transaction.usecase.SendTransactionUseCase
|
||||
import com.tangem.domain.yield.supply.usecase.YieldSupplyGetContractAddressUseCase
|
||||
|
|
@ -72,7 +72,7 @@ internal class YieldSupplyApproveModel @Inject constructor(
|
|||
private val cryptoCurrencyStatus
|
||||
get() = params.cryptoCurrencyStatusFlow.value
|
||||
private val cryptoCurrency = cryptoCurrencyStatus.currency
|
||||
private var userWallet = params.userWallet
|
||||
private val userWallet = params.userWallet
|
||||
|
||||
val feeCryptoCurrencyStatusFlow: StateFlow<CryptoCurrencyStatus>
|
||||
field = MutableStateFlow(
|
||||
|
|
@ -131,10 +131,12 @@ internal class YieldSupplyApproveModel @Inject constructor(
|
|||
val yieldSupplyFeeUM = uiState.value.yieldSupplyFeeUM as? YieldSupplyFeeUM.Content ?: return
|
||||
uiState.update(YieldSupplyTransactionInProgressTransformer)
|
||||
|
||||
analyticsEventHandler.send(YieldSupplyAnalytics.ButtonGiveApprove(
|
||||
token = cryptoCurrency.symbol,
|
||||
blockchain = cryptoCurrency.network.name,
|
||||
))
|
||||
analyticsEventHandler.send(
|
||||
YieldSupplyAnalytics.ButtonGiveApprove(
|
||||
token = cryptoCurrency.symbol,
|
||||
blockchain = cryptoCurrency.network.name,
|
||||
),
|
||||
)
|
||||
|
||||
modelScope.launch(dispatchers.default) {
|
||||
sendTransactionUseCase(
|
||||
|
|
@ -197,11 +199,13 @@ internal class YieldSupplyApproveModel @Inject constructor(
|
|||
memoType = Basic.TransactionSent.MemoType.Null,
|
||||
),
|
||||
)
|
||||
analyticsEventHandler.send(YieldSupplyAnalytics.ApprovalAction(
|
||||
token = cryptoCurrency.symbol,
|
||||
blockchain = cryptoCurrency.network.name,
|
||||
action = YieldSupplyAnalytics.Action.Approve,
|
||||
))
|
||||
analyticsEventHandler.send(
|
||||
YieldSupplyAnalytics.ApprovalAction(
|
||||
token = cryptoCurrency.symbol,
|
||||
blockchain = cryptoCurrency.network.name,
|
||||
action = YieldSupplyAnalytics.Action.Approve,
|
||||
),
|
||||
)
|
||||
params.callback.onTransactionSent()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ internal class YieldSupplyStopEarningModel @Inject constructor(
|
|||
private val cryptoCurrencyStatus
|
||||
get() = params.cryptoCurrencyStatusFlow.value
|
||||
private val cryptoCurrency = cryptoCurrencyStatus.currency
|
||||
private var userWallet = params.userWallet
|
||||
private val userWallet = params.userWallet
|
||||
|
||||
val feeCryptoCurrencyStatusFlow: StateFlow<CryptoCurrencyStatus>
|
||||
field = MutableStateFlow(
|
||||
|
|
@ -270,15 +270,15 @@ internal class YieldSupplyStopEarningModel @Inject constructor(
|
|||
}
|
||||
},
|
||||
ifRight = { fee ->
|
||||
val fee = fee.normal.increaseGasLimitBy(INCREASE_GAS_LIMIT_FOR_SUPPLY)
|
||||
val feeCryptoValue = fee.amount.value.orZero()
|
||||
val adjustedFee = fee.normal.increaseGasLimitBy(INCREASE_GAS_LIMIT_FOR_SUPPLY)
|
||||
val feeCryptoValue = adjustedFee.amount.value.orZero()
|
||||
|
||||
uiState.update(
|
||||
YieldSupplyStopEarningFeeContentTransformer(
|
||||
cryptoCurrencyStatus = cryptoCurrencyStatus,
|
||||
feeCryptoCurrencyStatus = feeCryptoCurrencyStatus,
|
||||
appCurrency = appCurrency,
|
||||
transactions = listOf(exitTransitionData.copy(fee = fee)),
|
||||
transactions = listOf(exitTransitionData.copy(fee = adjustedFee)),
|
||||
feeValue = feeCryptoValue,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ internal class YieldSupplyToEarnBlockConverterTest {
|
|||
subtitle = stringReference("Interest accrues automatically"),
|
||||
rewardsApy = stringReference("APY 5.1%"),
|
||||
onClick = { clicked = true },
|
||||
showWarningIcon = false,
|
||||
showInfoIcon = false,
|
||||
shouldShowWarningIcon = false,
|
||||
shouldShowInfoIcon = false,
|
||||
)
|
||||
|
||||
val result = converter.convert(content)
|
||||
|
|
@ -94,8 +94,8 @@ internal class YieldSupplyToEarnBlockConverterTest {
|
|||
subtitle = stringReference("Interest accrues automatically"),
|
||||
rewardsApy = stringReference("APY 5.1%"),
|
||||
onClick = {},
|
||||
showWarningIcon = true,
|
||||
showInfoIcon = false,
|
||||
shouldShowWarningIcon = true,
|
||||
shouldShowInfoIcon = false,
|
||||
)
|
||||
|
||||
val result = converter.convert(content)
|
||||
|
|
@ -115,8 +115,8 @@ internal class YieldSupplyToEarnBlockConverterTest {
|
|||
subtitle = stringReference("Interest accrues automatically"),
|
||||
rewardsApy = stringReference("APY 5.1%"),
|
||||
onClick = {},
|
||||
showWarningIcon = false,
|
||||
showInfoIcon = true,
|
||||
shouldShowWarningIcon = false,
|
||||
shouldShowInfoIcon = true,
|
||||
)
|
||||
|
||||
val result = converter.convert(content)
|
||||
|
|
@ -136,8 +136,8 @@ internal class YieldSupplyToEarnBlockConverterTest {
|
|||
subtitle = stringReference("Interest accrues automatically"),
|
||||
rewardsApy = stringReference("APY 5.1%"),
|
||||
onClick = {},
|
||||
showWarningIcon = true,
|
||||
showInfoIcon = true,
|
||||
shouldShowWarningIcon = true,
|
||||
shouldShowInfoIcon = true,
|
||||
)
|
||||
|
||||
val result = converter.convert(content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue