Only timestamp is usefull, no need to build a Date.
This commit is contained in:
parent
b282e310c3
commit
2b21e12f97
3 changed files with 5 additions and 9 deletions
|
|
@ -146,10 +146,9 @@ class TimelineItemEventFactory(
|
||||||
senders = reaction.senders
|
senders = reaction.senders
|
||||||
.sortedByDescending { it.timestamp }
|
.sortedByDescending { it.timestamp }
|
||||||
.map {
|
.map {
|
||||||
val date = Date(it.timestamp)
|
|
||||||
AggregatedReactionSender(
|
AggregatedReactionSender(
|
||||||
senderId = it.senderId,
|
senderId = it.senderId,
|
||||||
timestamp = date,
|
timestamp = it.timestamp,
|
||||||
sentTime = dateFormatter.format(
|
sentTime = dateFormatter.format(
|
||||||
it.timestamp,
|
it.timestamp,
|
||||||
DateFormatterMode.TimeOrDate,
|
DateFormatterMode.TimeOrDate,
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,14 @@ fun anAggregatedReaction(
|
||||||
val timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, java.util.Locale.US).apply {
|
val timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, java.util.Locale.US).apply {
|
||||||
timeZone = TimeZone.getTimeZone("UTC")
|
timeZone = TimeZone.getTimeZone("UTC")
|
||||||
}
|
}
|
||||||
val date = Date(1_689_061_264L)
|
val timestamp = 1_689_061_264L
|
||||||
|
val date = Date(timestamp)
|
||||||
val senders = buildList {
|
val senders = buildList {
|
||||||
repeat(count) { index ->
|
repeat(count) { index ->
|
||||||
add(
|
add(
|
||||||
AggregatedReactionSender(
|
AggregatedReactionSender(
|
||||||
senderId = if (isHighlighted && index == 0) userId else UserId("@user$index:server.org"),
|
senderId = if (isHighlighted && index == 0) userId else UserId("@user$index:server.org"),
|
||||||
timestamp = date,
|
timestamp = timestamp,
|
||||||
sentTime = timeFormatter.format(date),
|
sentTime = timeFormatter.format(date),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,12 @@
|
||||||
|
|
||||||
package io.element.android.features.messages.impl.timeline.model
|
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.core.UserId
|
||||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
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(
|
data class AggregatedReactionSender(
|
||||||
val senderId: UserId,
|
val senderId: UserId,
|
||||||
val timestamp: Date,
|
val timestamp: Long,
|
||||||
val sentTime: String,
|
val sentTime: String,
|
||||||
val user: MatrixUser? = null
|
val user: MatrixUser? = null
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue