mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 18:43:49 +00:00
fix: copy message fixed for single messages
This commit is contained in:
parent
792dc2752c
commit
77f02a5917
@ -1338,12 +1338,21 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
|
||||
override fun copyMessages(messages: Set<MessageRecord>) {
|
||||
val sortedMessages = messages.sortedBy { it.dateSent }
|
||||
val messageSize = sortedMessages.size
|
||||
val builder = StringBuilder()
|
||||
for (message in sortedMessages) {
|
||||
val messageIterator = sortedMessages.iterator()
|
||||
while (messageIterator.hasNext()) {
|
||||
val message = messageIterator.next()
|
||||
val body = MentionUtilities.highlightMentions(message.body, threadID, this)
|
||||
if (TextUtils.isEmpty(body)) { continue }
|
||||
if (messageSize > 1) {
|
||||
val formattedTimestamp = DateUtils.getDisplayFormattedTimeSpanString(this, Locale.getDefault(), message.timestamp)
|
||||
builder.append("$formattedTimestamp: $body").append('\n')
|
||||
builder.append("$formattedTimestamp: ")
|
||||
}
|
||||
builder.append(body)
|
||||
if (messageIterator.hasNext()) {
|
||||
builder.append('\n')
|
||||
}
|
||||
}
|
||||
if (builder.isNotEmpty() && builder[builder.length - 1] == '\n') {
|
||||
builder.deleteCharAt(builder.length - 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user