-
Notifications
You must be signed in to change notification settings - Fork 305
Highlight mentions in MessageComposer (Compose) #5984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight mentions in MessageComposer (Compose) #5984
Conversation
SDK Size Comparison 📏
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds mention highlighting support to the MessageComposer input field in the Compose UI. The feature is disabled by default for backwards compatibility and includes support for custom mentions (visual only, not submitted to backend).
Key changes:
- Introduces
MentionandMentionTypeclasses for building custom mentions - Adds
MentionStyleFactoryinterface for customizing mention appearance - Separates text formatting logic into
buildAnnotatedMessageText(for message bubbles) andbuildAnnotatedInputText(for input fields)
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Mention.kt | Defines MentionType and Mention interface with default Mention.User implementation |
| MessageComposerController.kt | Updates mention selection logic to support both user and custom mentions |
| MessageComposerState.kt | Adds selectedMentions field to track mentions in composer state |
| TextUtils.kt | Splits annotation logic into separate functions for message bubbles and input fields |
| MessageComposerTheme.kt | Adds MentionStyleFactory interface and integrates it into ComposerInputFieldTheme |
| MessageInput.kt | Implements visual transformation to apply mention styling in the composer |
| InputField.kt | Extracts default visual transformation logic and adds customization support |
| PollOptionInput.kt | Updates to use buildAnnotatedInputText instead of buildAnnotatedMessageText |
| MessageComposerViewModel.kt | Adds overload for selectMention accepting Mention parameter |
| CustomMentionStyleFactory.kt | Sample implementation showing how to customize mention colors |
| MessagesActivity.kt | Demonstrates integration of custom mention styling in the sample app |
| Test files | Adds comprehensive tests for mention functionality |
| API files | Documents public API changes for mention support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...am-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/TextUtils.kt
Show resolved
Hide resolved
...am-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/TextUtils.kt
Outdated
Show resolved
Hide resolved
...am-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/TextUtils.kt
Show resolved
Hide resolved
…poser # Conflicts: # CHANGELOG.md
|


🎯 Goal
MessageComposerinput field. For backwards compatibility, this is disabled by default.Usage
To customise the appearance of the mentions in the
MessageComposer:To select a custom mention:
🛠 Implementation details
MentionTypeandMentionclasses -> used to build custom mentions. Also defines the defaultMessageComposerViewModel.selectMention(mention: Mention)to allow selecting custom mentionsMentionStyleFactoryto allow customisation of the appearance in theMessageComposerbuildAnnotatedMessageTextinto:buildAnnotatedMessageTextandbuildAnnotatedInputText- one for formatting message text (in bubble), and one for formatting input texts.🎨 UI Changes
Sample only
🧪 Testing
Default user mentions in sample:
@in composerCustom mentions:
@in composer#channelmention optionProvide the patch summary here