Skip to content

Add Sort Order Support for Media and Files Attachments Lists in Channel Info #6359

@geolyth

Description

@geolyth

Description

We are using the Stream Chat Android SDK (Compose UI kit) and we have been exploring the Media
Attachments
and Files Attachments screens that are accessible from the Channel Info screen
(DirectChannelInfoScreen / GroupChannelInfoScreen).

Currently, when navigating to ChannelMediaAttachmentsScreen or ChannelFilesAttachmentsScreen,
the list of attachments is loaded via ChannelAttachmentsViewController, which internally calls
chatClient.searchMessages(...) without any sort parameter. The items are displayed in the order
returned by the server, with client-side grouping by relative time span (HeaderKeySelector),
but there is no way to control the sort order (ascending or descending) from the public API.


Feature Request

We would like to request the addition of sort order support for both the media and files
attachments lists. Specifically:

  1. Expose a sortOrder parameter (e.g., ASC / DESC) on:

    • ChannelMediaAttachmentsScreen
    • ChannelFilesAttachmentsScreen
    • ChannelAttachmentsViewModelFactory
    • ChannelAttachmentsViewController
  2. Apply the sort order either:

    • By passing a sort parameter to the searchMessages API call (if supported server-side), or
    • By sorting the accumulated items client-side using the message creation date
      (e.g., sortedByDescending { it.message.createdAt }).
  3. Keep the headerKeySelector consistent with the chosen sort order so that group headers
    (e.g., "This week", "Last month") remain logically ordered.


Current Behavior

  • Attachments are returned in the order provided by the server.
  • There is no public API to control or reverse the sort order.
  • The only customization available is the headerKeySelector lambda, which groups items
    but does not sort them.

Expected Behavior

  • The developer should be able to configure the sort order (ascending or descending by message
    creation date) when instantiating the screen or the ViewModel factory.
  • Default behavior should remain unchanged (backward compatible).

SDK Details

Property Value
Platform Android
UI Kit Jetpack Compose (stream-chat-android-compose)

Affected components:

  • ChannelMediaAttachmentsScreen
  • ChannelFilesAttachmentsScreen
  • ChannelAttachmentsViewController (stream-chat-android-ui-common)
  • ChannelAttachmentsViewModelFactory
  • ChannelAttachmentsViewState

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions