diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt index c5f7a6e39d..dc13a359a6 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt @@ -250,31 +250,29 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials val permalink = PermalinkFactory.createPermalink(eventReplied) ?: return null val userId = eventReplied.senderId ?: return null val userLink = PermalinkFactory.createPermalink(userId) ?: return null -// -//
-// In reply to -// @alice:example.org -//
-// -//
-//
-// This is where the reply goes. + // + //
+ // In reply to + // @alice:example.org + //
+ // + //
+ //
+ // This is where the reply goes. val body = bodyForReply(eventReplied.getClearContent().toModel()) - val replyFallbackTemplateFormatted = """ -
- ${stringProvider.getString(R.string.message_reply_to_prefix)} - %s -
- %s -
-
- %s""".trimIndent().format(permalink, userLink, userId, body.second ?: body.first, replyText) -// -// > <@alice:example.org> This is the original body -// -// This is where the reply goes + val replyFallbackTemplateFormatted = REPLY_PATTERN.format( + permalink, + stringProvider.getString(R.string.message_reply_to_prefix), + userLink, + userId, + body.second ?: body.first, + replyText + ) + // + // > <@alice:example.org> This is the original body + // val lines = body.first.split("\n") - val plainTextBody = StringBuffer("><${userId}>") + val plainTextBody = StringBuffer("><$userId>") lines.firstOrNull()?.also { plainTextBody.append(" $it") } lines.forEachIndexed { index, s -> if (index > 0) { @@ -365,6 +363,9 @@ internal class LocalEchoEventFactory @Inject constructor(private val credentials companion object { const val LOCAL_ID_PREFIX = "local." + // No whitespace + const val REPLY_PATTERN = """
%s%s
%s
%s""" + fun isLocalEchoId(eventId: String): Boolean = eventId.startsWith(LOCAL_ID_PREFIX) } }