Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-29 14:21:09 +05:00
parent 2a858f8de0
commit 9e74a355b5
5 changed files with 18 additions and 4 deletions

View file

@ -43,6 +43,7 @@ internal class WcSendTransactionUMConverter @Inject constructor(
estimatedWalletChanges = WcSendReceiveTransactionCheckResultsUM(),
isLoading = value.signState.domainStep == WcSignStep.Signing,
address = WcAddressConverter.convert(value.context.derivationState),
sendEnabled = value.feeSelectorUM is FeeSelectorUM.Content,
),
feeSelectorUM = value.feeSelectorUM ?: FeeSelectorUM.Loading,
transactionRequestInfo = WcTransactionRequestInfoUM(

View file

@ -26,5 +26,6 @@ internal data class WcSendTransactionItemUM(
val walletName: String?,
val networkInfo: WcNetworkInfoUM,
val address: String?,
val sendEnabled: Boolean,
val isLoading: Boolean = false,
) : TangemBottomSheetConfigContent

View file

@ -157,7 +157,12 @@ internal class WcSendTransactionModel @Inject constructor(
* Also handles fee results from FeeSelectorBlockComponent
*/
fun updateFee(feeSelectorUM: FeeSelectorUM) {
_uiState.update { it?.copy(feeSelectorUM = feeSelectorUM) }
_uiState.update {
it?.copy(
feeSelectorUM = feeSelectorUM,
transaction = it.transaction.copy(sendEnabled = feeSelectorUM is FeeSelectorUM.Content),
)
}
val fee = (feeSelectorUM as? FeeSelectorUM.Content)?.selectedFeeItem?.fee ?: return
(useCase as? WcMutableFee)?.updateFee(fee)
}
@ -201,9 +206,10 @@ internal class WcSendTransactionModel @Inject constructor(
}
val feeState = when {
useCase is WcMutableFee ->
WcTransactionFeeState
.Success(dAppFee = useCase.dAppFee(), onClick = { onShowFeeBottomSheet() })
useCase is WcMutableFee -> WcTransactionFeeState.Success(
dAppFee = useCase.dAppFee(),
onClick = ::onShowFeeBottomSheet,
)
else -> WcTransactionFeeState.None
}
val actions = WcTransactionActionsUM(

View file

@ -20,6 +20,7 @@ internal fun WcTransactionRequestButtons(
onDismiss: () -> Unit,
onClickActiveButton: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
) {
Row(modifier = modifier, horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing8)) {
SecondaryButton(
@ -37,6 +38,7 @@ internal fun WcTransactionRequestButtons(
onClick = onClickActiveButton,
iconResId = R.drawable.ic_tangem_24,
showProgress = isLoading,
enabled = enabled,
)
}
}

View file

@ -118,6 +118,7 @@ internal fun WcSendTransactionModalBottomSheet(
onClickActiveButton = state.onSend,
activeButtonText = resourceReference(R.string.common_send),
isLoading = state.isLoading,
enabled = state.sendEnabled,
)
},
)
@ -197,6 +198,7 @@ private class WcSendTransactionStateProvider : CollectionPreviewParameterProvide
networkInfo = WcNetworkInfoUM(name = "Optimistic Ethereum Network", iconRes = R.drawable.img_eth_22),
feeState = WcTransactionFeeState.Success(null, {}),
address = null,
sendEnabled = true,
),
WcSendTransactionItemUM(
onDismiss = {},
@ -232,6 +234,7 @@ private class WcSendTransactionStateProvider : CollectionPreviewParameterProvide
networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22),
feeState = WcTransactionFeeState.Success(null, {}),
address = "0xdac17f958d2ee523a2206206994597c13d831ec7",
sendEnabled = true,
),
WcSendTransactionItemUM(
onDismiss = {},
@ -267,6 +270,7 @@ private class WcSendTransactionStateProvider : CollectionPreviewParameterProvide
networkInfo = WcNetworkInfoUM(name = "Ethereum", iconRes = R.drawable.img_eth_22),
feeState = WcTransactionFeeState.None,
address = null,
sendEnabled = false,
),
),
)