File tree Expand file tree Collapse file tree
features/messenger/src/main/kotlin/com/flipcash/app/messenger/internal
shared/chat-ui/src/main/kotlin/com/flipcash/shared/chat/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ internal class ChatViewModel @Inject constructor(
161161 data class ChatDeactivated (val isReadOnly : Boolean ) : Event
162162 }
163163
164- private val separatorConfig = SeparatorConfig .TimeGap ()
164+ private val separatorConfig = SeparatorConfig .Continuous ()
165165
166166 @OptIn(ExperimentalCoroutinesApi ::class )
167167 private val messageStream = stateFlow.mapNotNull { it.chatId }
Original file line number Diff line number Diff line change @@ -27,4 +27,14 @@ sealed interface SeparatorConfig {
2727 before.toLocalDate() != after.toLocalDate()
2828 || (before - after).absoluteValue > gap
2929 }
30+
31+ data class Continuous (
32+ val gap : Duration = 3 .hours,
33+ ) : SeparatorConfig {
34+ override val groupingWindow: Duration = Duration .INFINITE
35+ override fun shouldSeparate (before : Instant , after : Instant ): Boolean =
36+ before.toLocalDate() != after.toLocalDate()
37+ || (before - after).absoluteValue > gap
38+ override fun isGrouped (a : Instant , b : Instant ): Boolean = true
39+ }
3040}
You can’t perform that action at this time.
0 commit comments