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.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chat-jetpack-compose

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?

```

```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?

</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?

</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..."

<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"


### 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


<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

```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


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


## 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

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.

4 participants