fixing message starts being cutoff due to expecting a reply tag to exist
This commit is contained in:
parent
e85d7a5ede
commit
299c6af27a
|
@ -162,11 +162,6 @@ internal class TimelineEventMapper(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.stripTags() = this.substring(this.indexOf("</mx-reply>") + "</mx-reply>".length)
|
|
||||||
.trim()
|
|
||||||
.replace("<em>", "")
|
|
||||||
.replace("</em>", "")
|
|
||||||
|
|
||||||
private fun ApiTimelineEvent.TimelineMessage.isEdit() = this.content.relation?.relationType == "m.replace" && this.content.relation?.eventId != null
|
private fun ApiTimelineEvent.TimelineMessage.isEdit() = this.content.relation?.relationType == "m.replace" && this.content.relation?.eventId != null
|
||||||
private fun ApiTimelineEvent.TimelineMessage.isReply() = this.content.relation?.inReplyTo != null
|
private fun ApiTimelineEvent.TimelineMessage.isReply() = this.content.relation?.inReplyTo != null
|
||||||
private fun ApiTimelineEvent.TimelineMessage.asTextContent() = this.content as ApiTimelineEvent.TimelineMessage.Content.Text
|
private fun ApiTimelineEvent.TimelineMessage.asTextContent() = this.content as ApiTimelineEvent.TimelineMessage.Content.Text
|
||||||
|
|
|
@ -53,9 +53,19 @@ internal class RoomEventFactory(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.stripTags() = this.substring(this.indexOf("</mx-reply>") + "</mx-reply>".length)
|
|
||||||
|
private fun String.indexOfOrNull(string: String) = this.indexOf(string).takeIf { it != -1 }
|
||||||
|
|
||||||
|
fun String.stripTags() = this
|
||||||
|
.run {
|
||||||
|
this.indexOfOrNull("</mx-reply>")?.let {
|
||||||
|
this.substring(it + "</mx-reply>".length)
|
||||||
|
} ?: this
|
||||||
|
}
|
||||||
.trim()
|
.trim()
|
||||||
.replace("<em>", "")
|
.replace("<em>", "")
|
||||||
.replace("</em>", "")
|
.replace("</em>", "")
|
||||||
|
.replace(""", "\"")
|
||||||
|
.replace("'", "'")
|
||||||
|
|
||||||
private fun ApiTimelineEvent.TimelineMessage.asTextContent() = this.content as ApiTimelineEvent.TimelineMessage.Content.Text
|
private fun ApiTimelineEvent.TimelineMessage.asTextContent() = this.content as ApiTimelineEvent.TimelineMessage.Content.Text
|
||||||
|
|
Loading…
Reference in New Issue