Skip to content

Conversation

@MarinTolic
Copy link
Contributor

@MarinTolic MarinTolic commented Feb 17, 2023

🎯 Goal

Closes GetStream/android-internal-board#172

🛠 Implementation details

Implemented a method inside MessageListItemLiveData which updates the date separator handler.

🧪 Testing

Patch that logs separator handler calls
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 b71509124a73e34ff5e0d869ea44a7ed2a1abd5d)
+++ b/stream-chat-android-ui-components-sample/src/main/kotlin/io/getstream/chat/ui/sample/feature/chat/ChatFragment.kt	(date 1676654206028)
@@ -17,6 +17,7 @@
 package io.getstream.chat.ui.sample.feature.chat
 
 import android.os.Bundle
+import android.util.Log
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
@@ -223,6 +224,7 @@
             )
             bindView(binding.messageListView, viewLifecycleOwner)
             setDateSeparatorHandler { previousMessage, message ->
+                Log.d("dateSeparator", "called")
                 if (previousMessage == null) {
                     true
                 } else {
@@ -230,6 +232,7 @@
                 }
             }
             setThreadDateSeparatorHandler { previousMessage, message ->
+                Log.d("threadDateSeparator", "called")
                 if (previousMessage == null) {
                     false
                 } else {
  1. Apply the patch above
  2. Enter a channel and scroll
  3. Enter a thread and scroll
  4. Filter logs for dateSeparator and threadDateSeparator. You should see these being logged.
  5. Go to v5 and apply the same patch
  6. Repeat steps 2 and 3. You should not see dateSeparator being logged, threadDateSeparator will still be logged however

☑️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

gif

@MarinTolic MarinTolic marked this pull request as ready for review February 17, 2023 17:31
@MarinTolic MarinTolic requested a review from a team as a code owner February 17, 2023 17:31
@MarinTolic MarinTolic requested review from a team and TGazica February 17, 2023 17:31
@filbabic filbabic enabled auto-merge (squash) February 21, 2023 08:57
@filbabic filbabic merged commit 8770132 into v5 Feb 21, 2023
@filbabic filbabic deleted the bugfix/4680_fix_setting_date_separator_handler branch February 21, 2023 09:20
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.

3 participants