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 5920e09e81..202930549a 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 @@ -81,7 +81,7 @@ private fun LazyListScope.contentItems( count = txHistoryItems.itemCount, key = txHistoryItems.itemKey { item -> when (item) { - is TxHistoryState.TxHistoryItemState.GroupTitle -> item.title + is TxHistoryState.TxHistoryItemState.GroupTitle -> item.itemKey is TxHistoryState.TxHistoryItemState.Title -> item.onExploreClick.hashCode() is TxHistoryState.TxHistoryItemState.Transaction -> item.state.txHash } diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TxHistoryGroupTitle.kt b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TxHistoryGroupTitle.kt index c7eaaa7978..4676fd5c49 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TxHistoryGroupTitle.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TxHistoryGroupTitle.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import com.tangem.core.ui.components.transactions.state.TxHistoryState.TxHistoryItemState import com.tangem.core.ui.res.TangemTheme +import java.util.UUID /** * Transactions block group title @@ -38,7 +39,9 @@ internal fun TxHistoryGroupTitle(config: TxHistoryItemState.GroupTitle, modifier @Composable private fun Preview_TransactionsBlockGroupTitle_Light() { TangemTheme(isDark = false) { - TxHistoryGroupTitle(config = TxHistoryItemState.GroupTitle(title = "Today")) + TxHistoryGroupTitle( + config = TxHistoryItemState.GroupTitle(title = "Today", itemKey = UUID.randomUUID().toString()), + ) } } @@ -46,6 +49,8 @@ private fun Preview_TransactionsBlockGroupTitle_Light() { @Composable private fun Preview_TransactionsBlockGroupTitle_Dark() { TangemTheme(isDark = true) { - TxHistoryGroupTitle(config = TxHistoryItemState.GroupTitle(title = "Today")) + TxHistoryGroupTitle( + config = TxHistoryItemState.GroupTitle(title = "Today", itemKey = UUID.randomUUID().toString()), + ) } } \ No newline at end of file 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 6e297a4196..9801f79276 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 @@ -49,8 +49,12 @@ sealed interface TxHistoryState { * Group title item * * @property title title + * @property itemKey key to use in compose */ - data class GroupTitle(val title: String) : TxHistoryItemState + data class GroupTitle( + val title: String, + val itemKey: String, + ) : TxHistoryItemState /** * Transaction item diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/txhistory/TokenDetailsTxHistoryItemFlowConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/txhistory/TokenDetailsTxHistoryItemFlowConverter.kt index 40261aefd2..f43fa49739 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/txhistory/TokenDetailsTxHistoryItemFlowConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/txhistory/TokenDetailsTxHistoryItemFlowConverter.kt @@ -18,6 +18,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.* import org.joda.time.DateTime import org.joda.time.DateTimeZone +import java.util.UUID internal class TokenDetailsTxHistoryItemFlowConverter( private val currentStateProvider: Provider, @@ -75,7 +76,10 @@ internal class TokenDetailsTxHistoryItemFlowConverter( // 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(), + ) } /* @@ -84,7 +88,10 @@ internal class TokenDetailsTxHistoryItemFlowConverter( */ 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 } 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 e4f7243ad9..9ffd482c85 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 @@ -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(), 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 8f3e20271e..32b55caef0 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 @@ -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 } diff --git a/gradle/dependencies.toml b/gradle/dependencies.toml index c5883d66de..78c28fd647 100644 --- a/gradle/dependencies.toml +++ b/gradle/dependencies.toml @@ -88,7 +88,7 @@ spr-client = "3.6.2" # endregion Other libraries # region Tangem -tangemBlockchainSdk = "release-app_5.2-391" +tangemBlockchainSdk = "release-app_5.2-392" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "release-app_5.2-311" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds