From 228ee52563d8eeaecfb327ee595d8e3959b17509 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 10 Jul 2019 10:07:45 +0200 Subject: [PATCH] Remove extra space in --- .../room/send/LocalEchoEventFactory.kt | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) 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) } }