mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Fix message grouping
This commit is contained in:
@@ -26,9 +26,9 @@ object BubbleUtils {
|
||||
|
||||
const val TIMESTAMP_THRESHOLD = 10
|
||||
|
||||
// TODO: update to consider emoji reactions
|
||||
fun canGroup(message: Message, other: Message?): Boolean {
|
||||
if (other == null) return false
|
||||
if (message.emojiReactions.isNotEmpty() || other.emojiReactions.isNotEmpty()) return false
|
||||
val diff = TimeUnit.MILLISECONDS.toMinutes(Math.abs(message.date - other.date))
|
||||
return message.compareSender(other) && diff < TIMESTAMP_THRESHOLD
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ import dev.octoshrimpy.quik.feature.compose.BubbleUtils.getBubble
|
||||
import dev.octoshrimpy.quik.feature.compose.part.PartsAdapter
|
||||
import dev.octoshrimpy.quik.feature.extensions.isEmojiOnly
|
||||
import dev.octoshrimpy.quik.model.Conversation
|
||||
import dev.octoshrimpy.quik.model.EmojiReaction
|
||||
import dev.octoshrimpy.quik.model.Message
|
||||
import dev.octoshrimpy.quik.model.Recipient
|
||||
import dev.octoshrimpy.quik.util.PhoneNumberUtils
|
||||
@@ -72,7 +71,6 @@ import dev.octoshrimpy.quik.util.Preferences
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmResults
|
||||
import kotlinx.android.synthetic.main.message_list_item_in.*
|
||||
import kotlinx.android.synthetic.main.message_list_item_in.body
|
||||
@@ -399,7 +397,7 @@ class MessagesAdapter @Inject constructor(
|
||||
|
||||
private fun bindEmojiReactions(holder: QkViewHolder, message: Message) {
|
||||
holder.reactions?.let { reactionsContainer ->
|
||||
val reactions = getReactionsForMessage(message.id)
|
||||
val reactions = message.emojiReactions
|
||||
val hasReactions = reactions.isNotEmpty()
|
||||
|
||||
if (hasReactions) {
|
||||
@@ -438,15 +436,6 @@ class MessagesAdapter @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun getReactionsForMessage(messageId: Long): List<EmojiReaction> {
|
||||
return Realm.getDefaultInstance().use { realm ->
|
||||
realm.where(EmojiReaction::class.java)
|
||||
.equalTo("targetMessageId", messageId)
|
||||
.findAll()
|
||||
.let { realm.copyFromRealm(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun bindStatus(
|
||||
holder: QkViewHolder,
|
||||
bodyTextTruncated: Boolean,
|
||||
|
||||
Reference in New Issue
Block a user