Map all replyTo data and add preview for loading and erorr case.
This commit is contained in:
+5
-2
@@ -26,7 +26,7 @@ sealed interface InReplyTo {
|
||||
data class NotLoaded(val eventId: EventId) : InReplyTo
|
||||
|
||||
/** The event details are pending to be fetched. We should **not** fetch them again. */
|
||||
data object Pending : InReplyTo
|
||||
data class Pending(val eventId: EventId) : InReplyTo
|
||||
|
||||
/** The event details are available. */
|
||||
data class Ready(
|
||||
@@ -44,5 +44,8 @@ sealed interface InReplyTo {
|
||||
* If the reason for the failure is consistent on the server, we'd enter a loop
|
||||
* where we keep trying to fetch the same event.
|
||||
* */
|
||||
data object Error : InReplyTo
|
||||
data class Error(
|
||||
val eventId: EventId,
|
||||
val message: String,
|
||||
) : InReplyTo
|
||||
}
|
||||
|
||||
+10
-3
@@ -57,9 +57,16 @@ class EventMessageMapper {
|
||||
senderProfile = event.senderProfile.map(),
|
||||
)
|
||||
}
|
||||
is RepliedToEventDetails.Error -> InReplyTo.Error
|
||||
is RepliedToEventDetails.Pending -> InReplyTo.Pending
|
||||
is RepliedToEventDetails.Unavailable -> InReplyTo.NotLoaded(inReplyToId)
|
||||
is RepliedToEventDetails.Error -> InReplyTo.Error(
|
||||
eventId = inReplyToId,
|
||||
message = event.message,
|
||||
)
|
||||
RepliedToEventDetails.Pending -> InReplyTo.Pending(
|
||||
eventId = inReplyToId,
|
||||
)
|
||||
is RepliedToEventDetails.Unavailable -> InReplyTo.NotLoaded(
|
||||
eventId = inReplyToId
|
||||
)
|
||||
}
|
||||
}
|
||||
MessageContent(
|
||||
|
||||
Reference in New Issue
Block a user