Updated on 2026-08-14
This commit is contained in:
parent
997194b3fb
commit
93bab15d0c
3 changed files with 13 additions and 13 deletions
|
|
@ -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<HistoryState> = channelFlow {
|
||||
val reloadInitialLoading = flow {
|
||||
// initial load
|
||||
emit(Unit)
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue