Skip to content

Conversation

@sacOO7
Copy link
Contributor

@sacOO7 sacOO7 commented Jan 14, 2026

Summary by CodeRabbit

Documentation

  • Updated API parameter naming: withOptions renamed to withParams for chat history queries
  • Added comprehensive multi-language code examples across Swift, Kotlin, Jetpack Compose, and JavaScript/React for:
    • Media attachment, validation, and display in messages
    • Removing message reactions
    • Sending and displaying message replies
  • Enhanced end-of-pagination handling documentation

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

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.

Walkthrough

This PR adds comprehensive multi-language code examples for media sharing, message replies, and message reactions across the chat documentation, while correcting a Swift API parameter label in the message history section from withOptions to withParams.

Changes

Cohort / File(s) Summary
API Parameter Update
src/pages/docs/chat/rooms/history.mdx
Swift API call updated: history(withParams: instead of history(withOptions:. Added else branch handling end-of-pagination case.
Media Documentation Examples
src/pages/docs/chat/rooms/media.mdx
Comprehensive multi-language examples added (Swift, Kotlin, Jetpack Compose, Kotlin Multiplatform, JavaScript/React) demonstrating: MediaData structure definition, attaching/sending media, validating media via regex, displaying media in UI components, and mutating/removing media from message metadata.
Message Reactions Examples
src/pages/docs/chat/rooms/message-reactions.mdx
Swift and Kotlin code examples added for removing message reactions, covering name-only deletion, unique type reactions, and multiple-count reactions.
Message Replies Examples
src/pages/docs/chat/rooms/replies.mdx
Multi-language examples added (Swift, Kotlin, Jetpack Compose) for sending replies, preparing reply payloads, fetching parent messages, and parsing/displaying reply metadata (serial, clientId, previewText).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hopping through the docs with glee,
Code examples in harmony—
Swift, Kotlin, Compose so bright,
Media, replies all done right!
Parameters renamed with care,
Documentation beyond compare! 📚✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding missing Kotlin, Swift, and Jetpack documentation for chat features. It directly relates to the core objective of the PR.
Linked Issues check ✅ Passed All objectives from FTF-481 are met: Kotlin and Swift docs added for media.mdx FTF-481, replies.mdx FTF-481, and message-reactions.mdx FTF-481. Additionally, the history.mdx update addresses Swift API documentation completeness.
Out of Scope Changes check ✅ Passed The changes to history.mdx and message-reactions.mdx are related to the broader audit objective mentioned in FTF-481 (check other chat sections for missing snippets), staying within scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@sacOO7 sacOO7 changed the title Added missing chat swift/kotlin documentation for media and replies Added missing chat swift/kotlin doc Jan 14, 2026
@sacOO7 sacOO7 force-pushed the fix/missing-chat-documentation branch from 207d1c0 to 58c0968 Compare January 14, 2026 09:11
@sacOO7 sacOO7 changed the title Added missing chat swift/kotlin doc Added missing chat kotlin/swift doc Jan 14, 2026
@sacOO7 sacOO7 marked this pull request as ready for review January 14, 2026 09:26
@sacOO7 sacOO7 changed the title Added missing chat kotlin/swift doc Fix missing chat kotlin/swift doc Jan 14, 2026
@sacOO7 sacOO7 changed the title Fix missing chat kotlin/swift doc Fix missing chat kotlin/swift/jetpack doc Jan 14, 2026
@sacOO7 sacOO7 changed the title Fix missing chat kotlin/swift/jetpack doc chat docs: Fix missing chat kotlin/swift/jetpack doc Jan 14, 2026
@sacOO7 sacOO7 changed the title chat docs: Fix missing chat kotlin/swift/jetpack doc chat docs: fix missing chat kotlin/swift/jetpack doc Jan 14, 2026
@sacOO7 sacOO7 requested a review from maratal January 14, 2026 10:24
@sacOO7
Copy link
Contributor Author

sacOO7 commented Jan 14, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/pages/docs/chat/rooms/replies.mdx`:
- Around line 66-99: The React reply example uses "createdAt" for the reply
metadata while Swift/Kotlin/JS use "timestamp"; update the React example so the
metadata key is "reply.timestamp" (replace createdAt with timestamp) to match
other language examples and ensure cross-platform consistency, and while here
confirm that the Kotlin usage of replyToMessage.timestamp is in milliseconds (or
convert it to ms like Swift does) so all examples supply timestamp as epoch
milliseconds.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 291d6e5 and 58c0968.

📒 Files selected for processing (4)
  • src/pages/docs/chat/rooms/history.mdx
  • src/pages/docs/chat/rooms/media.mdx
  • src/pages/docs/chat/rooms/message-reactions.mdx
  • src/pages/docs/chat/rooms/replies.mdx
🔇 Additional comments (11)
src/pages/docs/chat/rooms/history.mdx (1)

57-57: LGTM!

The Swift parameter label correction from withOptions to withParams aligns with the SDK documentation URL referenced on line 11 (history(withparams:)).

src/pages/docs/chat/rooms/message-reactions.mdx (1)

318-352: LGTM!

The Swift and Kotlin examples for removing message reactions are consistent with the existing send reaction patterns earlier in the file (lines 122-162) and mirror the JavaScript/React examples.

src/pages/docs/chat/rooms/replies.mdx (3)

170-202: LGTM!

The prepareReply helper functions are consistent across Swift, Kotlin, and Jetpack, properly extracting and formatting parent message data for reply metadata.


233-275: LGTM!

The fetchParentMessage implementations properly handle serial extraction with appropriate error handling for each platform (Swift uses NSError, Kotlin throws IllegalArgumentException).


337-427: LGTM!

The display reply implementations correctly handle metadata extraction using platform-appropriate patterns (Swift pattern matching, Kotlin null-safe operators). The Jetpack Compose example properly manages subscription lifecycle with DisposableEffect.

src/pages/docs/chat/rooms/media.mdx (6)

80-148: LGTM!

The MediaData struct and onMediaAttach flow implementations are consistent across Swift, Kotlin, and Jetpack Compose, properly managing the media attachment state.

Note: The uploadMedia() function referenced in Swift/Kotlin/Jetpack is assumed to be a placeholder that users implement, matching the pattern established in the JavaScript example at lines 29-44.


214-329: LGTM!

The send message implementations properly construct JSON metadata containing the media array using platform-appropriate patterns (Swift JSONValue enums, Kotlin buildJsonObject/buildJsonArray).


366-450: LGTM!

The getValidMedia implementations properly validate media IDs using regex and safely extract typed values from JSON metadata. The validation approach is consistent with security best practices mentioned in the documentation.


515-623: LGTM!

The display implementations demonstrate platform-appropriate UI patterns. The Swift (UIKit) and Kotlin (Android Views) examples include helpful comments indicating where image loading libraries should be integrated, while the Jetpack Compose example shows a complete implementation using Coil's AsyncImage.


669-780: LGTM!

The addMediaToMessage implementations correctly handle metadata mutation by preserving existing metadata while adding new media entries. The Kotlin/Jetpack approach of rebuilding the metadata object maintains immutability.


829-947: LGTM!

The removeMediaFromMessage implementations properly filter out the target media ID while preserving other metadata. Early returns for empty media arrays prevent unnecessary API calls.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@sacOO7 sacOO7 force-pushed the feature/chat-jetpack-compose-docs branch 4 times, most recently from 57c3e71 to a72f25d Compare January 14, 2026 15:10
…lin snippets

- Added uploadMedia method to swift/kotlin and jetpack
@sacOO7 sacOO7 force-pushed the feature/chat-jetpack-compose-docs branch from a72f25d to 520c5c6 Compare January 14, 2026 17:26
Copy link
Collaborator

@maratal maratal left a comment

Choose a reason for hiding this comment

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

Left a few questions.

func send(text: String, mediaToAttach: [MediaData]) async throws {
var metadata: MessageMetadata = [:]
if !mediaToAttach.isEmpty {
let mediaArray: [JSONValue] = mediaToAttach.map { media in
Copy link
Collaborator

Choose a reason for hiding this comment

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

This snippet is complicated and not welcoming. I think a single object is enough as an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, will check for simplifying this 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

suspend fun send(text: String, mediaToAttach: List<MediaData>) {
val metadata = if (mediaToAttach.isNotEmpty()) {
buildJsonObject {
put("media", buildJsonArray {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

```

```swift
import UIKit
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't it better to stick to SwiftUI in all new examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sacOO7 sacOO7 added the review-app Create a Heroku review app label Jan 15, 2026
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 15, 2026 07:07 Inactive
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 15, 2026 09:58 Inactive
@sacOO7 sacOO7 removed the request for review from AndyTWF January 15, 2026 09:58
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 15, 2026 13:35 Inactive
@sacOO7 sacOO7 requested a review from maratal January 15, 2026 13:36
@sacOO7 sacOO7 force-pushed the fix/missing-chat-documentation branch from 6f59c3b to bef8be6 Compare January 15, 2026 14:03
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 15, 2026 14:03 Inactive
@sacOO7 sacOO7 requested a review from Copilot January 15, 2026 14:05
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 PR adds missing documentation for chat-swift, chat-kotlin, and Jetpack Compose SDKs, fixing incomplete code examples across multiple chat features. The changes also correct an API parameter naming inconsistency in Swift examples.

Changes:

  • Updated Swift API parameter name from withOptions to withParams for consistency
  • Added comprehensive Swift, Kotlin, and Jetpack Compose code examples for media attachments
  • Added Swift, Kotlin, and Jetpack Compose examples for message replies functionality
  • Added Swift and Kotlin examples for removing message reactions
  • Corrected Swift code examples to include try keyword for error handling

Reviewed changes

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

File Description
history.mdx Updated Swift history query API from withOptions to withParams
message-reactions.mdx Fixed Swift syntax, added Swift/Kotlin reaction deletion examples, corrected parameter names
media.mdx Added comprehensive Swift, Kotlin, and Jetpack examples for media upload, validation, and display
replies.mdx Added complete Swift, Kotlin, and Jetpack examples for sending and displaying message replies
Comments suppressed due to low confidence (1)

src/pages/docs/chat/rooms/message-reactions.mdx:651

  • This Swift code uses the outdated parameter name withOptions instead of withParams. This is inconsistent with the fix made in history.mdx and other Swift examples in this PR. Change withOptions to withParams for API consistency.
var messages = (await room.messages.history(withOptions: .init(limit: 50))).items

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

…andards

- Fixed swift snippet method signatuee for messages.history in message-reactions
Copy link
Collaborator

@maratal maratal left a comment

Choose a reason for hiding this comment

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

Few suggestions

func send(text: String, mediaToAttach: [JSONObject]) async throws {
var metadata: MessageMetadata = [:]
if !mediaToAttach.isEmpty {
metadata["media"] = .array(mediaToAttach.map { .object($0) })
Copy link
Collaborator

Choose a reason for hiding this comment

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

I beleive that some commentary of what .array(mediaToAttach.map { .object($0) }) means wouldn't be unuseful for reader.

return nil
}

let range = NSRange(location: 0, length: id.utf16.count)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just id.count?

```swift
import SwiftUI

struct MessageView: View {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally, this should be checked in Xcode, since someone will copy this example and try to run it.

var newMetadata = message.metadata

var mediaArray: [JSONValue]
if case let .array(existingArray) = newMetadata["media"] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it can be

var mediaArray: [JSONValue] = if case let .array(existingArray) = newMetadata["media"] {
    existingArray
} else {
    []
}

if let replyMetadata = message.metadata["reply"],
case let .object(replyData) = replyMetadata {
if case let .string(replySerial) = replyData["serial"] {
if let parentMessage = localMessages.first(where: { $0.serial == replySerial }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This and four lines above are unreadable, better to move them into Message extension method message.getReplyToSerial() or something.

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