From 97afda563f7b87d44dd318483372971aceabb67a Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 15 Dec 2023 17:39:29 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tokendetails/viewmodels/TokenDetailsViewModel.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt index ef5cb340ad..bafa950c0c 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/viewmodels/TokenDetailsViewModel.kt @@ -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 = {},