mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 10:32:34 +00:00
Apply the same fix for emotes, notices and other message type.
This commit is contained in:
committed by
Benoit Marty
parent
70abf6226f
commit
74729fe534
+11
-8
@@ -69,12 +69,15 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
|||||||
|
|
||||||
suspend fun create(content: MessageContent, senderDisplayName: String, eventId: EventId?): TimelineItemEventContent {
|
suspend fun create(content: MessageContent, senderDisplayName: String, eventId: EventId?): TimelineItemEventContent {
|
||||||
return when (val messageType = content.type) {
|
return when (val messageType = content.type) {
|
||||||
is EmoteMessageType -> TimelineItemEmoteContent(
|
is EmoteMessageType -> {
|
||||||
body = "* $senderDisplayName ${messageType.body}",
|
val emoteBody = "* $senderDisplayName ${messageType.body}"
|
||||||
htmlDocument = messageType.formatted?.toHtmlDocument(prefix = "* $senderDisplayName"),
|
TimelineItemEmoteContent(
|
||||||
formattedBody = parseHtml(messageType.formatted, prefix = "* $senderDisplayName"),
|
body = emoteBody,
|
||||||
isEdited = content.isEdited,
|
htmlDocument = messageType.formatted?.toHtmlDocument(prefix = "* $senderDisplayName"),
|
||||||
)
|
formattedBody = parseHtml(messageType.formatted, prefix = "* $senderDisplayName") ?: emoteBody.withLinks(),
|
||||||
|
isEdited = content.isEdited,
|
||||||
|
)
|
||||||
|
}
|
||||||
is ImageMessageType -> {
|
is ImageMessageType -> {
|
||||||
val aspectRatio = aspectRatioOf(messageType.info?.width, messageType.info?.height)
|
val aspectRatio = aspectRatioOf(messageType.info?.width, messageType.info?.height)
|
||||||
TimelineItemImageContent(
|
TimelineItemImageContent(
|
||||||
@@ -172,7 +175,7 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
|||||||
is NoticeMessageType -> TimelineItemNoticeContent(
|
is NoticeMessageType -> TimelineItemNoticeContent(
|
||||||
body = messageType.body,
|
body = messageType.body,
|
||||||
htmlDocument = messageType.formatted?.toHtmlDocument(),
|
htmlDocument = messageType.formatted?.toHtmlDocument(),
|
||||||
formattedBody = parseHtml(messageType.formatted),
|
formattedBody = parseHtml(messageType.formatted) ?: messageType.body.withLinks(),
|
||||||
isEdited = content.isEdited,
|
isEdited = content.isEdited,
|
||||||
)
|
)
|
||||||
is TextMessageType -> {
|
is TextMessageType -> {
|
||||||
@@ -186,7 +189,7 @@ class TimelineItemContentMessageFactory @Inject constructor(
|
|||||||
is OtherMessageType -> TimelineItemTextContent(
|
is OtherMessageType -> TimelineItemTextContent(
|
||||||
body = messageType.body,
|
body = messageType.body,
|
||||||
htmlDocument = null,
|
htmlDocument = null,
|
||||||
formattedBody = null,
|
formattedBody = messageType.body.withLinks(),
|
||||||
isEdited = content.isEdited,
|
isEdited = content.isEdited,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user