Updated on 2026-08-14

This commit is contained in:
Tangem 2024-07-31 14:50:38 +03:00
parent 6ee898a262
commit cef5863d91
2 changed files with 5 additions and 4 deletions

View file

@ -84,12 +84,13 @@ internal class ExchangeStatusFactory(
}
}
suspend fun removeTransactionOnBottomSheetClosed(): TokenDetailsState {
suspend fun removeTransactionOnBottomSheetClosed(isForceTerminal: Boolean = false): TokenDetailsState {
val state = currentStateProvider()
val bottomSheetConfig = state.bottomSheetConfig?.content as? ExchangeStatusBottomSheetConfig ?: return state
val selectedTx = bottomSheetConfig.value
return if (selectedTx.activeStatus.isTerminal(selectedTx.isRefundTerminalStatus)) {
val shouldTerminate = selectedTx.activeStatus.isTerminal(selectedTx.isRefundTerminalStatus) || isForceTerminal
return if (shouldTerminate) {
swapTransactionRepository.removeTransaction(
userWalletId = userWalletId,
fromCryptoCurrency = selectedTx.fromCryptoCurrency,

View file

@ -718,8 +718,8 @@ internal class TokenDetailsViewModel @Inject constructor(
override fun onGoToRefundedTokenClick(cryptoCurrency: CryptoCurrency) {
if (internalUiState.value.bottomSheetConfig?.content is ExchangeStatusBottomSheetConfig) {
viewModelScope.launch(dispatchers.main) {
internalUiState.value = exchangeStatusFactory.removeTransactionOnBottomSheetClosed()
viewModelScope.launch {
internalUiState.value = exchangeStatusFactory.removeTransactionOnBottomSheetClosed(true)
}
}
internalUiState.value = stateFactory.getStateWithClosedBottomSheet()