Only timestamp is usefull, no need to build a Date.

This commit is contained in:
Benoit Marty 2025-10-10 10:02:47 +02:00
parent 81787208c0
commit d1822fd33b
3 changed files with 5 additions and 9 deletions

View file

@ -146,10 +146,9 @@ class TimelineItemEventFactory(
senders = reaction.senders
.sortedByDescending { it.timestamp }
.map {
val date = Date(it.timestamp)
AggregatedReactionSender(
senderId = it.senderId,
timestamp = date,
timestamp = it.timestamp,
sentTime = dateFormatter.format(
it.timestamp,
DateFormatterMode.TimeOrDate,

View file

@ -33,13 +33,14 @@ fun anAggregatedReaction(
val timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, java.util.Locale.US).apply {
timeZone = TimeZone.getTimeZone("UTC")
}
val date = Date(1_689_061_264L)
val timestamp = 1_689_061_264L
val date = Date(timestamp)
val senders = buildList {
repeat(count) { index ->
add(
AggregatedReactionSender(
senderId = if (isHighlighted && index == 0) userId else UserId("@user$index:server.org"),
timestamp = date,
timestamp = timestamp,
sentTime = timeFormatter.format(date),
)
)

View file

@ -7,16 +7,12 @@
package io.element.android.features.messages.impl.timeline.model
import androidx.compose.runtime.Immutable
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.user.MatrixUser
import java.util.Date
// Need to be marked as @Immutable for Date
@Immutable
data class AggregatedReactionSender(
val senderId: UserId,
val timestamp: Date,
val timestamp: Long,
val sentTime: String,
val user: MatrixUser? = null
)