You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on the message redesign, I noticed we could simplify the logic of MessagePositionHandler & related code
🛠 Implementation details
Changed output from List<MessagePosition> to MessagePosition since a message can't be simultaneously in multiple positions and we were always using one position from the list anyway
Refactor the logic of the default handler to be easier to understand
🎨 UI Changes
None
🧪 Testing
The message position affects the styling, so you should see no styling differences in the sample as this PR doesn't change behavior
Summary by CodeRabbit
Refactor
Streamlined message position handling to use single values instead of lists for improved code clarity.
Updated message styling to use explicit theme parameters for consistent bubble rendering.
Consolidated message rendering logic across components for better maintainability.
✏️ Tip: You can customize this high-level summary in your review settings.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
This PR refactors message position handling from a list to a single enum value and updates message bubble styling APIs to accept explicit theme parameters instead of inferring them from message ownership. The groupPosition property type changes from List<MessagePosition> to MessagePosition, with cascading updates across handlers, state classes, tests, and UI components.
Changes
Cohort / File(s)
Summary
Message Bubble Theming API Updates stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/MessageBubble.kt
Changed getMessageBubbleColor signature to accept explicit MessageTheme parameter instead of deriving from message ownership; removes InternalStreamChatApi dependency.
Message Position Logic Simplification stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt, stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListController.kt, stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessagePositionHandler.kt
Replaced list-based position containment checks with direct single-value enum matching; handleMessagePosition now returns MessagePosition instead of List<MessagePosition>.
Message Item State Type Refactoring stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/state/messages/list/MessageListItemState.kt, stream-chat-android-ui-common/api/stream-chat-android-ui-common.api
Changed MessageItemState.groupPosition from List<MessagePosition> to MessagePosition with default MessagePosition.NONE; updates constructors, copy methods, and getters accordingly.
Updated getMessageBubbleShape and getMessageBubbleColor calls to pass MessageTheme parameter; refactored shape selection logic to use direct theme mapping instead of ownership-based branching.
Test Updates stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/messages/MessageListTest.kt, stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessageListControllerTests.kt, stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/list/MessagePositionHandlerTest.kt
Adjusted assertions to expect single MessagePosition values instead of lists; updated expected types in grouping and position handler tests.
Wraps single groupPosition value in listOf() when constructing MessageListItem.MessageItem to maintain list-based downstream API.
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Update design of quoted message #6084 — Refactors MessageTheme API surface (removing quoted-related fields), directly related to theme parameter changes in message bubble functions.
🐰 A single position hops so true, No lists to confuse the message queue, Themes now guide the bubble's art, Ownership deferred, simplicity's heart! Chirp chirp—the refactoring's complete! 🌟
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name
Status
Explanation
Title check
✅ Passed
The title accurately summarizes the main change: simplifying MessagePositionHandler logic and API by converting from List to single MessagePosition.
Description check
✅ Passed
The description covers Goal and Implementation details clearly, but lacks Testing details and UI Changes are marked as None without explanation. Most critical sections are present.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
While working on the message redesign, I noticed we could simplify the logic of
MessagePositionHandler& related code🛠 Implementation details
List<MessagePosition>toMessagePositionsince a message can't be simultaneously in multiple positions and we were always using one position from the list anyway🎨 UI Changes
None
🧪 Testing
The message position affects the styling, so you should see no styling differences in the sample as this PR doesn't change behavior
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.