[AND-550] Add pending messages support in LLC.
๐ฏ 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
pendingMessagesfield toChannel: Holds the pending messages for the current user in the given channel. - Introduce
ChatClient.getPendingMessagemethod 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
markMessagesPendingflag to the channelConfigfield - 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
- Enable pending messages in the App dashboard (or contact me to provide a test user/apikey)
- Send a message
- Call queryChannels
- Observe the response field:
result.channels[x].pendingMessage-> It should contain all pending messages for the user in the channel - Observe the response field:
result.channels[x].config.markMessagesPending-> should be true otherwise false based on the dashboard config
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 | ๐ข |
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
Moved the PR to Draft - there are some newer changes/requirement that need to be done.
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
