Updated on 2026-08-14
This commit is contained in:
parent
df9ecedf67
commit
c8c61bb9d6
3 changed files with 22 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<WcRequestError, String>, useCase: WcSignUseCase<*>) {
|
||||
if (result.isLeft()) {
|
||||
private fun handleSigningError(result: Either<WcRequestError, String>, 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue