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

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
var mediaToAttach = mutableListOf<MediaData>()

suspend fun onMediaAttach() {
val mediaData = uploadMedia()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems need to add uploadMedia method for all other platforms

@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.

Comment on lines +66 to +99
```swift
func sendReply(replyToMessage: Message, replyText: String) async throws {
let metadata: MessageMetadata = [
"reply": .object([
"serial": .string(replyToMessage.serial),
"timestamp": .number(Double(replyToMessage.timestamp.timeIntervalSince1970 * 1000)),
"clientId": .string(replyToMessage.clientID),
"previewText": .string(String(replyToMessage.text.prefix(140)))
])
]

try await room.messages.send(params: .init(
text: replyText,
metadata: metadata
))
}
```

```kotlin
suspend fun sendReply(replyToMessage: Message, replyText: String) {
val metadata = buildJsonObject {
put("reply", buildJsonObject {
put("serial", replyToMessage.serial)
put("timestamp", replyToMessage.timestamp)
put("clientId", replyToMessage.clientId)
put("previewText", replyToMessage.text.take(140))
})
}

room.messages.send(
text = replyText,
metadata = metadata
)
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's check the file exists and get its size
wc -l src/pages/docs/chat/rooms/replies.mdx

Repository: ably/docs

Length of output: 94


🏁 Script executed:

# Read the relevant sections of the file to verify timestamp field names
# Check around line 23 (JS timestamp), line 46 (React createdAt), line 71 (Swift timestamp), line 89 (Kotlin timestamp)
sed -n '1,50p' src/pages/docs/chat/rooms/replies.mdx | cat -n

Repository: ably/docs

Length of output: 2015


🏁 Script executed:

# Continue reading from line 50 onwards to capture lines 66-99 mentioned in the review
sed -n '50,110p' src/pages/docs/chat/rooms/replies.mdx | cat -n

Repository: ably/docs

Length of output: 1996


🏁 Script executed:

# Search for other references to Message.timestamp or timestamp handling in the docs
rg "timestamp|createdAt" src/pages/docs/chat/rooms/ -A 2 -B 2 | head -100

Repository: ably/docs

Length of output: 8933


🏁 Script executed:

# Check if there's any clarification about timestamp format (milliseconds) in the messages documentation
cat src/pages/docs/chat/rooms/messages.mdx | grep -A 5 -B 5 "timestamp\|millisecond" | head -80

Repository: ably/docs

Length of output: 4572


Fix React example to use timestamp instead of createdAt for metadata field consistency.

The React example uses createdAt as the reply metadata field name, while JavaScript, Swift, and Kotlin all use timestamp. This inconsistency across all language examples will cause issues for developers implementing cross-platform reply functionality. Update the React example at line 46 to match the field name used in other languages.

Additionally, verify that the Kotlin example's replyToMessage.timestamp is already in milliseconds to match the explicit conversion used in Swift (timeIntervalSince1970 * 1000).

🤖 Prompt for AI Agents
In `@src/pages/docs/chat/rooms/replies.mdx` around lines 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants