diff --git a/apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger/internal/ChatViewModel.kt b/apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger/internal/ChatViewModel.kt index 050bba10f..9d2267e40 100644 --- a/apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger/internal/ChatViewModel.kt +++ b/apps/flipcash/features/messenger/src/main/kotlin/com/flipcash/app/messenger/internal/ChatViewModel.kt @@ -161,7 +161,7 @@ internal class ChatViewModel @Inject constructor( data class ChatDeactivated(val isReadOnly: Boolean) : Event } - private val separatorConfig = SeparatorConfig.TimeGap() + private val separatorConfig = SeparatorConfig.Continuous() @OptIn(ExperimentalCoroutinesApi::class) private val messageStream = stateFlow.mapNotNull { it.chatId } diff --git a/apps/flipcash/shared/chat-ui/src/main/kotlin/com/flipcash/shared/chat/ui/SeparatorConfig.kt b/apps/flipcash/shared/chat-ui/src/main/kotlin/com/flipcash/shared/chat/ui/SeparatorConfig.kt index 7406b0c18..d8a2a263e 100644 --- a/apps/flipcash/shared/chat-ui/src/main/kotlin/com/flipcash/shared/chat/ui/SeparatorConfig.kt +++ b/apps/flipcash/shared/chat-ui/src/main/kotlin/com/flipcash/shared/chat/ui/SeparatorConfig.kt @@ -27,4 +27,14 @@ sealed interface SeparatorConfig { before.toLocalDate() != after.toLocalDate() || (before - after).absoluteValue > gap } + + data class Continuous( + val gap: Duration = 3.hours, + ) : SeparatorConfig { + override val groupingWindow: Duration = Duration.INFINITE + override fun shouldSeparate(before: Instant, after: Instant): Boolean = + before.toLocalDate() != after.toLocalDate() + || (before - after).absoluteValue > gap + override fun isGrouped(a: Instant, b: Instant): Boolean = true + } }