Add composer autocomplete for enhanced mentions in XML SDK#6510
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
SDK Size Comparison 📏
|
WalkthroughThe PR extends ChangesHeterogeneous Mention Suggestions
Sequence Diagram(s)sequenceDiagram
participant User
participant MessageComposerView
participant DefaultMessageComposerMentionSuggestionsContent
participant MentionSuggestionsAdapter
participant MessageComposerViewModel
User->>MessageComposerView: types `@mention` query
MessageComposerView->>MessageComposerViewModel: state.suggestedMentions updated
MessageComposerViewModel-->>MessageComposerView: emits MessageComposerState
MessageComposerView->>DefaultMessageComposerMentionSuggestionsContent: renderState(state)
DefaultMessageComposerMentionSuggestionsContent->>MentionSuggestionsAdapter: setMentions(state.suggestedMentions)
MentionSuggestionsAdapter-->>DefaultMessageComposerMentionSuggestionsContent: renders UserMentionsViewHolder or SpecialMentionsViewHolder
User->>DefaultMessageComposerMentionSuggestionsContent: taps mention row
DefaultMessageComposerMentionSuggestionsContent->>DefaultMessageComposerMentionSuggestionsContent: onMentionSelected(mention)
DefaultMessageComposerMentionSuggestionsContent->>MessageComposerView: suggestedMentionSelectionListener(mention)
MessageComposerView->>MessageComposerViewModel: selectMention(mention)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/viewmodel/messages/MessageComposerViewModelBinding.kt`:
- Around line 114-123: The issue is that both mentionSelectionListener and
suggestedMentionSelectionListener are being bound in the bindMessageComposerView
function (lines 121-122), and this causes Mention.User selections to be
processed twice because the default mention selection handler at line 263 also
calls selectMention. Remove the binding of one of these listeners or refactor
the default handler logic to avoid duplicating the mention selection processing
that is already handled by the bound listeners. The same duplication pattern
also occurs in other similar binding locations referenced in the comment (lines
201-202 and 231-233).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 466c1a77-708d-452a-8245-4d69d9b7d995
📒 Files selected for processing (20)
stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/ui/messages/MessageComposer.ktstream-chat-android-ui-common/src/main/res/drawable/stream_design_ic_users.xmlstream-chat-android-ui-components/api/stream-chat-android-ui-components.apistream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/MessageComposerView.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/content/DefaultMessageComposerLeadingContent.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/content/DefaultMessageComposerMentionSuggestionsContent.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/viewmodel/messages/MessageComposerViewModel.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/viewmodel/messages/MessageComposerViewModelBinder.ktstream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/viewmodel/messages/MessageComposerViewModelBinding.ktstream-chat-android-ui-components/src/main/res/drawable/stream_ui_shape_mention_icon_avatar.xmlstream-chat-android-ui-components/src/main/res/layout/stream_ui_item_mention_special.xmlstream-chat-android-ui-components/src/main/res/values-es/strings.xmlstream-chat-android-ui-components/src/main/res/values-fr/strings.xmlstream-chat-android-ui-components/src/main/res/values-hi/strings.xmlstream-chat-android-ui-components/src/main/res/values-in/strings.xmlstream-chat-android-ui-components/src/main/res/values-it/strings.xmlstream-chat-android-ui-components/src/main/res/values-ja/strings.xmlstream-chat-android-ui-components/src/main/res/values-ko/strings.xmlstream-chat-android-ui-components/src/main/res/values/strings.xmlstream-chat-android-ui-components/src/test/kotlin/io/getstream/chat/android/ui/viewmodels/messages/MessageComposerViewModelTest.kt
21b40b6 to
dcb3e99
Compare
|



Goal
Bring
@channel,@here, role, and user-group composer suggestions to the XML SDK, matching the Compose composer from PR 4.PR 5 in the enhanced-mentions series. Part of AND-1175.
Implementation
List<Mention>instead ofList<User>. Non-user mentions use a newstream_ui_item_mention_specialrow (icon +@name+ subtitle).selectMention(Mention)overload,onSuggestedMentionSelectionbinder method, andsuggestedMentionSelectionListener.mentionSelectionListener/setItems(List<User>)are deprecated but still work for user mentions.UI Changes
Testing
MessageComposerViewModelTest: new cases assert each non-user mention type surfaces correctly.@in the sample composer, confirm channel/here/role/group/user suggestions appear and the picked token survivesSend.Summary by CodeRabbit
Release Notes
New Features
Documentation