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-406] Draft Messages on UI Components #5687

Merged
merged 16 commits into from
Apr 1, 2025
Merged

Conversation

JcMinarro
Copy link
Member

@JcMinarro JcMinarro commented Mar 20, 2025

🎯 Goal

Depend on: #5682

With this implementation show draft messages within the list of channels and message composer.

🎨 UI Changes

XML Compose
xml-draft-message.mp4
compose-draft-messages.mp4

🧪 Testing

To test it you will need to enable draft messages feature on Channels List and Message Composer.
The following patch add the needed flags

Provide the patch summary here
Subject: [PATCH] Print some logs
---
Index: stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/ChatUI.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/ChatUI.kt b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/ChatUI.kt
--- a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/ChatUI.kt	(revision b6c511809d418dd52bd19605f381a966c5a35015)
+++ b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/ChatUI.kt	(date 1742545910050)
@@ -199,7 +199,7 @@
      * Whether draft messages are enabled.
      */
     @JvmStatic
-    public var draftMessageEnabled: Boolean = false
+    public var draftMessageEnabled: Boolean = true
 
     /**
      * Sets the strategy for resizing images hosted on Stream's CDN. Disabled by default,
Index: stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/feature/channel/list/ChannelsActivity.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/feature/channel/list/ChannelsActivity.kt b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/feature/channel/list/ChannelsActivity.kt
--- a/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/feature/channel/list/ChannelsActivity.kt	(revision b6c511809d418dd52bd19605f381a966c5a35015)
+++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/feature/channel/list/ChannelsActivity.kt	(date 1742546563527)
@@ -101,6 +101,7 @@
                 Filters.or(Filters.notExists(CHANNEL_ARG_DRAFT), Filters.eq(CHANNEL_ARG_DRAFT, false)),
             ),
             chatEventHandlerFactory = CustomChatEventHandlerFactory(),
+            isDraftMessageEnabled = true,
         )
     }
     private val threadsViewModelFactory by lazy { ThreadsViewModelFactory() }
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 b6c511809d418dd52bd19605f381a966c5a35015)
+++ b/stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.kt	(date 1742546563546)
@@ -110,6 +110,7 @@
             deletedMessageVisibility = DeletedMessageVisibility.ALWAYS_VISIBLE,
             messageId = intent.getStringExtra(KEY_MESSAGE_ID),
             parentMessageId = intent.getStringExtra(KEY_PARENT_MESSAGE_ID),
+            isComposerDraftMessageEnabled = true,
         )
     }
 

Copy link
Contributor

github-actions bot commented Mar 20, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.18 MB 3.18 MB 0.00 MB 🟢
stream-chat-android-offline 3.39 MB 3.39 MB -0.00 MB 🚀
stream-chat-android-ui-components 7.89 MB 7.90 MB 0.00 MB 🟢
stream-chat-android-compose 9.92 MB 9.93 MB 0.00 MB 🟢

@JcMinarro JcMinarro marked this pull request as ready for review March 21, 2025 08:46
@JcMinarro JcMinarro requested a review from a team as a code owner March 21, 2025 08:46
@JcMinarro JcMinarro force-pushed the feature/draft-message-ui branch 2 times, most recently from 6c75766 to 9425b6f Compare March 21, 2025 16:32
Copy link
Contributor

@VelikovPetar VelikovPetar left a comment

Choose a reason for hiding this comment

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

I left couple of remarks/questions, but looks very good! GJ!

@JcMinarro JcMinarro changed the title [AND-405] Draft Messages on UI Components [AND-406] Draft Messages on UI Components Mar 24, 2025
@JcMinarro JcMinarro force-pushed the feature/draft-message-ui branch from 9425b6f to c836715 Compare March 24, 2025 16:06
@JcMinarro JcMinarro requested a review from VelikovPetar March 26, 2025 19:47
@JcMinarro JcMinarro force-pushed the feature/draft-message-ui branch from 0693db5 to e365740 Compare March 31, 2025 15:23
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
14.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@testableapple
Copy link
Contributor

LGTM! ✅

The only comment is that the Offline Support is out of scope for this PR. Let's implement it in a separate one.

@JcMinarro JcMinarro merged commit 4a3077d into develop Apr 1, 2025
13 of 14 checks passed
@JcMinarro JcMinarro deleted the feature/draft-message-ui branch April 1, 2025 10:49
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.

3 participants