From 93bab15d0c14389e6950ef017b7fa2c765481cff Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 9 Jul 2026 18:14:18 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../txhistory/list/DefaultHistoryTxListManager.kt | 3 ++- .../domain/txhistory/list/HistoryTxListManager.kt | 10 ++++++++++ .../features/txhistory/model/TxHistoryModel.kt | 13 +------------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/list/DefaultHistoryTxListManager.kt b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/list/DefaultHistoryTxListManager.kt index 668659248d..2879914e6f 100644 --- a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/list/DefaultHistoryTxListManager.kt +++ b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/list/DefaultHistoryTxListManager.kt @@ -61,6 +61,7 @@ internal class DefaultHistoryTxListManager @AssistedInject constructor( logError(error) true } + .runningReduce { previous, new -> if (previous.isContent && !new.isContent) previous else new } .flowOn(dispatchers.io) .stateIn(modelScope, SharingStarted.Eagerly, HistoryState.Loading) } @@ -73,7 +74,7 @@ internal class DefaultHistoryTxListManager @AssistedInject constructor( actionsFlow.trySend(Action.LoadMore) } - private fun buildPipeline() = channelFlow { + private fun buildPipeline(): Flow = channelFlow { val reloadInitialLoading = flow { // initial load emit(Unit) diff --git a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/list/HistoryTxListManager.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/list/HistoryTxListManager.kt index b3b196d81f..517c79486f 100644 --- a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/list/HistoryTxListManager.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/list/HistoryTxListManager.kt @@ -34,6 +34,16 @@ interface HistoryTxListManager { val isLoadingMore: Boolean, val hasMore: Boolean, ) : HistoryState + + val isContent: Boolean + get() = when (this) { + is Content -> true + Empty, + Error, + Loading, + Unavailable, + -> false + } } /** How the history starts for a currency: which on-chain backbone exists and whether express is available. */ diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt index f6f0226271..d90ad6861b 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt @@ -12,12 +12,9 @@ import com.tangem.domain.account.status.supplier.SingleAccountStatusListSupplier import com.tangem.domain.account.status.utils.CryptoCurrencyStatusOperations.getCryptoCurrencyStatus import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase import com.tangem.domain.models.currency.CryptoCurrencyStatus -import com.tangem.domain.models.network.TxInfo import com.tangem.domain.txhistory.TxHistoryFeatureToggles import com.tangem.domain.txhistory.fetcher.AppTxHistoryFetcher import com.tangem.domain.txhistory.fetcher.TxHistoryFetchTrigger -import com.tangem.domain.txhistory.model.ExpressTx -import com.tangem.domain.txhistory.model.OnChainTx import com.tangem.domain.txhistory.list.HistoryTxListManager import com.tangem.domain.txhistory.list.txHistoryInfoFlow import com.tangem.domain.txhistory.model.TxHistoryInfo @@ -349,18 +346,10 @@ internal class TxHistoryModel @Inject constructor( override fun onTransactionClick(item: TxHistoryInfo) { // manager is non-null only under the new tx-history toggle. val manager = historyTxListManager - if (manager != null && item.opensInAppDetails()) { + if (manager != null) { params.onTxDetailsRequested(manager.txHistoryInfoFlow(item)) } else { item.explorerHash?.let(::openTxInExplorer) } } -} - -/** On-chain transfers/swaps and every express op open the in-app details sheet; everything else goes to the explorer. */ -private fun TxHistoryInfo.opensInAppDetails(): Boolean = when (this) { - is ExpressTx -> true - is OnChainTx.BSDK -> txInfo.type is TxInfo.TransactionType.Transfer || txInfo.type is TxInfo.TransactionType.Swap - // Standalone TangemPay rows are not yet rendered in-app; route them to the explorer for now. - is OnChainTx.TangemPay -> false } \ No newline at end of file