mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Only timestamp is usefull, no need to build a Date.
This commit is contained in:
+1
-2
@@ -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,
|
||||||
|
|||||||
+3
-2
@@ -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),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-5
@@ -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
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user