Skip to content

Commit cd0dc74

Browse files
authored
Merge pull request #3098 from ably/fix/missing-chat-documentation
chat docs: fix missing chat kotlin/swift/jetpack doc
2 parents 61c2a21 + 234a388 commit cd0dc74

14 files changed

Lines changed: 929 additions & 56 deletions

File tree

src/pages/docs/chat/getting-started/react-native.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ You can also use the Ably CLI to enter the room from another client by running t
824824
## Step 9: Send a reaction <a id="step-9"/>
825825

826826
Clients can send a reaction to a room to show their sentiment for what is happening, such as a point being scored in a sports game.
827-
Ably Chat provides a [`useReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.
827+
Ably Chat provides a [`useRoomReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useRoomReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.
828828

829829
In your `ChatApp.tsx` file, add a new component called `ReactionComponent`, like so:
830830

src/pages/docs/chat/getting-started/react.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ You can also use the Ably CLI to enter the room from another client by running t
783783
## Step 9: Send a room reaction <a id="step-9"/>
784784

785785
Clients can send a reaction to a room to show their sentiment for what is happening, such as a point being scored in a sports game.
786-
Ably Chat provides a [`useReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.
786+
Ably Chat provides a [`useRoomReactions()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/functions/chat-react.useRoomReactions.html) hook to send and receive reactions in a room. These are short-lived (ephemeral) and are not stored in the room history.
787787

788788
In your `src/App.tsx` file, add a new component called `ReactionComponent`, like so:
789789

src/pages/docs/chat/getting-started/swift.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ struct ContentView: View {
345345
guard !newMessage.isEmpty, let room = room else { return }
346346

347347
do {
348-
_ = try await room.messages.send(params: .init(text: newMessage))
348+
_ = try await room.messages.send(withParams: .init(text: newMessage))
349349
newMessage = ""
350350
} catch {
351351
print("Failed to send message: \(error)")
@@ -480,7 +480,7 @@ struct ContentView: View {
480480
guard !newMessage.isEmpty, let room = room else { return }
481481

482482
do {
483-
_ = try await room.messages.send(params: .init(text: newMessage))
483+
_ = try await room.messages.send(withParams: .init(text: newMessage))
484484
newMessage = ""
485485
} catch {
486486
print("Failed to send message: \(error)")
@@ -492,7 +492,7 @@ struct ContentView: View {
492492

493493
do {
494494
let updateMessageParams = UpdateMessageParams(text: newMessage)
495-
_ = try await room.messages.update(withSerial: editingMessage.serial params: updateMessageParams, details: nil)
495+
_ = try await room.messages.update(withSerial: editingMessage.serial, params: updateMessageParams, details: nil)
496496
self.editingMessage = nil
497497
newMessage = ""
498498
} catch {
@@ -840,7 +840,7 @@ struct ContentView: View {
840840
guard let room = room else { return }
841841

842842
do {
843-
try await room.reactions.send(params: .init(name: name))
843+
try await room.reactions.send(withParams: .init(name: name))
844844
} catch {
845845
print("Failed to send reaction: \(error)")
846846
}

src/pages/docs/chat/react-ui-kit/components.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,11 @@ import { MessageInput } from '@ably/chat-react-ui-kit';
303303
import { useMessages } from '@ably/chat/react';
304304
305305
// Basic usage
306-
const { send } = useMessages();
306+
const { sendMessage } = useMessages();
307307
308308
const handleSendMessage = (text: string) => {
309309
console.log(`Sending message: ${text}`);
310-
send({ text });
310+
sendMessage({ text });
311311
};
312312
313313
<MessageInput
@@ -532,25 +532,25 @@ import { ChatMessage } from '@ably/chat-react-ui-kit';
532532
import { Message } from '@ably/chat';
533533
import { useMessages } from '@ably/chat/react';
534534
535-
const { update, deleteMessage, addReaction, removeReaction } = useMessages();
535+
const { updateMessage, deleteMessage, sendReaction, deleteReaction } = useMessages();
536536
537537
<ChatMessage
538538
message={message}
539539
onEdit={(message: Message, newText: string) => {
540540
console.log(`Editing message with serial: ${message.serial}, setting text to: ${newText}`);
541-
update(message.serial, { text: newText });
541+
updateMessage(message.serial, { text: newText });
542542
}}
543543
onDelete={(message: Message) => {
544544
console.log(`Deleting message with serial: ${message.serial}`);
545545
deleteMessage(message.serial);
546546
}}
547547
onReactionAdd={(message: Message, emoji: string) => {
548548
console.log(`Adding reaction ${emoji} to message with serial: ${message.serial}`);
549-
addReaction(message.serial, emoji);
549+
sendReaction(message.serial, { name: emoji });
550550
}}
551551
onReactionRemove={(message: Message, emoji: string) => {
552552
console.log(`Removing reaction ${emoji} from message with serial: ${message.serial}`);
553-
removeReaction(message.serial, emoji);
553+
deleteReaction(message.serial, { name: emoji });
554554
}}
555555
/>
556556
```

src/pages/docs/chat/rooms/history.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const MyComponent = () => {
5050
```
5151

5252
```swift
53-
let paginatedResult = try await room.messages.history(withOptions: .init(orderBy: .newestFirst))
53+
let paginatedResult = try await room.messages.history(withParams: .init(orderBy: .newestFirst))
5454
print(paginatedResult.items)
5555
if let next = try await paginatedResult.next {
5656
print(next.items)

src/pages/docs/chat/rooms/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const room = await chatClient.rooms.get('basketball-stream', options);
104104
```
105105

106106
```swift
107-
let presence = PresenceOptions(enter: false)
107+
let presence = PresenceOptions(enableEvents: false)
108108
let typing = TypingOptions(heartbeatThrottle: 5.0) // seconds
109109
// using defaults for reactions and occupancy
110110
let options = RoomOptions(presence: presence, typing: typing, occupancy: .init())

0 commit comments

Comments
 (0)