Updated on 2026-08-14

This commit is contained in:
Tangem 2023-11-17 16:53:44 +03:00
parent 3b4b45dc99
commit 33c966c934
7 changed files with 37 additions and 11 deletions

View file

@ -418,7 +418,10 @@ internal object WalletPreviewData {
contentItems = MutableStateFlow(
PagingData.from(
listOf(
TxHistoryState.TxHistoryItemState.GroupTitle("Today"),
TxHistoryState.TxHistoryItemState.GroupTitle(
title = "Today",
itemKey = UUID.randomUUID().toString(),
),
TxHistoryState.TxHistoryItemState.Transaction(
TransactionState.Content(
txHash = UUID.randomUUID().toString(),
@ -432,7 +435,10 @@ internal object WalletPreviewData {
onClick = {},
),
),
TxHistoryState.TxHistoryItemState.GroupTitle("Yesterday"),
TxHistoryState.TxHistoryItemState.GroupTitle(
title = "Yesterday",
itemKey = UUID.randomUUID().toString(),
),
TxHistoryState.TxHistoryItemState.Transaction(
TransactionState.Content(
txHash = UUID.randomUUID().toString(),

View file

@ -20,6 +20,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.*
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import java.util.UUID
/**
* Convert from [Flow] of [TxHistoryItem] to [TxHistoryState]
@ -83,7 +84,10 @@ internal class WalletTxHistoryItemFlowConverter(
// If [afterDate] is the first transaction in the flow, add the group title
val afterDate = after.getTimestamp()?.toDateFormat() ?: return@insertSeparators null
if (before is TxHistoryItemState.Title) {
return@insertSeparators TxHistoryItemState.GroupTitle(afterDate)
return@insertSeparators TxHistoryItemState.GroupTitle(
title = afterDate,
itemKey = UUID.randomUUID().toString(),
)
}
/*
@ -92,7 +96,7 @@ internal class WalletTxHistoryItemFlowConverter(
*/
val beforeDate = before.getTimestamp()?.toDateFormat() ?: return@insertSeparators null
return@insertSeparators if (beforeDate != afterDate) {
TxHistoryItemState.GroupTitle(afterDate)
TxHistoryItemState.GroupTitle(title = afterDate, itemKey = UUID.randomUUID().toString())
} else {
null
}