Skip to content

Conversation

@ttypic
Copy link
Contributor

@ttypic ttypic commented Dec 1, 2025

Description

  • Added examples showcasing the use of Jetpack Compose APIs in the chat SDK.
  • Updated documentation to include Jetpack Compose methods such as collectAsPagingMessagesState(), collectAsCurrentlyTyping(), collectAsStatus(), and others.
  • Extended sections with Jetpack Compose-specific code snippets for message reactions, typing events, room management, and more.

Checklist

@ttypic ttypic requested a review from AndyTWF December 1, 2025 09:38
@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Added examples showcasing the use of Jetpack Compose APIs in the chat SDK.
- Updated documentation to include Jetpack Compose methods such as `collectAsPagingMessagesState()`, `collectAsCurrentlyTyping()`, `collectAsStatus()`, and others.
- Extended sections with Jetpack Compose-specific code snippets for message reactions, typing events, room management, and more.
@ttypic ttypic force-pushed the chat-jetpack-compose branch from d33713d to 3d7feab Compare December 1, 2025 09:39
@AndyTWF AndyTWF added the review-app Create a Heroku review app label Dec 8, 2025
@ably-ci ably-ci temporarily deployed to ably-docs-chat-jetpack--sgdwpj December 8, 2025 12:08 Inactive
@ably-ci ably-ci temporarily deployed to ably-docs-chat-jetpack--sgdwpj December 8, 2025 12:58 Inactive
label: 'Kotlin',
syntaxHighlighterKey: 'kotlin',
},
jetpack: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these as a fixup so that it shows up in docs - could you source an icon for Jetpack so it shows in the language selector?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added alias to kotlin, so it will use kotlin icon for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created PR to add icon -> ably/ably-ui#1023

```

```jetpack
import com.ably.chat.ChatClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation on the code examples are different between Kotlin and Jetpack in many places (despite being the same code) - can we fix this?

Copy link
Contributor

@sacOO7 sacOO7 Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed -> b8cf371

</Code>
</If>

## Handle connection discontinuity <a id="discontinuity"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have discontinuityAsFlow - should that be mentioned here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed -> b8cf371

</If>

<If lang="jetpack">
For Jetpack Compose, use the [`collectAsPagingMessagesState()`](https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/jetpack/chat-extensions-compose/com.ably.chat.extensions.compose/collect-as-paging-messages-state.html) composable function to observe messages with automatic pagination support. Alternatively, you can use [`messages.subscribe()`](https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat/com.ably.chat/-messages/subscribe.html) for a simple subscription:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid saying "For Jetpack Compose", as the language selector filters all this out. It should just be "Use the..."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed -> b8cf371

<If lang="javascript,kotlin">
Use the `unsubscribe()` function returned in the `subscribe()` response to remove a chat message listener:
<If lang="javascript,kotlin,jetpack">
Use the `unsubscribe()` function returned in the `subscribe()` response to remove a chat message listener<If lang="jetpack">. When using Jetpack Compose's `collectAsPagingMessagesState()`, lifecycle and cleanup are handled automatically</If>:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this extra sentence, because someone using jetpack won't be expecting to use it? So we just say:

"collectAsPagingMessagesState() handles lifecycle and cleanup automatically"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed -> b8cf371


### Occupancy event structure

The following is the structure of an occupancy event:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix this for Kotlin and Swift

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added for kotlin,swift and jetpack


<If lang="javascript,kotlin">
Use the `unsubscribe()` function returned in the `subscribe()` response to remove a room occupancy listener:
<If lang="javascript,kotlin,jetpack">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto re Jetpack having its own if block rather than tacking on the end of kotlin

Copy link
Contributor

@sacOO7 sacOO7 Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jetpack block has been removed, since it automatically handles unsubscribe as a part of the component lifecycle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the block

```jetpack
// Jetpack Compose handles cleanup automatically
// When using subscribe directly:
val (unsubscribe) = room.occupancy.subscribe { event ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto re whether we should be encouraging manual subscription with jetpack

Copy link
Contributor

@sacOO7 sacOO7 Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the code, it's not needed similar to swift


Note that if sending two identical reactions of type `Distinct`, the second one will be accepted and broadcast as a raw reaction, but it will be ignored in the summary (aggregate). Similarly, when removing a reaction that doesn't exist (of any type), the operation will be accepted and broadcast as a raw reaction, but it will have no effect on the summary.

### Configure the default reaction type <a id="default-type"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a jetpack

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added -> 37360d5


## Messages and reactions <a id="messages-and-reactions"/>

The `Message` object contains a `reactions` property which is an object that looks like this:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs Kotlin+Swift section

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added -> 37360d5

Copy link

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 pull request adds comprehensive Jetpack Compose support to the Ably Chat SDK documentation. It introduces a new "jetpack" language option alongside existing Kotlin examples, providing developers with Compose-specific APIs and patterns for building chat applications with reactive state management.

Changes:

  • Added "jetpack" as a new language option in the documentation system with appropriate configuration and syntax highlighting
  • Extended all major chat feature documentation pages with Jetpack Compose code examples showcasing composable functions and state management
  • Fixed several existing typos and syntax errors in Kotlin code examples (spelling corrections and bracket issues)

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 33 comments.

Show a summary per file
File Description
src/data/languages/types.ts Added 'jetpack' to the list of supported language keys
src/data/languages/languageInfo.ts Configured Jetpack Compose with label and Kotlin syntax highlighting
src/data/languages/languageData.ts Added version 1.0 for jetpack in chat SDK
src/pages/docs/chat/setup.mdx Added Jetpack Compose dependency installation and client instantiation examples
src/pages/docs/chat/rooms/typing.mdx Added composable examples for typing indicators using collectAsCurrentlyTyping()
src/pages/docs/chat/rooms/reactions.mdx Added composable examples for room reactions and fixed "reaciton" typo
src/pages/docs/chat/rooms/presence.mdx Added composable examples for presence management with collectAsPresenceMembers()
src/pages/docs/chat/rooms/occupancy.mdx Added composable examples for occupancy tracking with collectAsOccupancy()
src/pages/docs/chat/rooms/messages.mdx Added composable examples for messages with collectAsPagingMessagesState() and fixed broken markdown link
src/pages/docs/chat/rooms/message-reactions.mdx Added composable examples for message reactions and fixed syntax errors with extra parentheses
src/pages/docs/chat/rooms/index.mdx Added composable examples for room status monitoring with collectAsStatus()
src/pages/docs/chat/rooms/history.mdx Added composable examples for message history with pagination support
src/pages/docs/chat/connect.mdx Added composable examples for connection status monitoring

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 14 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sacOO7 sacOO7 force-pushed the chat-jetpack-compose branch 2 times, most recently from 27b058c to 8e8d3bd Compare January 13, 2026 13:48
…be method

- Added missing Room imports for occupancy and presence
- Fixed android.mdx to use `historyBeforeSubscribe` method instead of `getPreviousMessages`
@sacOO7 sacOO7 force-pushed the chat-jetpack-compose branch from 8e8d3bd to 1abfd27 Compare January 13, 2026 13:53
Copy link

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

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

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… merged

into ably-ui
- Bumped up kotlin and jetpack version to 1.1
@sacOO7
Copy link
Contributor

sacOO7 commented Jan 14, 2026

Closing in favor of #3097

@sacOO7 sacOO7 closed this Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

5 participants