stream-chat-android icon indicating copy to clipboard operation
stream-chat-android copied to clipboard

[AND-550] Add pending messages support in LLC.

Open VelikovPetar opened this issue 9 months ago โ€ข 3 comments

๐ŸŽฏ Goal

Introduces a way to access the pending messages in the channel for the current user. Additionally, exposes an operation to fetch a pending message (and its metadata) by its ID. Docs: https://getstream.io/chat/docs/react/pending_messages/

๐Ÿ›  Implementation details

  • Add pendingMessages field to Channel: Holds the pending messages for the current user in the given channel.
  • Introduce ChatClient.getPendingMessage method to fetch a pending message and its metadata by its IDs. Note: This operation uses the same endpoint as the getMessage operation. I introduced a new method, because it is not possible to return the pending message metadata without a breaking change on the getMessage method. I also wanted to avoid introducing a new filed in the Message object, as the metadata doesn't really belong to it. This would potentially be a discrepancy between different SDKs, but I wasn't able to find a different way to do it without a breaking change.
  • Add markMessagesPending flag to the channel Config field - indicator if pending messages are enabled for the channel.

Note: These additions are not used internally, they are just exposed for client integration.

๐ŸŽจ UI Changes

NA

๐Ÿงช Testing

  1. Enable pending messages in the App dashboard (or contact me to provide a test user/apikey)
  2. Send a message
  3. Call queryChannels
  4. Observe the response field: result.channels[x].pendingMessage -> It should contain all pending messages for the user in the channel
  5. Observe the response field: result.channels[x].config.markMessagesPending -> should be true otherwise false based on the dashboard config

VelikovPetar avatar May 21 '25 09:05 VelikovPetar

SDK Size Comparison ๐Ÿ“

SDK Before After Difference Status
stream-chat-android-client 3.20 MB 3.21 MB 0.00 MB ๐ŸŸข
stream-chat-android-offline 3.43 MB 3.43 MB 0.00 MB ๐ŸŸข
stream-chat-android-ui-components 10.50 MB 10.50 MB 0.00 MB ๐ŸŸข
stream-chat-android-compose 12.69 MB 12.69 MB 0.00 MB ๐ŸŸข

github-actions[bot] avatar May 21 '25 09:05 github-actions[bot]

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/channelconfig/internal/ChannelConfigEntity.kt

github-actions[bot] avatar May 30 '25 08:05 github-actions[bot]

Quality Gate Failed Quality Gate failed

Failed conditions
63.3% Coverage on New Code (required โ‰ฅ 80%)

See analysis details on SonarQube Cloud

sonarqubecloud[bot] avatar Jul 08 '25 15:07 sonarqubecloud[bot]

Moved the PR to Draft - there are some newer changes/requirement that need to be done.

VelikovPetar avatar Jul 18 '25 07:07 VelikovPetar

Quality Gate Failed Quality Gate failed

Failed conditions
60.9% Coverage on New Code (required โ‰ฅ 80%)

See analysis details on SonarQube Cloud

sonarqubecloud[bot] avatar Sep 06 '25 13:09 sonarqubecloud[bot]

Should we keep "pending messages" within our local db as well??

I was considering this, but given the fact that currently the Channel.pendingMessages field is not used in the state/offline layers, and is just exposed on the Channel model from the LLC - I am not sure if it makes too much sense to also store them in the DB, as they will never be accessed. I think it will just introduce overhead if we store the pending messages but never read them (of course, this will need to change if we eventually add specific state/ui handling of pending messages)

CC @JcMinarro

VelikovPetar avatar Sep 06 '25 13:09 VelikovPetar