forked from GitHub-Mirror/riotX-android
Fix actually done TODO
This commit is contained in:
parent
1918302297
commit
e5082f662c
@ -98,24 +98,27 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials
|
|||||||
newBodyAutoMarkdown: Boolean,
|
newBodyAutoMarkdown: Boolean,
|
||||||
msgType: String,
|
msgType: String,
|
||||||
compatibilityText: String): Event {
|
compatibilityText: String): Event {
|
||||||
// TODO Format newBodyText
|
val newContent = if (newBodyAutoMarkdown) {
|
||||||
var newContent = MessageTextContent(
|
|
||||||
type = MessageType.MSGTYPE_TEXT,
|
|
||||||
body = newBodyText
|
|
||||||
)
|
|
||||||
if (newBodyAutoMarkdown) {
|
|
||||||
val parser = Parser.builder().build()
|
|
||||||
val document = parser.parse(newBodyText)
|
val document = parser.parse(newBodyText)
|
||||||
val renderer = HtmlRenderer.builder().build()
|
|
||||||
val htmlText = renderer.render(document)
|
val htmlText = renderer.render(document)
|
||||||
if (isFormattedTextPertinent(newBodyText, htmlText)) {
|
if (isFormattedTextPertinent(newBodyText, htmlText)) {
|
||||||
newContent = MessageTextContent(
|
MessageTextContent(
|
||||||
type = MessageType.MSGTYPE_TEXT,
|
type = MessageType.MSGTYPE_TEXT,
|
||||||
format = MessageType.FORMAT_MATRIX_HTML,
|
format = MessageType.FORMAT_MATRIX_HTML,
|
||||||
body = newBodyText,
|
body = newBodyText,
|
||||||
formattedBody = htmlText
|
formattedBody = htmlText
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
MessageTextContent(
|
||||||
|
type = MessageType.MSGTYPE_TEXT,
|
||||||
|
body = newBodyText
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MessageTextContent(
|
||||||
|
type = MessageType.MSGTYPE_TEXT,
|
||||||
|
body = newBodyText
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val content = MessageTextContent(
|
val content = MessageTextContent(
|
||||||
|
Loading…
Reference in New Issue
Block a user