Render enhanced mentions in incoming messages#6501
Draft
gpunto wants to merge 1 commit into
Draft
Conversation
Introduces the `Mention` sealed type and `MentionRegex` in `ui-common` as shared primitives, then wires both SDKs to highlight `@channel`, `@here`, role, and group tokens alongside user mentions when a message arrives with the matching fields populated. Compose: `TextUtils` adds per-type annotation tags and `StreamDesign` per-type color tokens (`chatTextMention*`/ `chatBgMention*`); `MessageText`/`MessageContent`/ `MessageContainer`/`MessageItem`/`MessageList` plumb a typed `onMentionClick: (Mention) -> Unit` callback. ui-components: `Linkify`/`MentionSpan`/`TextViewLinkHandler`/ `LongClickFriendlyLinkMovementMethod` are rewritten to span every mention type and dispatch through a new `MessageListView.OnMentionTokenClickListener` (the legacy user-only `OnMentionClickListener` stays in place, deprecated).
Contributor
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
|
Contributor
SDK Size Comparison 📏
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Render
@channel,@here, role, and user-group tokens in incoming messages so users see them styled and clickable, like user mentions. No composer autocomplete yet.This is PR 3 in the enhanced-mentions series.
Part of AND-1175
Implementation
ui-common:Mentionsealed interface gainsChannel,Here,Role,Groupcases; newmentionRegex(display)helper uses Unicode-aware boundaries so non-ASCII display names match correctly.TextUtilsspans every mention type with a per-type annotation tag;StreamDesignexposeschatTextMention*/chatBgMention*color tokens;MessageText/MessageContent/MessageContainer/MessageItem/MessageListplumbonMentionClick: (Mention) -> Unit.Linkify,MentionSpan(renamed fromUserSpan),TextViewLinkHandler, andLongClickFriendlyLinkMovementMethodnow span every mention type and dispatch through a newMessageListView.OnMentionTokenClickListener. The legacy user-onlyOnMentionClickListenerstays in place and is deprecated.UI Changes
Testing
MentionRegexTestcovers Unicode boundaries, escape behavior, and the start/end-of-string cases.TextUtilsKtTestandMessageTextHelpersTestassert that each mention type produces the right annotation/span.stream-chat-android-compose,stream-chat-android-ui-common, andstream-chat-android-ui-components.