Updated on 2026-08-14

This commit is contained in:
Tangem 2023-12-15 17:39:29 +03:00
parent b19deae346
commit 97afda563f

View file

@ -219,6 +219,8 @@ internal class TokenDetailsViewModel @Inject constructor(
viewModelScope.launch(dispatchers.io) {
swapTxStatusTaskScheduler.cancelTask()
exchangeStatusFactory.invoke()
.distinctUntilChanged()
.filterNot { it.isEmpty() }
.onEach { swapTxs ->
swapTxStatusTaskScheduler.scheduleTask(
viewModelScope,
@ -230,13 +232,14 @@ internal class TokenDetailsViewModel @Inject constructor(
}
},
onSuccess = { updatedTxs ->
val config = uiState.bottomSheetConfig?.content as? ExchangeStatusBottomSheetConfig
val currentTx = updatedTxs.firstOrNull { it.txId == config?.value?.txId }
val config = uiState.bottomSheetConfig
val exchangeBottomSheet = config?.content as? ExchangeStatusBottomSheetConfig
val currentTx = updatedTxs.firstOrNull { it.txId == exchangeBottomSheet?.value?.txId }
uiState = uiState.copy(
swapTxs = updatedTxs,
bottomSheetConfig = currentTx?.let(
stateFactory::updateStateWithExchangeStatusBottomSheet,
),
) ?: config,
)
},
onError = {},