Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 112 additions & 20 deletions sdk/ios/delivery-read-receipts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,47 @@ Starting v3, the messages will not be marked delivered internally by the SDK. Yo

</Note>

---

## Mark Conversation as Delivered

You can mark an entire conversation as delivered for a user or group using the `markConversationAsDelivered` method. This method takes the below parameters as input:

| Parameter | Information |
| ------------------ | ------------------------------------------------------------------------------ |
| `conversationWith` | The ID of the user (UID) or group (GUID) for the conversation. |
| `conversationType` | Type of the conversation. Could be either `user` or `group`. |
| `onSuccess` | The callback listener that will be called on success. |
| `onError` | The callback listener that will be called on error. |

This method will mark all messages in the conversation as delivered.

<Tabs>
<Tab title="Swift (User)">
```swift
CometChat.markConversationAsDelivered(conversationWithId: (conversation.conversationWith as? User)?.uid, receiverType: .user) { message in
print(message)
} onError: { error in
print(error.errorDescription)
}
```
</Tab>

<Tab title="Swift (Group)">
```swift
CometChat.markConversationAsDelivered(conversationWithId: (conversation.conversationWith as? Group)?.guid, receiverType: .group) { message in
print(message)
} onError: { error in
print(error.errorDescription)
}
```

</Tab>

</Tabs>

---

## Mark Messages as Read

*In other words, as a recipient, how do I inform the sender I've read a message?*
Expand Down Expand Up @@ -357,44 +398,95 @@ Starting v3, the `markAsRead()` method working with v2.x is deprecated and will

</Note>

---

## Mark Conversation as Read

You can mark an entire conversation as read for a user or group using the `markConversationAsRead` method. This method takes the below parameters as input:

| Parameter | Information |
| ------------------ | ------------------------------------------------------------------------------ |
| `conversationWith` | The ID of the user (UID) or group (GUID) for the conversation. |
| `conversationType` | Type of the conversation. Could be either `user` or `group`. |
| `onSuccess` | The callback listener that will be called on success. |
| `onError` | The callback listener that will be called on error. |

This method will mark all messages in the conversation as read.

<Tabs>
<Tab title="Swift (User)">
```swift
CometChat.markConversationAsRead(conversationWithId: (conversation.conversationWith as? User)?.uid, receiverType: .user) { message in
print(message)
} onError: { error in
print(error.errorDescription)
}
```

</Tab>

<Tab title="Swift (Group)">
```swift
CometChat.markConversationAsRead(conversationWithId: (conversation.conversationWith as? Group)?.guid, receiverType: .group) { message in
print(message)
} onError: { error in
print(error.errorDescription)
}
```

</Tab>

</Tabs>

---

## Mark Messages as Unread

The Mark as Unread feature allows users to designate specific messages or conversations as unread, even if they have been previously viewed.
The Mark message as Unread feature allows users to designate specific messages or conversations as unread, even if they have been previously viewed.

This feature is valuable for users who want to revisit and respond to important messages or conversations later, ensuring they don't forget or overlook them.

In other words, how I can mark message as unread?
In other words, how I can mark a message as unread?

You can mark the messages for a particular conversation as unread using the `markAsUnread()` method. This method takes the below parameters as input:
You can mark the messages for a particular conversation as unread using the `markMessageAsUnread` method. This method takes the below parameters as input:

| Field | Information |
| ------------------- | ----------------------------------------------- |
| conversationId | id of the conversation |
| conversationType | type of conversation (user/group) |
| lastMessage | last message in the conversation |
| conversationWith | User or Group object containing the details |
| unreadMessageCount | unread message count for the conversation |
| unreadMentionsCount | count of unread mentions in the conversation |
| lastReadMessageId | ID of the last read message in the conversation |
| Parameter | Information |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| message | To mark a message as unread, pass a non-null `BaseMessage` instance to the `markMessageAsUnread` function. All messages below that message in the conversation will contribute to the unread messages count. Example: When User B sends User A a total of 10 messages, and User A invokes the `markMessageAsUnread(baseMessage: BaseMessage, receiverType: CometChat.ReceiverType, onSuccess: (Conversation) -> Void, onError: (CometChatException?) -> ())` method on the fifth message, all messages located below the fifth message within the conversation list will be designated as unread. This results in a notification indicating there are 5 unread messages in the conversation list. |
| onSuccess | The callback listener that will be called on success. |
| onError | The callback listener that will be called on error. |

<Note>
You cannot mark your own messages as unread. This method only works for messages received from other users.
</Note>

<Tabs>
<Tab title="Swift">
<Tab title="Swift (User)">
```swift
let txt = TextMessage(receiverUid: "cometchat-uid-3", text: "this is unread count test", receiverType: .user)
txt.id = 3 // the message with id 3 will be marked unread. ID is required.
txt.sender = User(uid: "cometchat-uid-2", name: "George Alan")

CometChat.markAsUnread(baseMessage: txt) {
print("markAsUnread executed successfully: on message with ID: \(txt.id) and text \(txt.text)")
CometChat.markMessageAsUnread(baseMessage: message, receiverType: .user) { conversation in
print(conversation)
print(conversation.unreadMessageCount)
} onError: { error in
print("markAsUnread not executed error: \(error?.errorDescription)")
print(error?.errorDescription)
}
```

</Tab>
<Tab title="Swift (Group)">
```swift
CometChat.markMessageAsUnread(baseMessage: message, receiverType: .group) { conversation in
print(conversation)
print(conversation.unreadMessageCount)
} onError: { error in
print(error?.errorDescription)
}
```

</Tab>
</Tabs>

---

## Receive Delivery & Read Receipts

*In other words, as a recipient, how do I know when a message I sent has been delivered or read by someone?*
Expand Down
2 changes: 1 addition & 1 deletion sdk/ios/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ platform :ios, '12.0'
use_frameworks!

target 'YourApp' do
pod 'CometChatSDK', '4.0.72'
pod 'CometChatSDK', '4.0.73'
end
```

Expand Down
4 changes: 2 additions & 2 deletions sdk/ios/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ platform :ios, '11.0'
use_frameworks!

target 'MyApp' do
pod 'CometChatSDK', '4.0.72'
pod 'CometChatSDK', '4.0.73'
end
```

Expand Down Expand Up @@ -96,7 +96,7 @@ To install **Swift Packages** you can use Xcode package manager\*\*.\*\*
<img src="/images/fa786752-1634032671-f0fc1c00c9f33cca47875131228648cb.png" />
</Frame>

3. Once the pop-up appears, enter the github repository address in the search bar [`https://github.com/cometchat/chat-sdk-ios.git`](https://github.com/cometchat/chat-sdk-ios.git) and set dependency rule to `Up to Next Major Version` and set version as `4.0.72` . Then click on the **Add Package** button.
3. Once the pop-up appears, enter the github repository address in the search bar [`https://github.com/cometchat/chat-sdk-ios.git`](https://github.com/cometchat/chat-sdk-ios.git) and set dependency rule to `Up to Next Major Version` and set version as `4.0.73` . Then click on the **Add Package** button.

<Frame>
<img src="/images/edbea27b-nh6l7iltomtl4me5y6yzvupevalnh891fcoemppo30e6ijlc2boq1pxyanc6ujnt-438a8e2fee0f935ba81fc7ee14dc5ab7.png" />
Expand Down
14 changes: 14 additions & 0 deletions ui-kit/ios/core-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ CometChat's Read Receipts feature provides visibility into the message status, l
| [MessageList](/ui-kit/ios/message-list) | [MessageList](/ui-kit/ios/message-list) is a Component that renders different types of Message bubbles, Read Recept status is an integral part of all message bubbles, no matter the type, and provides real-time updates about the status of the message. |
| [MessageInformation](/ui-kit/ios/message-information) | [MessageInformation](/ui-kit/ios/message-information) component provides transparency into the status of each sent message, giving the sender insights into whether their message has been delivered and read. |


## Mark As Unread

Mark as Unread feature allows users to manually mark messages as unread, helping them keep track of important conversations they want to revisit later. When enabled, the message list can automatically start from the first unread message, making it easier to pick up where you left off.

<Frame>
<img src="/images/mark-as-unread.png" />
</Frame>

| Components | Functionality |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Message List](/ui-kit/android/message-list) | [Message List](/ui-kit/android/message-list) provides the "Mark as unread" option in message actions and supports starting from the first unread message when enabled. |
| [Conversations](/ui-kit/android/conversations) | [Conversations](/ui-kit/android/conversations) component listens to conversation updates and reflects the updated unread count in real-time. |

## Typing Indicator

The Typing Indicator feature in CometChat shows when a user is typing a response in real-time, fostering a more interactive and engaging chat environment. This feature enhances the real-time communication experience, making conversations feel more natural and fluid.
Expand Down
42 changes: 16 additions & 26 deletions ui-kit/ios/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,10 @@ extension ViewController: CometChatGroupEventListener {

CometChatConversationEvents emits events when the logged-in user executes some action on a conversation object

It contains the following properties and methods
It contains the following properties and methods:

* `ccConversationDeleted`: Triggered when the logged-in user deletes a conversation.
* `ccUpdateConversation`: Triggered when there is an update in the conversation.

### observer

Expand Down Expand Up @@ -734,22 +737,6 @@ removeListener(_ id: String)

***

### onConversationDelete

This method is used to perform some task when the logged-in user has deleted a conversation

### Signature

<Tabs>
<Tab title="Swift">
```swift
onConversationDelete(conversation: Conversation)
```

</Tab>

</Tabs>

### Parameters

| Parameters | Type | Description |
Expand All @@ -766,7 +753,8 @@ Here we will go through how to emit events specific to the UI Kit which listens
<Tab title="Swift">
```swift
//pass the conversation object you want to delete
CometChatConversationEvents.emitConversationDelete(conversation: Conversation)
CometChatConversationEvents.ccConversationDelete(conversation: Conversation)
CometChatConversationEvents.ccUpdateConversation(conversation: Conversation)
```

</Tab>
Expand All @@ -782,13 +770,14 @@ Here we will go through how anyone can listen to these client-side Conversation
| Event | Description |
| ---------------------- | --------------------------------------------------------------------------- |
| `onConversationDelete` | This event will be triggered when the logged in user deletes a conversation |
| `ccUpdateConversation` | This event will be triggered when the logged in user updates a conversation |


<Tabs>
<Tab title="Swift">
```swift
// View controller from your project where you want to listen events.
public class ViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()

Expand All @@ -800,17 +789,18 @@ public class ViewController: UIViewController {
// Uncubscribing for the listener to listen events from conversation module
CometChatConversationEvents.removeListener("LISTENER_ID_USED_FOR_ADDING_THIS_LISTENER")
}


}

// Listener events from conversation module
extension ViewController: CometChatConversationEventListener {

func onConversationDelete(conversation: Conversation) {
// Do Stuff
extension ViewController: CometChatConversationEventListener {

func ccConversationDeleted(conversation: Conversation) {
// Do stuff
}

func ccUpdateConversation(conversation: Conversation) {
// Do stuff
}

}
```

Expand Down
Loading