Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AND-203] Fix system messages not hidden if showSystemMessages=false. #5546

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Jan 6, 2025

🎯 Goal

The MessageListController flag showSystemMessages was not respected, due to the DeletedMessageVisibility taking precedence. We now properly take this flag into consideration, if the message is not deleted.

🛠 Implementation details

Change the MessageListController.filterMessagesToShow logic to consider the DeletedMessageVisibility when the message is deleted, and consider showSystemMessages if the message is a system one.

🎨 UI Changes

Scenario where showSystemMessages = false

Before After
before.mp4
after.mp4

🧪 Testing

  1. Apply the given patch
  2. Run the compose sample app
  3. Open a chat with a system message
  4. The system message should NOT be visible
Patch
Index: stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt
--- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt	(revision 99dd6beefa5dd859fa7bafc0cac7d98c72105d18)
+++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt	(date 1736165306279)
@@ -113,6 +113,7 @@
             autoTranslationEnabled = ChatApp.autoTranslationEnabled,
             isComposerLinkPreviewEnabled = ChatApp.isComposerLinkPreviewEnabled,
             deletedMessageVisibility = DeletedMessageVisibility.ALWAYS_VISIBLE,
+            showSystemMessages = false,
             messageId = intent.getStringExtra(KEY_MESSAGE_ID),
             parentMessageId = intent.getStringExtra(KEY_PARENT_MESSAGE_ID),
         )

Copy link
Contributor

github-actions bot commented Jan 6, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.04 MB 3.04 MB 0.00 MB 🟢
stream-chat-android-offline 3.25 MB 3.25 MB 0.00 MB 🟢
stream-chat-android-ui-components 7.91 MB 7.91 MB 0.00 MB 🟢
stream-chat-android-compose 9.04 MB 9.04 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar linked an issue Jan 6, 2025 that may be closed by this pull request
@VelikovPetar VelikovPetar marked this pull request as ready for review January 6, 2025 12:26
@VelikovPetar VelikovPetar requested a review from a team as a code owner January 6, 2025 12:26
Copy link
Collaborator

@kanat kanat left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@skydoves skydoves left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@JcMinarro JcMinarro enabled auto-merge (squash) January 7, 2025 10:56
@JcMinarro JcMinarro merged commit 02d32d8 into develop Jan 7, 2025
10 checks passed
@JcMinarro JcMinarro deleted the bug/fix-system-messsages-not-hidden branch January 7, 2025 10:57
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.

System messages are not hidden when showSystemMessages = false
4 participants