Skip to content

Conversation

VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Sep 15, 2025

🎯 Goal

Add support for filtering and sorting the results of the QueryThreads operation.
Resolves: https://linear.app/stream/issue/AND-633/query-threads-improvements

🛠 Implementation details

LLC

  1. Add filter and sort properties to the QueryThreadsRequest
  2. Add extraData properties on Thread and ThreadInfo

State/Offline

  1. Add state/logic handling per QueryThreadsRequest

UI Common

  1. Change ThreadListController to accept QueryThreadsRequest in the constructor instead of separate arguments.

Compose / XML

  1. Add ThreadsViewModelFactory(QueryThreadsRequest) constructor
  2. Deprecate ThreadsViewModelFactory(threadLimit, threadReplyLimit, threadParticipantLimit) constructor in favor of ThreadsViewModelFactory(QueryThreadsRequest) constructor.

🎨 UI Changes

No visible UI changes, the changes are additions to the LLC API, and in the instantiation of the ThreadsViewModelFactory

🧪 Testing

  1. Update the QueryThreadsRequest passed in the existing ThreadsViewModelFactory (in ChannelsActivity in the compose sample or ThreadsFragment in the XML sample)
  2. Observe that the thread list respects the passed filter/sort specs

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/threads/internal/ThreadEntity.kt

Copy link
Contributor

github-actions bot commented Sep 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.00 MB 🟢
stream-chat-android-ui-components 10.52 MB 10.52 MB 0.00 MB 🟢
stream-chat-android-compose 12.73 MB 12.74 MB 0.01 MB 🟢

@VelikovPetar VelikovPetar marked this pull request as ready for review September 16, 2025 06:51
@VelikovPetar VelikovPetar requested a review from a team as a code owner September 16, 2025 06:51
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 adds support for filtering and sorting options to the QueryThreads operation in the Stream Chat Android SDK. The purpose is to enhance the thread querying capabilities by allowing developers to customize thread queries with specific filters and sorting criteria.

Key changes:

  • Add filter and sort properties to QueryThreadsRequest with comprehensive documentation of supported fields
  • Update ThreadsViewModelFactory to accept QueryThreadsRequest constructor and deprecate the old constructor
  • Refactor internal state management to support multiple query instances with different filters/sorts

Reviewed Changes

Copilot reviewed 61 out of 61 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/viewmodel/threads/ThreadsViewModelFactory.kt Updates factory to accept QueryThreadsRequest, deprecates old constructor
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api/models/QueryThreadsRequest.kt Adds filter and sort properties with comprehensive documentation
stream-chat-android-state/src/main/java/io/getstream/chat/android/state/plugin/logic/internal/LogicRegistry.kt Refactors to support multiple QueryThreadsLogic instances per filter/sort combination
stream-chat-android-core/src/main/java/io/getstream/chat/android/models/Thread.kt Adds ComparableFieldProvider implementation and extraData property
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/threads/ThreadsViewModelFactory.kt Mirror changes from UI components factory

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

…roid/client/query/request/ChannelFilterRequest.kt

Co-authored-by: Copilot <[email protected]>
Copy link
Contributor

@andremion andremion 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! 👍🏻
Can you please increase the coverage a bit more? (No need to care about the compose coverage, they are done in my PR)

# Conflicts:
#	CHANGELOG.md
#	DEPRECATIONS.md
#	stream-chat-android-compose/api/stream-chat-android-compose.api
#	stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/threads/ThreadsViewModelFactory.kt
Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@VelikovPetar VelikovPetar merged commit 77c334c into develop Sep 26, 2025
12 of 13 checks passed
@VelikovPetar VelikovPetar deleted the feature/query-threads-filter-and-sort branch September 26, 2025 12:18
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.

2 participants