From c8c61bb9d6d9cf38f64d38fc590257743236423a Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 29 Jul 2025 21:30:46 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../connections/utils/WcAlertsFactory.kt | 14 +++++++++++--- .../transaction/model/WcSendTransactionModel.kt | 10 ++++++---- .../transaction/routes/WcTransactionRoutes.kt | 6 +++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/utils/WcAlertsFactory.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/utils/WcAlertsFactory.kt index 587d3936b5..095ccd662e 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/utils/WcAlertsFactory.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/connections/utils/WcAlertsFactory.kt @@ -20,7 +20,7 @@ internal object WcAlertsFactory { is WcTransactionRoutes.Alert.Type.BlockAidErrorInfo -> createMaliciousDAppAlert(alertType.description, alertType.onClick, alertType.iconType, alertType.iconBgType) is WcTransactionRoutes.Alert.Type.UnknownError -> - createUnknownErrorAlert(alertType.errorMessage, alertType.onDismiss) + createUnknownErrorAlert(alertType.errorMessage, alertType.onDismiss, alertType.onRetry) } fun createUnknownDomainAlert(activeButtonOnClick: (() -> Unit)? = null): MessageBottomSheetUMV2 { @@ -127,7 +127,11 @@ internal object WcAlertsFactory { } } - private fun createUnknownErrorAlert(errorMessage: String?, onDismiss: () -> Unit): MessageBottomSheetUMV2 { + private fun createUnknownErrorAlert( + errorMessage: String?, + onDismiss: () -> Unit, + onRetry: () -> Unit, + ): MessageBottomSheetUMV2 { return messageBottomSheetUM { infoBlock { icon(R.drawable.img_attention_20) { @@ -143,8 +147,12 @@ internal object WcAlertsFactory { ) } } + primaryButton { + text = resourceReference(R.string.alert_button_try_again) + onClick { onRetry() } + } secondaryButton { - text = resourceReference(R.string.balance_hidden_got_it_button) + text = resourceReference(R.string.common_cancel) onClick { onDismiss() } } onDismissRequest = onDismiss 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 965e4430b8..a5e0db4044 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 @@ -317,22 +317,24 @@ internal class WcSendTransactionModel @Inject constructor( private fun signingIsDone(signState: WcSignState<*>, useCase: WcSignUseCase<*>): Boolean { (signState.domainStep as? WcSignStep.Result)?.result?.let { - handleSigningError(it, useCase) - return true + return handleSigningError(it, useCase) } return false } - private fun handleSigningError(result: Either, useCase: WcSignUseCase<*>) { - if (result.isLeft()) { + private fun handleSigningError(result: Either, useCase: WcSignUseCase<*>): Boolean { + return if (result.isLeft()) { val error = WcTransactionRoutes.Alert.Type.UnknownError( errorMessage = result.leftOrNull()?.message(), onDismiss = { cancel(useCase) }, + onRetry = { signFromAlert() }, ) stackNavigation.pushNew(WcTransactionRoutes.Alert(error)) + false } else { showSuccessSignMessage() router.pop() + true } } diff --git a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/routes/WcTransactionRoutes.kt b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/routes/WcTransactionRoutes.kt index 44b4ae7531..843e0e291d 100644 --- a/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/routes/WcTransactionRoutes.kt +++ b/features/walletconnect/impl/src/main/kotlin/com/tangem/features/walletconnect/transaction/routes/WcTransactionRoutes.kt @@ -34,7 +34,11 @@ internal sealed class WcTransactionRoutes : TangemBottomSheetConfigContent, Rout val iconType: MessageBottomSheetUMV2.Icon.Type, val iconBgType: MessageBottomSheetUMV2.Icon.BackgroundType, ) : Type() - data class UnknownError(val errorMessage: String?, val onDismiss: () -> Unit) : Type() + data class UnknownError( + val errorMessage: String?, + val onDismiss: () -> Unit, + val onRetry: () -> Unit, + ) : Type() } } } \ No newline at end of file