This commit is contained in:
Diogo
2024-09-20 18:10:59 +01:00
parent e03d344397
commit 63c28c64d1
2 changed files with 5 additions and 5 deletions
@@ -2335,10 +2335,6 @@ sealed class CIDirection {
is LocalSnd -> true
is LocalRcv -> false
}
fun sameDirection(dir: CIDirection): Boolean {
return if (dir is GroupRcv && this is GroupRcv) this.groupMember.groupMemberId == dir.groupMember.groupMemberId else this.sent == dir.sent
}
}
@Serializable
@@ -24,6 +24,7 @@ import androidx.compose.ui.text.*
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.*
import chat.simplex.common.model.*
import chat.simplex.common.model.CIDirection.GroupRcv
import chat.simplex.common.model.ChatController.appPrefs
import chat.simplex.common.model.ChatModel.controller
import chat.simplex.common.model.ChatModel.withChats
@@ -1906,7 +1907,10 @@ private fun getItemSeparation(chatItem: ChatItem, nextItem: ChatItem?): ItemSepa
)
}
val largeGap = !chatItem.chatDir.sameDirection(nextItem.chatDir) || (abs(nextItem.meta.createdAt.epochSeconds - chatItem.meta.createdAt.epochSeconds) >= 60)
val sameMemberAndDirection = if (nextItem.chatDir is GroupRcv && chatItem.chatDir is GroupRcv) {
chatItem.chatDir.groupMember.groupMemberId == nextItem.chatDir.groupMember.groupMemberId
} else chatItem.chatDir.sent == nextItem.chatDir.sent
val largeGap = !sameMemberAndDirection || (abs(nextItem.meta.createdAt.epochSeconds - chatItem.meta.createdAt.epochSeconds) >= 60)
return ItemSeparation(
timestamp = largeGap || chatItem.meta.timestampText != nextItem.meta.timestampText,