diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt index a41cf14c7d..c5f6ec3ed8 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/converter/WcSendTransactionUMConverter.kt @@ -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( diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt index 616da6cfc5..271f0cd292 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/entity/send/WcSendTransactionUM.kt @@ -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 \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/model/WcSendTransactionModel.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/model/WcSendTransactionModel.kt index 396be3dd59..2455b74700 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/model/WcSendTransactionModel.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/model/WcSendTransactionModel.kt @@ -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( diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcTransactionRequestButtons.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcTransactionRequestButtons.kt index 9d8ec8d0fb..ed0217aee9 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcTransactionRequestButtons.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/common/WcTransactionRequestButtons.kt @@ -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, ) } } \ No newline at end of file diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt index e05ddf9fac..6d0df9a6db 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/ui/send/WcSendTransactionModalBottomSheet.kt @@ -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, ), ), ) \ No newline at end of file