Skip to content

Remove click lambdas from quoted message parameters#6293

Merged
andremion merged 1 commit intov7from
bug/v7-quoted-message-long-click
Mar 25, 2026
Merged

Remove click lambdas from quoted message parameters#6293
andremion merged 1 commit intov7from
bug/v7-quoted-message-long-click

Conversation

@gpunto
Copy link
Copy Markdown
Contributor

@gpunto gpunto commented Mar 25, 2026

Goal

At the moment, we pass click listeners down to the quoted message component. However, this is a bit problematic because:

  • onLongItemClick is semantically used for the click on the message, not on the quoted message, which basically means we're leaking responsibility that should live in the message component
  • the quoted message component is displayed both in the message and in the composer, and the clicks are relevant only in one case (the composer passes empty lambdas)

So, while on v6 we're fixing the bug as in #6292 to avoid breaking changes, here in v7 we're fixing the problem at the root, so we also address the problems above.

Implementation

  • Remove onLongItemClick and onQuotedMessageClick from the quoted message parameters
  • Lift the click handling responsibility to DefaultMessageContent

🎨 UI Changes

None

Testing

Same steps as in #6292, i.e. the message menu that shows on long clicks should always operate on the quoting message (never on the quoted message).

Summary by CodeRabbit

  • Refactor
    • Reorganized quoted message interaction handling by consolidating click and long-click logic into internal message processing, simplifying the quoted message component interface.

@gpunto gpunto added the pr:breaking-change Breaking change label Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 25, 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.

@gpunto gpunto marked this pull request as ready for review March 25, 2026 14:32
@gpunto gpunto requested a review from a team as a code owner March 25, 2026 14:32
@github-actions
Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.68 MB 0.43 MB 🟡
stream-chat-android-ui-components 10.60 MB 10.98 MB 0.38 MB 🟡
stream-chat-android-compose 12.81 MB 12.08 MB -0.73 MB 🚀

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

Walkthrough

Two click-handling callbacks (onLongItemClick and onQuotedMessageClick) were removed from the QuotedMessage composable and MessageQuotedContentParams data class. Interaction handling was relocated to MessageContent, which now uses a Modifier.combinedClickable approach instead of passing callbacks through component parameters.

Changes

Cohort / File(s) Summary
API Definitions
api/stream-chat-android-compose.api
Updated public API signatures to remove two Function1 callback parameters from QuotedMessage(...) function and MessageQuotedContentParams constructor; removed corresponding getters and component accessors.
Quoted Message Component
src/main/java/io/getstream/chat/android/compose/ui/components/messages/QuotedMessage.kt
Removed onLongItemClick and onQuotedMessageClick parameters from function signature; deleted all combinedClickable gesture handling and related opt-in annotation.
Message Content Component
src/main/java/io/getstream/chat/android/compose/ui/components/messages/MessageContent.kt
Added @OptIn(ExperimentalFoundationApi::class) annotation; implemented click/long-click handling via Modifier.combinedClickable with MutableInteractionSource, replacing callback parameter passing.
Theme & Factory
src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt, src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt
Removed callback parameter propagation from ChatComponentFactory.MessageQuotedContent call; removed onLongItemClick and onQuotedMessageClick properties from MessageQuotedContentParams data class.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 The clicks hop elsewhere now,
From params to the modifier's bow,
Callbacks dance in new terrain,
Where combinedClickable takes the reins—
A simpler quoted message way!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 concisely summarizes the main change: removing callback parameters from the quoted message component's public API.
Description check ✅ Passed The description includes Goal, Implementation, and Testing sections matching the template structure, with clear explanation of the refactoring rationale and testing approach.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/v7-quoted-message-long-click

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

🤖 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`:
- Around line 5629-5636: Add a breaking-change entry to CHANGELOG.md documenting
that the callbacks onLongItemClick and onQuotedMessageClick were removed from
MessageQuotedContentParams, explain that destructuring semantics changed so
component4() now returns Modifier (previous callback positions are gone), and
provide a short migration note showing how to update code that constructs,
copies or destructures MessageQuotedContentParams (e.g., remove or replace
callback usages, adjust destructuring to expect Modifier as the fourth component
and migrate any callback logic to the new consumer APIs). Ensure you reference
the type MessageQuotedContentParams and the affected symbols component4(),
copy(), onLongItemClick, and onQuotedMessageClick in the changelog entry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 32f6683e-4cac-43a8-b315-1069fd4df09d

📥 Commits

Reviewing files that changed from the base of the PR and between 8e10e83 and 1e9b17d.

📒 Files selected for processing (5)
  • stream-chat-android-compose/api/stream-chat-android-compose.api
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/MessageContent.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/QuotedMessage.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt
💤 Files with no reviewable changes (3)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactoryParams.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/QuotedMessage.kt

Comment thread stream-chat-android-compose/api/stream-chat-android-compose.api
@sonarqubecloud
Copy link
Copy Markdown

@andremion andremion merged commit e18ede0 into v7 Mar 25, 2026
16 of 17 checks passed
@andremion andremion deleted the bug/v7-quoted-message-long-click branch March 25, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:breaking-change Breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants