Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-09 18:14:18 +04:00
parent 997194b3fb
commit 93bab15d0c
3 changed files with 13 additions and 13 deletions

View file

@ -61,6 +61,7 @@ internal class DefaultHistoryTxListManager @AssistedInject constructor(
logError(error) logError(error)
true true
} }
.runningReduce { previous, new -> if (previous.isContent && !new.isContent) previous else new }
.flowOn(dispatchers.io) .flowOn(dispatchers.io)
.stateIn(modelScope, SharingStarted.Eagerly, HistoryState.Loading) .stateIn(modelScope, SharingStarted.Eagerly, HistoryState.Loading)
} }
@ -73,7 +74,7 @@ internal class DefaultHistoryTxListManager @AssistedInject constructor(
actionsFlow.trySend(Action.LoadMore) actionsFlow.trySend(Action.LoadMore)
} }
private fun buildPipeline() = channelFlow { private fun buildPipeline(): Flow<HistoryState> = channelFlow {
val reloadInitialLoading = flow { val reloadInitialLoading = flow {
// initial load // initial load
emit(Unit) emit(Unit)

View file

@ -34,6 +34,16 @@ interface HistoryTxListManager {
val isLoadingMore: Boolean, val isLoadingMore: Boolean,
val hasMore: Boolean, val hasMore: Boolean,
) : HistoryState ) : 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. */ /** How the history starts for a currency: which on-chain backbone exists and whether express is available. */

View file

@ -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.account.status.utils.CryptoCurrencyStatusOperations.getCryptoCurrencyStatus
import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
import com.tangem.domain.models.currency.CryptoCurrencyStatus 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.TxHistoryFeatureToggles
import com.tangem.domain.txhistory.fetcher.AppTxHistoryFetcher import com.tangem.domain.txhistory.fetcher.AppTxHistoryFetcher
import com.tangem.domain.txhistory.fetcher.TxHistoryFetchTrigger 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.HistoryTxListManager
import com.tangem.domain.txhistory.list.txHistoryInfoFlow import com.tangem.domain.txhistory.list.txHistoryInfoFlow
import com.tangem.domain.txhistory.model.TxHistoryInfo import com.tangem.domain.txhistory.model.TxHistoryInfo
@ -349,18 +346,10 @@ internal class TxHistoryModel @Inject constructor(
override fun onTransactionClick(item: TxHistoryInfo) { override fun onTransactionClick(item: TxHistoryInfo) {
// manager is non-null only under the new tx-history toggle. // manager is non-null only under the new tx-history toggle.
val manager = historyTxListManager val manager = historyTxListManager
if (manager != null && item.opensInAppDetails()) { if (manager != null) {
params.onTxDetailsRequested(manager.txHistoryInfoFlow(item)) params.onTxDetailsRequested(manager.txHistoryInfoFlow(item))
} else { } else {
item.explorerHash?.let(::openTxInExplorer) 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
}