Skip to content

Conversation

andremion
Copy link
Contributor

@andremion andremion commented Oct 15, 2025

🎯 Goal

Introduce the "Delete message for me" feature to the LLC, allowing users to delete messages only from their own view while keeping them visible to other users.

🛠 Implementation details

  • Added a new deletedForMe field to the Message model, corresponding database entity, and MessageDeletedEvent, along with introducing ChatClient.deleteMessageForMe function.
  • Added XML and Compose sample implementations.

🎨 UI Changes

Note

Demo apps only. No UI is included in the SDK for this feature.

XML Compose
Screen.Recording.2025-10-16.at.16.38.03.mov
Screen.Recording.2025-10-16.at.16.35.50.mov

🧪 Testing

Using both XML and Compose demo apps:

  • Open a channel.
  • Long-press any current user message.
  • Click on the "Delete Message for Me" option.
  • It should show "Message deleted" and show the "Deleted only for me" label.
  • It should not delete the message for the other chat members.

For different visibilities when a message is deleted, you can change deletedMessageVisibility:

DeletedMessageVisibility.ALWAYS_VISIBLE:

  • It should show the "Message deleted" for all the members when a message is deleted.
  • It should show the "Message deleted" + "Deleted only for me" label for the current user only.

DeletedMessageVisibility.ALWAYS_HIDDEN:

  • It should not show the "Message deleted" nor "Deleted only for me" when a message is either deleted or deleted for the current user only.

DeletedMessageVisibility.VISIBLE_FOR_CURRENT_USER:

  • It should not show the "Message deleted" for all the members when a message is deleted.
  • It should show the "Message deleted" + "Deleted only for me" label for the current user only.

Changing deletedMessageVisibility:

Compose

Update MessagesActivity.factory to change the deletedMessageVisibility

XML

Update ChatFragment.initMessageListViewModel to setDeletedMessageVisibility

Important

Test in both online and offline modes

Copy link
Contributor

DB Entities have been updated. Do we need to upgrade DB Version?
Modified Entities :

stream-chat-android-offline/src/main/java/io/getstream/chat/android/offline/repository/domain/message/internal/MessageEntity.kt

Copy link
Contributor

github-actions bot commented Oct 15, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.22 MB 3.22 MB 0.00 MB 🟢
stream-chat-android-offline 3.45 MB 3.45 MB 0.01 MB 🟢
stream-chat-android-ui-components 10.54 MB 10.54 MB 0.00 MB 🟢
stream-chat-android-compose 12.76 MB 12.76 MB 0.00 MB 🟢

@andremion andremion force-pushed the AND-768-delete-message-for-me branch 2 times, most recently from 286f863 to c74fd57 Compare October 15, 2025 14:03
@andremion andremion requested a review from Copilot October 15, 2025 14:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the "Delete message for me" feature, allowing users to delete messages only from their own view while keeping them visible to other users. The feature adds a new deletedForMe field to the Message model and corresponding database entity, along with API support for the delete-for-me operation.

Key changes include:

  • Added deletedForMe Boolean field to the Message model and database entity
  • Implemented API endpoint for delete-for-me functionality with new query parameter
  • Updated UI components to handle and display delete-for-me state
  • Added sample implementation with custom component factory

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Message.kt Added deletedForMe field to core Message model
MessageEntity.kt Added deletedForMe field to database entity
MessageMapper.kt Updated mapping between entity and domain model
ChatDatabase.kt Incremented database version for schema change
MessageApi.kt Added deleteForMe query parameter to delete endpoint
ChatClient.kt Added deleteMessageForMe method
DeleteMessageForMeComponentFactory.kt Sample UI component for delete-for-me functionality
Various test files Updated tests to support new delete-for-me parameter

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@andremion andremion force-pushed the AND-768-delete-message-for-me branch from fc493df to 4005f7c Compare October 16, 2025 09:52
@andremion andremion added the core label Oct 16, 2025
@andremion andremion force-pushed the AND-768-delete-message-for-me branch 3 times, most recently from e04af76 to ecda885 Compare October 16, 2025 14:21
@andremion andremion marked this pull request as ready for review October 16, 2025 14:21
@andremion andremion requested a review from a team as a code owner October 16, 2025 14:21
@aleksandar-apostolov aleksandar-apostolov changed the title Delete message for me Allow users to delete messages only for themselves (Delete message for me - feature) Oct 17, 2025
@andremion andremion marked this pull request as draft October 18, 2025 10:24
@andremion andremion force-pushed the AND-768-delete-message-for-me branch from 035bc43 to 5aff87d Compare October 20, 2025 12:53
@andremion andremion force-pushed the AND-768-delete-message-for-me branch from 5aff87d to 7104e52 Compare October 20, 2025 13:28
Copy link

sonarqubecloud bot commented Oct 20, 2025

@andremion andremion marked this pull request as ready for review October 20, 2025 13:40
@VelikovPetar VelikovPetar merged commit 5f0e6e8 into develop Oct 20, 2025
13 checks passed
@VelikovPetar VelikovPetar deleted the AND-768-delete-message-for-me branch October 20, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants