Skip to content

Commit

Permalink
[i252] Add isInThread to MessagePositionHandler (#5168)
Browse files Browse the repository at this point in the history
* [i252] Add isInThread to MessagePositionHandler

* [i252] add CHANGELOG
  • Loading branch information
kanat authored Feb 6, 2024
1 parent 3d5b236 commit f3ced32
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
### ✅ Added

### ⚠️ Changed
- 🚨Breaking change: Changed `MessagePositionHandler.handleMessagePosition` signature. [#5168](https://github.com/GetStream/stream-chat-android/pull/5168)
* Added `isInThread: Boolean` parameter.

### ❌ Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,10 @@ public final class io/getstream/chat/android/ui/common/feature/messages/list/Mes

public abstract interface class io/getstream/chat/android/ui/common/feature/messages/list/MessagePositionHandler {
public static final field Companion Lio/getstream/chat/android/ui/common/feature/messages/list/MessagePositionHandler$Companion;
public abstract fun handleMessagePosition (Lio/getstream/chat/android/models/Message;Lio/getstream/chat/android/models/Message;Lio/getstream/chat/android/models/Message;Z)Ljava/util/List;
public abstract fun handleMessagePosition (Lio/getstream/chat/android/models/Message;Lio/getstream/chat/android/models/Message;Lio/getstream/chat/android/models/Message;ZZ)Ljava/util/List;
}

public final class io/getstream/chat/android/ui/common/feature/messages/list/MessagePositionHandler$Companion {
public final fun defaultHandler ()Lio/getstream/chat/android/ui/common/feature/messages/list/MessagePositionHandler;
}

public abstract interface class io/getstream/chat/android/ui/common/helper/ClipboardHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ public class MessageListController(
message = message,
nextMessage = nextMessage,
isAfterDateSeparator = shouldAddDateSeparator,
isInThread = isInThread,
)

val isLastMessageInGroup =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package io.getstream.chat.android.ui.common.feature.messages.list

import io.getstream.chat.android.client.utils.message.isError
import io.getstream.chat.android.client.utils.message.isSystem
import io.getstream.chat.android.core.internal.InternalStreamChatApi
import io.getstream.chat.android.models.Message
import io.getstream.chat.android.ui.common.state.messages.list.MessagePosition

Expand All @@ -32,6 +33,7 @@ public fun interface MessagePositionHandler {
* @param message The current [Message] in the list.
* @param nextMessage The next [Message] in the list.
* @param isAfterDateSeparator If a date separator was added before the current [Message].
* @param isInThread If the current [Message] is in a thread.
*
* @return The position of the current message inside the group.
*/
Expand All @@ -40,6 +42,7 @@ public fun interface MessagePositionHandler {
message: Message,
nextMessage: Message?,
isAfterDateSeparator: Boolean,
isInThread: Boolean,
): List<MessagePosition>

public companion object {
Expand All @@ -49,13 +52,15 @@ public fun interface MessagePositionHandler {
*
* @return The default implementation of [MessagePositionHandler].
*/
@InternalStreamChatApi
@Suppress("ComplexCondition")
public fun defaultHandler(): MessagePositionHandler {
return MessagePositionHandler {
previousMessage: Message?,
message: Message,
nextMessage: Message?,
isAfterDateSeparator: Boolean,
_: Boolean,
->
val previousUser = previousMessage?.user
val user = message.user
Expand Down

0 comments on commit f3ced32

Please sign in to comment.