Skip to content

Add message reaction to chat - long press bubble to react emoji#1671

Open
shishupalbhati wants to merge 1 commit intoandroid:mainfrom
shishupalbhati:main
Open

Add message reaction to chat - long press bubble to react emoji#1671
shishupalbhati wants to merge 1 commit intoandroid:mainfrom
shishupalbhati:main

Conversation

@shishupalbhati
Copy link

No description provided.

@google-cla
Copy link

google-cla bot commented Mar 18, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances user interaction in the chat application by introducing a message reaction feature. Users can now express themselves more dynamically by long-pressing on any chat bubble to bring up an emoji picker and add a reaction. The chosen reactions are then visually represented below the message, providing a more engaging and expressive chat experience.

Highlights

  • Message Reactions: Introduced the ability for users to react to chat messages with emojis by long-pressing on a message bubble.
  • Emoji Picker Dialog: Implemented a new EmojiPickerDialog Composable that appears upon long-pressing a message, allowing users to select an emoji reaction.
  • Reaction Display: Added UI components to display selected emoji reactions as 'reaction chips' below the respective chat messages, showing the emoji and its count.
  • State Management: Updated the ConversationUiState and Message data class to store and manage emoji reactions for each message.
  • UI Tests: Included new UI tests to verify the functionality of the emoji picker dialog, long-press gesture, and reaction display.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces message reactions, triggered by a long press on a message bubble. The implementation is mostly solid, with correct state management for reactions and UI for displaying them. However, I've identified a critical bug where the new long-press handling interferes with existing click functionality for links in messages. Additionally, a new UI test is failing due to an incorrect selector. I've provided specific feedback and code suggestions to address these issues.

Comment on lines +506 to +509
modifier = Modifier.combinedClickable(
onLongClick = {showEmojiPicker = true},
onClick = {},
)
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

Using combinedClickable with an empty onClick lambda consumes tap events. This prevents the ClickableText child composable from handling its own click events, such as for opening links or viewing profiles, which breaks existing functionality.

To fix this, you should use Modifier.pointerInput with detectTapGestures, specifying only the onLongPress handler. This will correctly handle the long press for reactions while allowing tap gestures to be processed by child composables.

            modifier = Modifier.pointerInput(Unit) {
                detectTapGestures(onLongPress = {
                    showEmojiPicker = true
                })
            }

)
}
}
composeTestRule.onNodeWithTag("Hello!").performTouchInput { longClick() }
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This test uses onNodeWithTag("Hello!") to find the message composable. However, no testTag with this value is set, which will cause the test to fail.

To correctly find the composable, you should use onNodeWithText("Hello!") instead. The long press gesture will be performed on the correct node and propagate to the parent Surface that handles it.

Suggested change
composeTestRule.onNodeWithTag("Hello!").performTouchInput { longClick() }
composeTestRule.onNodeWithText("Hello!").performTouchInput { longClick() }

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant