Skip to content

Render enhanced mentions in incoming messages#6501

Draft
gpunto wants to merge 1 commit into
developfrom
pr3-enhanced-mentions-render
Draft

Render enhanced mentions in incoming messages#6501
gpunto wants to merge 1 commit into
developfrom
pr3-enhanced-mentions-render

Conversation

@gpunto

@gpunto gpunto commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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: Mention sealed interface gains Channel, Here, Role, Group cases; new mentionRegex(display) helper uses Unicode-aware boundaries so non-ASCII display names match correctly.
  • Compose: TextUtils spans every mention type with a per-type annotation tag; StreamDesign exposes chatTextMention* / chatBgMention* color tokens; MessageText / MessageContent / MessageContainer / MessageItem / MessageList plumb onMentionClick: (Mention) -> Unit.
  • ui-components: Linkify, MentionSpan (renamed from UserSpan), TextViewLinkHandler, and LongClickFriendlyLinkMovementMethod now span every mention type and dispatch through a new MessageListView.OnMentionTokenClickListener. The legacy user-only OnMentionClickListener stays in place and is deprecated.

UI Changes

Before After

Testing

  • MentionRegexTest covers Unicode boundaries, escape behavior, and the start/end-of-string cases.
  • TextUtilsKtTest and MessageTextHelpersTest assert that each mention type produces the right annotation/span.
  • API dump regenerated for stream-chat-android-compose, stream-chat-android-ui-common, and stream-chat-android-ui-components.

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).
@gpunto gpunto added the pr:new-feature New feature label Jun 12, 2026
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@gpunto gpunto added pr:new-feature New feature and removed pr:new-feature New feature labels Jun 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.90 MB 5.90 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.13 MB 11.13 MB 0.00 MB 🟢
stream-chat-android-compose 12.57 MB 12.57 MB 0.01 MB 🟢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:new-feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant