Updated on 2026-08-14
This commit is contained in:
parent
53d1d8b9a6
commit
3c24d7f6c8
3 changed files with 19 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ data class UiActions(
|
|||
val openPermissionBottomSheet: () -> Unit,
|
||||
val onChangeApproveType: (ApproveType) -> Unit,
|
||||
// region new actions
|
||||
val onRetryClick: () -> Unit,
|
||||
val onClickFee: () -> Unit,
|
||||
val onSelectFeeType: (TxFee) -> Unit,
|
||||
val onProviderClick: (String) -> Unit,
|
||||
|
|
|
|||
|
|
@ -429,6 +429,17 @@ internal class StateBuilder(
|
|||
iconResId = R.drawable.ic_alert_circle_24,
|
||||
),
|
||||
)
|
||||
is DataError.UnknownError -> SwapWarning.GeneralWarning(
|
||||
notificationConfig = NotificationConfig(
|
||||
title = resourceReference(R.string.common_error),
|
||||
subtitle = resourceReference(R.string.swapping_generic_error),
|
||||
iconResId = R.drawable.img_attention_20,
|
||||
buttonsState = NotificationConfig.ButtonsState.SecondaryButtonConfig(
|
||||
text = resourceReference(R.string.warning_button_refresh),
|
||||
onClick = actions.onRetryClick,
|
||||
),
|
||||
),
|
||||
)
|
||||
else -> SwapWarning.GeneralWarning(
|
||||
notificationConfig = NotificationConfig(
|
||||
title = resourceReference(R.string.common_error),
|
||||
|
|
|
|||
|
|
@ -338,6 +338,9 @@ internal class SwapViewModel @Inject constructor(
|
|||
)
|
||||
}
|
||||
is SwapState.SwapError -> {
|
||||
if (state.error is DataError.UnknownError) {
|
||||
singleTaskScheduler.cancelTask()
|
||||
}
|
||||
uiState = stateBuilder.createQuotesErrorState(
|
||||
uiStateHolder = uiState,
|
||||
swapProvider = provider,
|
||||
|
|
@ -422,6 +425,7 @@ internal class SwapViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("LongMethod")
|
||||
private fun onSwapClick() {
|
||||
singleTaskScheduler.cancelTask()
|
||||
uiState = stateBuilder.createSwapInProgressState(uiState)
|
||||
|
|
@ -833,6 +837,9 @@ internal class SwapViewModel @Inject constructor(
|
|||
swapRouter.openTokenDetails(it.walletId, swapInteractor.getNativeToken(dataState.networkId))
|
||||
}
|
||||
},
|
||||
onRetryClick = {
|
||||
startLoadingQuotesFromLastState()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue