diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt index 174563c6be..ea6ab16083 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokensListScreen.kt @@ -7,17 +7,14 @@ import androidx.compose.animation.fadeOut import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.FabPosition import androidx.compose.material.Scaffold import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue +import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier @@ -32,9 +29,7 @@ import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.dp import androidx.paging.PagingData -import androidx.paging.compose.LazyPagingItems -import androidx.paging.compose.collectAsLazyPagingItems -import androidx.paging.compose.items +import androidx.paging.compose.* import com.tangem.core.ui.components.PrimaryButton import com.tangem.core.ui.res.TangemColorPalette import com.tangem.core.ui.res.TangemTheme @@ -134,8 +129,11 @@ private fun TokensListContent( item { DifferentAddressesWarning() } } - items(items = tokens, key = TokenItemState::composedId) { - it?.let { TokenItem(model = it) } + tokens.itemKey(TokenItemState::composedId) + tokens.itemContentType(TokenItemState::composedId) + + items(items = tokens.itemSnapshotList.items, key = TokenItemState::composedId) { + TokenItem(model = it) } } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt index 6be91c66ae..93a6d16058 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt @@ -4,9 +4,11 @@ import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope +import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.ui.Modifier import androidx.paging.compose.LazyPagingItems -import androidx.paging.compose.itemsIndexed +import androidx.paging.compose.itemContentType +import androidx.paging.compose.itemKey import com.tangem.core.ui.components.transactions.empty.EmptyTransactionBlock import com.tangem.core.ui.components.transactions.empty.EmptyTransactionsBlockState import com.tangem.core.ui.components.transactions.state.TxHistoryState @@ -26,7 +28,7 @@ fun LazyListScope.txHistoryItems( modifier: Modifier = Modifier, ) { when (state) { - is TxHistoryState.ContentState -> { + is TxHistoryState.Content -> { contentItems( txHistoryItems = requireNotNull(txHistoryItems), modifier = modifier, @@ -58,8 +60,18 @@ private fun LazyListScope.contentItems( txHistoryItems: LazyPagingItems, modifier: Modifier = Modifier, ) { + txHistoryItems.itemKey { item -> + when (item) { + is TxHistoryState.TxHistoryItemState.GroupTitle -> item.title + is TxHistoryState.TxHistoryItemState.Title -> item.onExploreClick.hashCode() + is TxHistoryState.TxHistoryItemState.Transaction -> item.state.txHash + } + } + + txHistoryItems.itemContentType { it::class.java } + itemsIndexed( - items = txHistoryItems, + items = txHistoryItems.itemSnapshotList.items, key = { _, item -> when (item) { is TxHistoryState.TxHistoryItemState.GroupTitle -> item.title @@ -68,8 +80,6 @@ private fun LazyListScope.contentItems( } }, ) { index, item -> - if (item == null) return@itemsIndexed - TxHistoryListItem( state = item, modifier = modifier diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/state/TxHistoryState.kt b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/state/TxHistoryState.kt index a35545faea..a6035f48dc 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/state/TxHistoryState.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/state/TxHistoryState.kt @@ -1,68 +1,17 @@ package com.tangem.core.ui.components.transactions.state import androidx.paging.PagingData -import androidx.paging.TerminalSeparatorType -import androidx.paging.insertHeaderItem -import com.tangem.core.ui.components.wallet.WalletLockedContentState -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flowOf -import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.MutableStateFlow /** Wallet transaction history state */ sealed interface TxHistoryState { - /** - * Wallet transaction history state with content. Items contains a required [TxHistoryItemState.Title]. - * - * @property contentItems content items - */ - sealed class ContentState(private val contentItems: Flow>) : TxHistoryState { - - /** Lambda be invoke when explore button was clicked */ - abstract val onExploreClick: () -> Unit - - /** Content items with [TxHistoryItemState.Title] */ - val items: Flow> - get() { - return contentItems.map { - it.insertHeaderItem( - terminalSeparatorType = TerminalSeparatorType.SOURCE_COMPLETE, - item = TxHistoryItemState.Title(onExploreClick = onExploreClick), - ) - } - } - } - - /** - * Loading state - * - * @property onExploreClick lambda be invoke when explore button was clicked - * @property transactions loading transactions - */ - data class Loading( - override val onExploreClick: () -> Unit, - val transactions: Flow> = getDefaultLoadingTransactions(), - ) : ContentState(transactions) - /** * Wallet transaction history state with content * - * @property onExploreClick lambda be invoke when explore button was clicked - * @property contentItems content items + * @property contentItems content items */ - data class Content( - override val onExploreClick: () -> Unit, - val contentItems: Flow>, - ) : ContentState(contentItems) - - /** - * Locked state - * - * @property onExploreClick lambda be invoke when explore button was clicked - */ - data class Locked(override val onExploreClick: () -> Unit) : - ContentState(contentItems = getDefaultLoadingTransactions()), - WalletLockedContentState + data class Content(val contentItems: MutableStateFlow>) : TxHistoryState /** * Empty state @@ -110,16 +59,15 @@ sealed interface TxHistoryState { data class Transaction(val state: TransactionState) : TxHistoryItemState } - private companion object { - const val LOADING_TX_HASH = "LOADING_TX_HASH" + companion object { + private const val LOADING_TX_HASH = "LOADING_TX_HASH" - private fun getDefaultLoadingTransactions(): Flow> { - return flowOf( - value = PagingData.from( - data = listOf( - element = TxHistoryItemState.Transaction( - state = TransactionState.Loading(txHash = LOADING_TX_HASH), - ), + fun getDefaultLoadingTransactions(onExploreClick: () -> Unit): PagingData { + return PagingData.from( + data = listOf( + TxHistoryItemState.Title(onExploreClick = onExploreClick), + TxHistoryItemState.Transaction( + state = TransactionState.Loading(txHash = LOADING_TX_HASH), ), ), ) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt index 68df79d297..504297fbf1 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/common/WalletPreviewData.kt @@ -19,7 +19,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.components.* import com.tangem.feature.wallet.presentation.wallet.state.components.WalletTokensListState.TokensListItemState import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList -import kotlinx.coroutines.flow.flowOf +import kotlinx.coroutines.flow.MutableStateFlow import java.util.UUID @Suppress("LargeClass") @@ -350,8 +350,7 @@ internal object WalletPreviewData { ), ), txHistoryState = TxHistoryState.Content( - onExploreClick = {}, - contentItems = flowOf( + contentItems = MutableStateFlow( PagingData.from( listOf( TxHistoryState.TxHistoryItemState.GroupTitle("Today"), diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/WalletSingleCurrencyState.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/WalletSingleCurrencyState.kt index ab23400cca..2d4bc11664 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/WalletSingleCurrencyState.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/WalletSingleCurrencyState.kt @@ -1,11 +1,13 @@ package com.tangem.feature.wallet.presentation.wallet.state import androidx.compose.runtime.Immutable +import androidx.paging.PagingData import com.tangem.core.ui.components.marketprice.MarketPriceBlockState import com.tangem.core.ui.components.transactions.state.TxHistoryState import com.tangem.feature.wallet.presentation.wallet.state.components.* import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf +import kotlinx.coroutines.flow.MutableStateFlow /** * Single currency wallet content state @@ -60,6 +62,8 @@ internal sealed class WalletSingleCurrencyState : WalletState.ContentState() { ), ) - override val txHistoryState: TxHistoryState = TxHistoryState.Locked(onExploreClick) + override val txHistoryState: TxHistoryState = TxHistoryState.Content( + contentItems = MutableStateFlow(PagingData.empty()), + ) } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletRefreshStateConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletRefreshStateConverter.kt index f442b7edd2..715a51e7d4 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletRefreshStateConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletRefreshStateConverter.kt @@ -1,12 +1,8 @@ package com.tangem.feature.wallet.presentation.wallet.state.factory -import androidx.paging.PagingData -import androidx.paging.map import com.tangem.common.Provider import com.tangem.core.ui.components.marketprice.MarketPriceBlockState -import com.tangem.core.ui.components.transactions.state.TransactionState import com.tangem.core.ui.components.transactions.state.TxHistoryState -import com.tangem.core.ui.components.transactions.state.TxHistoryState.TxHistoryItemState import com.tangem.feature.wallet.presentation.common.state.TokenItemState import com.tangem.feature.wallet.presentation.wallet.state.WalletMultiCurrencyState import com.tangem.feature.wallet.presentation.wallet.state.WalletSingleCurrencyState @@ -20,9 +16,7 @@ import com.tangem.feature.wallet.presentation.wallet.viewmodels.WalletClickInten import com.tangem.utils.converter.Converter import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toPersistentList -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.filterIsInstance -import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.update internal class WalletRefreshStateConverter( private val currentStateProvider: Provider, @@ -98,30 +92,15 @@ internal class WalletRefreshStateConverter( private fun WalletSingleCurrencyState.Content.getTxHistoryState(): TxHistoryState { return when (txHistoryState) { is TxHistoryState.Content -> { - TxHistoryState.Loading( - onExploreClick = clickIntents::onExploreClick, - transactions = txHistoryState.contentItems - .filterIsInstance>() - .mapPagingData { transaction -> - transaction.copy( - state = TransactionState.Loading(txHash = transaction.state.txHash), - ) - }, - ) + txHistoryState.contentItems.update { + TxHistoryState.getDefaultLoadingTransactions(onExploreClick = clickIntents::onExploreClick) + } + txHistoryState } is TxHistoryState.Empty, is TxHistoryState.Error, is TxHistoryState.NotSupported, - -> TxHistoryState.Loading(onExploreClick = clickIntents::onExploreClick) - is TxHistoryState.Locked, - is TxHistoryState.Loading, -> txHistoryState } } - - private fun Flow>.mapPagingData( - transform: (TxHistoryItemState.Transaction) -> TxHistoryItemState, - ): Flow> { - return map { it.map(transform) } - } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletSkeletonStateConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletSkeletonStateConverter.kt index db8c705554..597647666c 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletSkeletonStateConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/WalletSkeletonStateConverter.kt @@ -16,6 +16,7 @@ import com.tangem.utils.converter.Converter import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList +import kotlinx.coroutines.flow.MutableStateFlow /** * Converter from loaded list of [UserWallet] to skeleton state of screen [WalletState.ContentState] @@ -62,7 +63,11 @@ internal class WalletSkeletonStateConverter( bottomSheetConfig = null, buttons = getButtons(), marketPriceBlockState = MarketPriceBlockState.Loading(currencyName = currencyName), - txHistoryState = TxHistoryState.Loading(onExploreClick = clickIntents::onExploreClick), + txHistoryState = TxHistoryState.Content( + contentItems = MutableStateFlow( + value = TxHistoryState.getDefaultLoadingTransactions(clickIntents::onExploreClick), + ), + ), ) } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadedTxHistoryConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadedTxHistoryConverter.kt index d5a8f7cdbd..e585ac71f5 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadedTxHistoryConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadedTxHistoryConverter.kt @@ -30,6 +30,7 @@ internal class WalletLoadedTxHistoryConverter( private val walletTxHistoryItemFlowConverter by lazy { WalletTxHistoryItemFlowConverter( + currentStateProvider = currentStateProvider, blockchain = currentCardTypeResolverProvider().getBlockchain(), clickIntents = clickIntents, ) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadingTxHistoryConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadingTxHistoryConverter.kt index b9600ca87e..ddb1a4ab1c 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadingTxHistoryConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletLoadingTxHistoryConverter.kt @@ -4,13 +4,13 @@ import androidx.paging.PagingData import arrow.core.Either import com.tangem.common.Provider import com.tangem.core.ui.components.transactions.state.TransactionState -import com.tangem.core.ui.components.transactions.state.TxHistoryState +import com.tangem.core.ui.components.transactions.state.TxHistoryState.* import com.tangem.domain.txhistory.models.TxHistoryStateError import com.tangem.feature.wallet.presentation.wallet.state.WalletSingleCurrencyState import com.tangem.feature.wallet.presentation.wallet.state.WalletState import com.tangem.feature.wallet.presentation.wallet.viewmodels.WalletClickIntents import com.tangem.utils.converter.Converter -import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.flow.update /** * Converter from loading tx history state to [WalletSingleCurrencyState.Content] @@ -33,31 +33,36 @@ internal class WalletLoadingTxHistoryConverter( return requireNotNull(currentStateProvider() as? WalletSingleCurrencyState.Content).copy( txHistoryState = when (error) { is TxHistoryStateError.EmptyTxHistories -> { - TxHistoryState.Empty(onBuyClick = clickIntents::onBuyClick) + Empty(onBuyClick = clickIntents::onBuyClick) } is TxHistoryStateError.DataError -> { - TxHistoryState.Error(onReloadClick = clickIntents::onReloadClick) + Error(onReloadClick = clickIntents::onReloadClick) } is TxHistoryStateError.TxHistoryNotImplemented -> { - TxHistoryState.NotSupported(onExploreClick = clickIntents::onExploreClick) + NotSupported(onExploreClick = clickIntents::onExploreClick) } }, ) } private fun convert(value: Int): WalletSingleCurrencyState.Content { - return requireNotNull(currentStateProvider() as? WalletSingleCurrencyState.Content).copy( - txHistoryState = TxHistoryState.Loading( - onExploreClick = clickIntents::onExploreClick, - transactions = flow { - PagingData.from( - data = MutableList( - size = value, - init = { TransactionState.Loading(it.toString()) }, - ), - ) - }, - ), - ) + val state = requireNotNull(currentStateProvider() as? WalletSingleCurrencyState.Content) + val txHistoryContent = requireNotNull(state.txHistoryState as? Content) + + txHistoryContent.contentItems.update { + PagingData.from( + data = listOf(TxHistoryItemState.Title(onExploreClick = clickIntents::onExploreClick)) + + MutableList( + size = value, + init = { + TxHistoryItemState.Transaction( + state = TransactionState.Loading(it.toString()), + ) + }, + ), + ) + } + + return state } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletTxHistoryItemFlowConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletTxHistoryItemFlowConverter.kt index 8feafcee7c..fae55f6b5b 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletTxHistoryItemFlowConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/state/factory/txhistory/WalletTxHistoryItemFlowConverter.kt @@ -1,23 +1,27 @@ package com.tangem.feature.wallet.presentation.wallet.state.factory.txhistory import android.text.format.DateUtils -import androidx.paging.PagingData -import androidx.paging.TerminalSeparatorType -import androidx.paging.insertSeparators -import androidx.paging.map +import androidx.paging.* import com.tangem.blockchain.common.Blockchain +import com.tangem.common.Provider import com.tangem.core.ui.components.transactions.state.TransactionState import com.tangem.core.ui.components.transactions.state.TxHistoryState import com.tangem.core.ui.components.transactions.state.TxHistoryState.TxHistoryItemState import com.tangem.core.ui.utils.BigDecimalFormatter import com.tangem.domain.txhistory.models.TxHistoryItem +import com.tangem.feature.wallet.presentation.wallet.state.WalletSingleCurrencyState +import com.tangem.feature.wallet.presentation.wallet.state.WalletState import com.tangem.feature.wallet.presentation.wallet.viewmodels.WalletClickIntents import com.tangem.utils.converter.Converter import com.tangem.utils.extensions.isToday import com.tangem.utils.extensions.isYesterday import com.tangem.utils.toBriefAddressFormat +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.flow.update import org.joda.time.DateTime import org.joda.time.DateTimeZone import org.joda.time.format.DateTimeFormatterBuilder @@ -27,12 +31,14 @@ import java.util.Locale /** * Convert from [Flow] of [TxHistoryItem] to [TxHistoryState] * - * @property blockchain blockchain of transactions history - * @property clickIntents screen click intents + * @property currentStateProvider current state provider + * @property blockchain blockchain of transactions history + * @property clickIntents screen click intents * [REDACTED_AUTHOR] */ internal class WalletTxHistoryItemFlowConverter( + private val currentStateProvider: Provider, private val blockchain: Blockchain, private val clickIntents: WalletClickIntents, ) : Converter>, TxHistoryState> { @@ -60,19 +66,30 @@ internal class WalletTxHistoryItemFlowConverter( } override fun convert(value: Flow>): TxHistoryState { - return TxHistoryState.Content( - onExploreClick = clickIntents::onExploreClick, - contentItems = value - .map { pagingData -> - pagingData + val state = currentStateProvider() as WalletSingleCurrencyState + val txHistoryContent = state.txHistoryState as TxHistoryState.Content + + // FIXME: TxHistoryRepository should send loading transactions + // [REDACTED_JIRA] + value + .onEach { txHistoryStatePagingData -> + txHistoryContent.contentItems.update { + txHistoryStatePagingData .map { item -> // [createTransactionState] returns timestamp without formatting TxHistoryItemState.Transaction(state = createTransactionState(item)) } + .insertHeaderItem( + terminalSeparatorType = TerminalSeparatorType.SOURCE_COMPLETE, + item = TxHistoryItemState.Title(clickIntents::onExploreClick), + ) .insertGroupTitle() // method uses the raw timestamp .formatTransactionsTimestamp() // method formats the timestamp - }, - ) + } + } + .launchIn(CoroutineScope(Dispatchers.IO)) + + return txHistoryContent } private fun createTransactionState(item: TxHistoryItem): TransactionState { diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt index 4bc618e81d..8c94b30d15 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/WalletScreen.kt @@ -69,9 +69,9 @@ private fun WalletContent(state: WalletState.ContentState) { .pullRefresh(pullRefreshState), ) { val txHistoryItems = if (state is WalletSingleCurrencyState && - state.txHistoryState is TxHistoryState.ContentState + state.txHistoryState is TxHistoryState.Content ) { - (state.txHistoryState as? TxHistoryState.ContentState)?.items?.collectAsLazyPagingItems() + (state.txHistoryState as? TxHistoryState.Content)?.contentItems?.collectAsLazyPagingItems() } else { null } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt index b6bca4b04a..5deb677137 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt @@ -9,7 +9,6 @@ import com.tangem.common.Provider import com.tangem.common.doOnFailure import com.tangem.common.doOnSuccess import com.tangem.core.ui.components.marketprice.MarketPriceBlockState -import com.tangem.core.ui.components.transactions.state.TxHistoryState import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.card.* @@ -375,8 +374,7 @@ internal class WalletViewModel @Inject constructor( tokensListState is WalletTokensListState.Loading || hasLoadingTokens } is WalletSingleCurrencyState -> { - this is WalletSingleCurrencyState.Content && marketPriceBlockState is MarketPriceBlockState.Loading || - txHistoryState is TxHistoryState.Loading + this is WalletSingleCurrencyState.Content && marketPriceBlockState is MarketPriceBlockState.Loading } is WalletState.Initial -> false } diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index 5b188fd26c..04b0bc5086 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -30,7 +30,7 @@ compose-material3 = "1.1.0" compose-constraint = "1.0.1" compose-navigation = "2.5.3" compose-accompanist = "0.30.1" -compose-paging = "1.0.0-alpha18" +compose-paging = "3.2.0" compose-reorderable = "0.9.6" # endregion Compose