Skip to content

Conversation

@sacOO7
Copy link
Contributor

@sacOO7 sacOO7 commented Jan 14, 2026

Summary by CodeRabbit

  • Documentation
    • Updated API parameter naming for chat history queries.
    • Added extensive multi-language examples (Swift, Kotlin, Jetpack Compose, JS) for media attachment, validation, display, and add/remove flows.
    • Expanded examples for sending/removing reactions across languages and improved reaction examples.
    • Added multi-language examples for composing, sending, fetching, and displaying message replies.
    • Clarified end-of-pagination handling in docs.

✏️ 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 multi-language examples for media sharing, message replies, and reactions in chat docs, and corrects a Swift API parameter label in the message history examples from withOptions to withParams.

Changes

Cohort / File(s) Summary
API Parameter Update
src/pages/docs/chat/rooms/history.mdx
Swift example updated to call history(withParams: instead of history(withOptions:). Added explicit end-of-pagination branch.
Media Documentation Examples
src/pages/docs/chat/rooms/media.mdx
Large addition of multi-language examples (Swift, Kotlin, Jetpack Compose, Kotlin Multiplatform, JS/React): upload/attach/send media flows, MediaData examples, get/validate media helpers, UI display snippets, add/remove media mutation examples, and warnings about untrusted metadata.
Message Reactions Examples
src/pages/docs/chat/rooms/message-reactions.mdx
Updated Swift/Kotlin examples: use name parameter, try await where applicable, introduced deletion examples (remove reactions) and adjusted reaction types/usage.
Message Replies Examples
src/pages/docs/chat/rooms/replies.mdx
Added Swift, Kotlin, and Jetpack Compose examples for prepare/send reply flows, fetch parent message, and display reply metadata (serial, clientId, previewText). Several helper functions and composables added in examples.

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 Title clearly and specifically summarizes the PR's main change: adding missing Kotlin, Swift, and Jetpack documentation for chat modules.
Linked Issues check ✅ Passed All coding objectives from FTF-481 are met: Kotlin/Swift docs added to media.mdx and replies.mdx, and other chat sections audited and updated.
Out of Scope Changes check ✅ Passed All changes are directly scoped to FTF-481: documentation updates for media, replies, reactions, and history call patterns align with the issue's requirements.
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
- Fixed method signatures of jetpack compose extensions
- Removed jetpack alias reference to kotlin, instead will use native jetpack icon
- Updated ably/ui to jetpack compatible latest version
@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.

@sacOO7 sacOO7 force-pushed the fix/missing-chat-documentation branch from bef8be6 to a6181a1 Compare January 15, 2026 14:39
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 15, 2026 14:39 Inactive
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

@sacOO7 sacOO7 force-pushed the feature/chat-jetpack-compose-docs branch from 659f155 to 507bc43 Compare January 16, 2026 17:55
Copy link
Contributor

@ttypic ttypic left a comment

Choose a reason for hiding this comment

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

Overall kotlin/jetpack parts looks good, I added couple of minor suggestions, the only major thing is we can drop suspend from uploadMedia

Copy link
Contributor

@ttypic ttypic left a comment

Choose a reason for hiding this comment

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

On second thought, I approve because uploadMedia should be suspended if it's not mocked (hopefully LLMs won't pick it as right way to build jsons)

@ably-ci ably-ci had a problem deploying to ably-docs-fix-missing-c-jxfsyj January 20, 2026 14:28 Failure
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 20, 2026 14:53 Inactive
@sacOO7
Copy link
Contributor Author

sacOO7 commented Jan 20, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 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: 2

🤖 Fix all issues with AI agents
In `@src/pages/docs/chat/rooms/message-reactions.mdx`:
- Around line 649-652: The snippet calls the throwing async method
room.messages.history(withParams:) without using the try keyword; update the
initialization of messages to use try await (e.g., var messages = try await
room.messages.history(withParams: .init(limit: 50))). Ensure this is inside an
async context and handle or propagate the potential error (using do/catch or
marking the enclosing function as throws) so the code compiles.

In `@src/pages/docs/chat/rooms/replies.mdx`:
- Around line 339-440: The Swift snippet uses the old callback-based
room.messages.subscribe { event in ... } pattern; update it to the async/await
API by calling try await room.messages.subscribe() to get a
messagesSubscription, then iterate with for await inside a Task to process each
Message (use the existing Message extension properties replySerial and
replyPreview), keep the same reply handling logic and append to localMessages
within the Task, and ensure you cancel/unsubscribe the messagesSubscription
where appropriate.
♻️ Duplicate comments (1)
src/pages/docs/chat/rooms/replies.mdx (1)

36-49: Align reply metadata key to timestamp across languages.
Swift/Kotlin/Jetpack use reply.timestamp while the React examples still store createdAt, which breaks cross‑platform consistency. Also confirm Kotlin Message.timestamp is already epoch ms (convert if needed).

✏️ Suggested alignment
-    createdAt: messageToReplyTo.createdAt.getTime(),
+    timestamp: messageToReplyTo.createdAt.getTime(),
-    createdAt: parentMessage.createdAt.getTime(),
+    timestamp: parentMessage.createdAt.getTime(),
Ably Chat Kotlin Message timestamp units milliseconds

Also applies to: 66-102, 161-169, 172-204

Comment on lines 649 to 652
```swift
// init messages, in practice this should be updated with a message subscription
var messages = (await room.messages.history(withOptions: .init(limit: 50))).items
var messages = (await room.messages.history(withParams: .init(limit: 50))).items

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Ably Chat Swift messages.history throws API documentation

💡 Result:

Use the Chat docs — message history in the Swift SDK is accessed via the room message APIs (e.g. call historyBeforeSubscribe on a messages subscription to fetch prior messages). See Ably Chat Swift docs for examples and the API reference for the Chat SDK. (ably.com)

Citations:


🌐 Web query:

Ably Chat Swift API reference history method throws

💡 Result:

Short answer: history/historyBeforeSubscribe in Ably’s Swift Chat API is an async throwing call — it uses Swift concurrency and can throw network/permission/continuity errors, so you must call it with try/await and handle errors (e.g. missing history capability, channel not persisted, continuity/connection interruptions). See examples and error notes in the docs and FAQ:

  • Example using try await and catch in the Swift Chat guide. [1]
  • Notes that calls wait for continuity and may be affected by discontinuity. [2]
  • History/persistence must be enabled (and your key/token must have history capability); lack of persistence or permissions will cause errors. [3]

If you want, paste the exact error message you see and I’ll point to the precise cause and fix.

Sources:
[1] Ably Chat — Getting started: Chat with Swift (example using try await subscription.historyBeforeSubscribe).
[2] MessageSubscription / historyBeforeSubscribe docs (continuity behaviour).
[3] Ably FAQ — How do I enable history / message persistence.


🏁 Script executed:

cat -n src/pages/docs/chat/rooms/message-reactions.mdx | sed -n '645,660p'

Repository: ably/docs

Length of output: 162


Swift history call must use try keyword.
The history(withParams:) method is an async throwing call in Ably's Swift Chat API and can throw errors for network issues, missing permissions, or continuity problems. The code snippet must use try await to compile correctly.

🐛 Proposed fix
-var messages = (await room.messages.history(withParams: .init(limit: 50))).items
+var messages = (try await room.messages.history(withParams: .init(limit: 50))).items
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```swift
// init messages, in practice this should be updated with a message subscription
var messages = (await room.messages.history(withOptions: .init(limit: 50))).items
var messages = (await room.messages.history(withParams: .init(limit: 50))).items
🤖 Prompt for AI Agents
In `@src/pages/docs/chat/rooms/message-reactions.mdx` around lines 649 - 652, The
snippet calls the throwing async method room.messages.history(withParams:)
without using the try keyword; update the initialization of messages to use try
await (e.g., var messages = try await room.messages.history(withParams:
.init(limit: 50))). Ensure this is inside an async context and handle or
propagate the potential error (using do/catch or marking the enclosing function
as throws) so the code compiles.

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.

Minor suggestions re xcode unused result and ForEach iterator, which are better to be fixed before merge (check all sends/updates for unused results).

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 4 out of 4 changed files in this pull request and generated no new comments.


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

@sacOO7 sacOO7 force-pushed the fix/missing-chat-documentation branch from c959151 to efefab5 Compare January 21, 2026 08:45
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 21, 2026 08:45 Inactive
@sacOO7 sacOO7 force-pushed the feature/chat-jetpack-compose-docs branch from 507bc43 to 1d9d74d Compare January 21, 2026 08:54
Base automatically changed from feature/chat-jetpack-compose-docs to main January 21, 2026 09:02
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 21, 2026 09:06 Inactive
# Conflicts:
#	src/data/languages/languageData.ts
#	src/pages/docs/chat/connect.mdx
#	src/pages/docs/chat/rooms/history.mdx
#	src/pages/docs/chat/rooms/index.mdx
#	src/pages/docs/chat/rooms/message-reactions.mdx
#	src/pages/docs/chat/rooms/messages.mdx
#	src/pages/docs/chat/rooms/occupancy.mdx
#	src/pages/docs/chat/rooms/presence.mdx
#	src/pages/docs/chat/rooms/typing.mdx
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 21, 2026 16:48 Inactive
@ably-ci ably-ci temporarily deployed to ably-docs-fix-missing-c-jxfsyj January 23, 2026 12:44 Inactive
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.

6 participants