Skip to content

Conversation

@TGazica
Copy link
Contributor

@TGazica TGazica commented Mar 22, 2023

🎯 Goal

Enable the control to show/hide the reply view inside the default implementation of the MessageComposerView center content.

🛠 Implementation details

Added messageInputShowReplyView to MessageComposerViewStyle.

🎨 UI Changes

Before After
Screenshot_1679499962 Screenshot_1679499938

🧪 Testing

Run this branch without patch and reply to a message. The replyView should be visible.
Run this branch with the patch and repeat. ReplyView should not be visible.

Test patch
Index: stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/message/composer/MessageComposerViewStyle.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/message/composer/MessageComposerViewStyle.kt b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/message/composer/MessageComposerViewStyle.kt
--- a/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/message/composer/MessageComposerViewStyle.kt	(revision c6776dc1b44f37f476280d74d4d31eaee6b6299d)
+++ b/stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/message/composer/MessageComposerViewStyle.kt	(date 1679500814058)
@@ -528,7 +528,7 @@
 
                 val messageInputShowReplyView = a.getBoolean(
                     R.styleable.MessageComposerView_streamUiMessageComposerShowMessageReplyView,
-                    true
+                    false
                 )
 
                 val mediumTypeface = ResourcesCompat.getFont(context, R.font.stream_roboto_medium) ?: Typeface.DEFAULT

☑️Contributor Checklist

General

  • Assigned a person / code owner group (required)
  • Thread with the PR link started in a respective Slack channel (#android-chat-core or #android-chat-ui) (required)
  • PR targets the develop branch
  • PR is linked to the GitHub issue it resolves

Code & documentation

  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (KDocs, docusaurus, tutorial)

☑️Reviewer Checklist

  • UI Components sample runs & works
  • Compose sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • Release notes and docs clearly describe changes
  • All code we touched has new or updated KDocs

🎉 GIF

giphy

@TGazica TGazica linked an issue Mar 22, 2023 that may be closed by this pull request
1 task
@TGazica TGazica marked this pull request as ready for review March 22, 2023 16:05
@TGazica TGazica requested review from a team and MarinTolic March 22, 2023 16:05
@TGazica TGazica requested a review from a team as a code owner March 22, 2023 16:05
Copy link
Contributor

@MarinTolic MarinTolic left a comment

Choose a reason for hiding this comment

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

In the future we should probably include patches which test the code by changing publicly visible parameters, the same way users would use them, like so:

Test patch
Index: stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/feature/chat/ChatFragment.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/feature/chat/ChatFragment.kt b/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/feature/chat/ChatFragment.kt
--- a/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/feature/chat/ChatFragment.kt	(revision 542d46cecb35b05dfa70580d0f9794cb371445d0)
+++ b/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/feature/chat/ChatFragment.kt	(date 1679573748793)
@@ -44,6 +44,8 @@
 import io.getstream.chat.android.core.ExperimentalStreamChatApi
 import io.getstream.chat.android.core.internal.InternalStreamChatApi
 import io.getstream.chat.android.livedata.utils.EventObserver
+import io.getstream.chat.android.ui.StyleTransformer
+import io.getstream.chat.android.ui.TransformStyle
 import io.getstream.chat.android.ui.message.composer.viewmodel.MessageComposerViewModel
 import io.getstream.chat.android.ui.message.composer.viewmodel.bindView
 import io.getstream.chat.android.ui.message.input.viewmodel.bindView
@@ -84,6 +86,11 @@
         container: ViewGroup?,
         savedInstanceState: Bundle?,
     ): View {
+        TransformStyle.messageComposerStyleTransformer = StyleTransformer {
+            it.copy(
+                messageInputShowReplyView = false
+            )
+        }
         _binding = FragmentChatBinding.inflate(inflater, container, false)
         return binding.root
     }
Index: stream-chat-android-ui-components-sample/src/main/res/layout/fragment_chat.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/stream-chat-android-ui-components-sample/src/main/res/layout/fragment_chat.xml b/stream-chat-android-ui-components-sample/src/main/res/layout/fragment_chat.xml
--- a/stream-chat-android-ui-components-sample/src/main/res/layout/fragment_chat.xml	(revision 542d46cecb35b05dfa70580d0f9794cb371445d0)
+++ b/stream-chat-android-ui-components-sample/src/main/res/layout/fragment_chat.xml	(date 1679573940214)
@@ -59,6 +59,7 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:visibility="gone"
+            app:streamUiMessageComposerShowMessageReplyView="false"
             />
 
         <io.getstream.chat.android.ui.message.input.MessageInputView


☑️Reviewer Checklist

  • UI Components sample runs & works
  • Compose sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • Release notes and docs clearly describe changes
  • All code we touched has new or updated KDocs

@TGazica TGazica merged commit f803b80 into v5 Mar 23, 2023
@TGazica TGazica deleted the task/4754-message-composerview-reply-visibility branch March 23, 2023 12:27
MarinTolic pushed a commit that referenced this pull request Apr 6, 2023
* Add messageInputShowReplyView to enable control whether to show the default reply view or not

* Update changelog
MarinTolic added a commit that referenced this pull request Apr 6, 2023
kanat added a commit that referenced this pull request Apr 6, 2023
* MessageComposerView show reply view (#4746)

* Add messageInputShowReplyView to enable control whether to show the default reply view or not

* Update changelog

* MessageComposerView show reply view (#4746)

Generate an api dump

---------

Co-authored-by: Tomislav Gazica <38032787+tgazica@users.noreply.github.com>
Co-authored-by: Kanat Kiialbaev <kanat.kiialbaev@gmail.com>
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.

MessageComposerView replyView visibility

3 participants