Skip to content

Scale online indicator dynamically for large avatars#6219

Merged
aleksandar-apostolov merged 6 commits into
v7from
fix/info-screen-online-indicator
Mar 6, 2026
Merged

Scale online indicator dynamically for large avatars#6219
aleksandar-apostolov merged 6 commits into
v7from
fix/info-screen-online-indicator

Conversation

@aleksandar-apostolov
Copy link
Copy Markdown
Contributor

@aleksandar-apostolov aleksandar-apostolov commented Mar 6, 2026

Goal

Fix the online indicator appearing too small on the 96dp avatar in the channel info screen. The indicator dimensions were designed for avatars up to 64dp.

Implementation

  • Convert OnlineIndicatorDimensions from enum to data class to support dynamic values
  • Scale indicator size proportionally for avatars larger than AvatarSize.ExtraExtraLarge (64dp), following the same dynamic scaling pattern used by resolveStackedAvatarDimensions()
  • 96dp avatar now gets a 24dp indicator (1.5x scale) instead of the fixed 16dp

🎨 UI Changes

Online indicator on the direct channel info screen avatar is now proportionally sized.

Testing

  • Open a direct channel info screen with an online user
  • Verify the green indicator on the 96dp avatar is proportionally sized

Summary by CodeRabbit

  • New Features

    • Avatar online indicators now scale proportionally based on avatar size for larger avatars.
    • Channel avatar click handlers now provide channel context to the click callback.
  • Documentation

    • Updated examples and usage patterns for message header components.

…lick

Channel info screen was triggered by tapping the header title.
Redesign feedback requires it on the top-right element (channel avatar).

- Change onChannelAvatarClick type from (() -> Unit)? to ((Channel) -> Unit)?
- Update sample to use onChannelAvatarClick instead of onHeaderTitleClick
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

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.

🎉 Great job! This PR is ready for review.

The 96dp avatar in channel info screens used ExtraLarge indicator
dimensions (designed for 64dp), making the dot proportionally small.

- Convert OnlineIndicatorDimensions from enum to data class
- Scale indicator size proportionally for avatars > 64dp
- 96dp avatar now gets 24dp indicator (1.5x scale) instead of 16dp
@aleksandar-apostolov aleksandar-apostolov force-pushed the fix/info-screen-online-indicator branch from 953199d to a41414f Compare March 6, 2026 13:23
@aleksandar-apostolov aleksandar-apostolov changed the title fix(compose): scale online indicator dynamically for large avatars Scale online indicator dynamically for large avatars Mar 6, 2026
@aleksandar-apostolov aleksandar-apostolov marked this pull request as ready for review March 6, 2026 13:25
@aleksandar-apostolov aleksandar-apostolov requested a review from a team as a code owner March 6, 2026 13:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.69 MB 0.44 MB 🟡
stream-chat-android-ui-components 10.60 MB 11.00 MB 0.40 MB 🟡
stream-chat-android-compose 12.81 MB 12.03 MB -0.78 MB 🚀

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 6, 2026

Walkthrough

The PR updates avatar click callback signatures across compose messaging components to pass the Channel object to handlers instead of parameterless callbacks. Additionally, OnlineIndicatorDimensions is restructured from an enum to a data class with companion object instances, and proportional scaling logic is added for online indicators in extra-large avatars.

Changes

Cohort / File(s) Summary
Avatar Click Callback Signature Updates
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt, stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/header/MessageListHeader.kt, stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt
Changed onChannelAvatarClick and onClick parameters from (() -> Unit)? to ((Channel) -> Unit)?, enabling handlers to receive the Channel object. Updated implementations to pass channel to callbacks.
Avatar Click Handler Delegation
stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
Redirected openChannelInfo handler from onHeaderTitleClick to onChannelAvatarClick parameter in MessagesScreen call.
Online Indicator Dimensions Restructuring
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/OnlineIndicator.kt
Converted OnlineIndicatorDimensions from internal enum class to internal data class with companion object exposing four predefined instances (Small, Medium, Large, ExtraLarge).
Avatar Sizing Logic Enhancement
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/UserAvatar.kt
Added conditional branch in resolveIndicatorDimensions to proportionally scale online indicator size when avatar width exceeds AvatarSize.ExtraExtraLarge.
Public API Signatures
stream-chat-android-compose/api/stream-chat-android-compose.api
Updated API signatures for MessagesScreen, MessageListHeader, MessageListHeaderTrailingContent, and ChatComponentFactory to reflect callback parameter type changes and function arity adjustments.
Documentation Example
stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/messages/MessageListHeader.kt
Updated MessageListHeader example to show new callback signature with channel parameter.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • VelikovPetar
  • andremion
  • gpunto

Poem

🐰 A rabbit hops through avatar clicks with glee,
Now channels pass through, wild and free!
From enum to data class, dimensions align,
Extra-large avatars scale just fine!
Click handlers dance with Channel in tow,
Our compose library's ready to go! 🎭✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% 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 reflects the main change: scaling the online indicator dynamically for large avatars. This is the primary feature implementation described in the PR objectives.
Description check ✅ Passed The description covers the required sections from the template: Goal clearly states the problem, Implementation describes the changes, UI Changes acknowledges the visual update, and Testing provides steps. However, it's missing the contributor/reviewer checklists and UI comparison screenshots/videos.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/info-screen-online-indicator

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt (1)

122-145: ⚠️ Potential issue | 🟠 Major

Allow callers to remove the title click target.

MessageListHeader only drops click semantics when onHeaderTitleClick == null, but MessagesScreen and DefaultTopBarContent still require a non-null lambda and default it to {}. After moving channel-info navigation to the avatar, this leaves the title as a dead clickable element. Make this callback nullable through this chain, and mirror that in ChatComponentFactory.MessageListHeader, so avatar-only screens can render a truly non-interactive title.

Based on learnings, "In GetStream/stream-chat-android, PRs against major version branches (e.g., v7) are allowed to introduce breaking public API changes."

Also applies to: 301-324

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt`
around lines 122 - 145, MessagesScreen currently forces a non-null
onHeaderTitleClick by defaulting it to an empty lambda which prevents
MessageListHeader from being non-clickable; change the onHeaderTitleClick
parameter in MessagesScreen to be nullable (onHeaderTitleClick: ((channel:
Channel) -> Unit)? = null), propagate that nullable type into
DefaultTopBarContent's parameter and invocation (pass null through), and update
DefaultTopBarContent and any usages to accept a nullable lambda; then update
ChatComponentFactory.MessageListHeader's API to accept a nullable
onHeaderTitleClick and ensure MessageListHeader checks for null before adding
click semantics so screens wanting an inert title can pass null. Ensure all call
sites and defaults are adjusted accordingly.
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt (1)

682-703: ⚠️ Potential issue | 🟡 Minor

Add changelog entry for MessageListHeader and MessageListHeaderTrailingContent callback signature changes.

The ChatComponentFactory extension points for MessageListHeader and MessageListHeaderTrailingContent now require callbacks with (Channel) -> Unit signatures, breaking custom implementations. This change must be documented in CHANGELOG.md under the stream-chat-android-compose section with a breaking change marker (🚨) explaining the signature updates and migration path for SDK consumers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt`
around lines 682 - 703, Add a breaking change entry to CHANGELOG.md under the
stream-chat-android-compose section documenting that the ChatComponentFactory
extension points MessageListHeader and MessageListHeaderTrailingContent now
require callbacks with the signature (Channel) -> Unit; include the 🚨 marker, a
short description of the change (old vs new signature), and a migration note
telling consumers to update their custom implementations to accept a Channel
parameter (e.g., change handlers passed into MessageListHeader and
MessageListHeaderTrailingContent to (channel: Channel) -> Unit) and any sample
before/after usage to make the migration clear.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@stream-chat-android-compose/api/stream-chat-android-compose.api`:
- Line 2079: Add an explicit "🚨 Breaking change:" entry to the v7 migration
notes / CHANGELOG stating that MessageListHeader's onChannelAvatarClick callback
signature changed from (() -> Unit)? to ((Channel) -> Unit)?; mention the
impacted public API (MessageListHeader and any callers like MessagesScreen that
accept the callback) and give a short migration example (replace parameterless
lambdas with a lambda that accepts a Channel and uses it) so consumers know to
update usages accordingly.

---

Outside diff comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt`:
- Around line 122-145: MessagesScreen currently forces a non-null
onHeaderTitleClick by defaulting it to an empty lambda which prevents
MessageListHeader from being non-clickable; change the onHeaderTitleClick
parameter in MessagesScreen to be nullable (onHeaderTitleClick: ((channel:
Channel) -> Unit)? = null), propagate that nullable type into
DefaultTopBarContent's parameter and invocation (pass null through), and update
DefaultTopBarContent and any usages to accept a nullable lambda; then update
ChatComponentFactory.MessageListHeader's API to accept a nullable
onHeaderTitleClick and ensure MessageListHeader checks for null before adding
click semantics so screens wanting an inert title can pass null. Ensure all call
sites and defaults are adjusted accordingly.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt`:
- Around line 682-703: Add a breaking change entry to CHANGELOG.md under the
stream-chat-android-compose section documenting that the ChatComponentFactory
extension points MessageListHeader and MessageListHeaderTrailingContent now
require callbacks with the signature (Channel) -> Unit; include the 🚨 marker, a
short description of the change (old vs new signature), and a migration note
telling consumers to update their custom implementations to accept a Channel
parameter (e.g., change handlers passed into MessageListHeader and
MessageListHeaderTrailingContent to (channel: Channel) -> Unit) and any sample
before/after usage to make the migration clear.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6af81665-c313-4856-9134-ce9336cea2d0

📥 Commits

Reviewing files that changed from the base of the PR and between 08902a4 and a41414f.

📒 Files selected for processing (8)
  • stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
  • stream-chat-android-compose/api/stream-chat-android-compose.api
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/OnlineIndicator.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/UserAvatar.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/header/MessageListHeader.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt
  • stream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/messages/MessageListHeader.kt

Comment thread stream-chat-android-compose/api/stream-chat-android-compose.api
HideChannel is no longer in group channel options, so the state doesn't
change after hide/unhide actions. Remove the second awaitItem() calls
that now time out.
@aleksandar-apostolov aleksandar-apostolov enabled auto-merge (squash) March 6, 2026 14:36
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 6, 2026

@aleksandar-apostolov aleksandar-apostolov enabled auto-merge (squash) March 6, 2026 14:53
@aleksandar-apostolov aleksandar-apostolov merged commit dd111d5 into v7 Mar 6, 2026
14 of 15 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the fix/info-screen-online-indicator branch March 6, 2026 19:15
@stream-public-bot
Copy link
Copy Markdown
Contributor

🚀 Available in v7.0.0-beta

@stream-public-bot stream-public-bot added the released Included in a release label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:breaking-change Breaking change pr:improvement Improvement released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants