diff --git a/sdk/ios/delivery-read-receipts.mdx b/sdk/ios/delivery-read-receipts.mdx index 2b7c536f..954a85e6 100644 --- a/sdk/ios/delivery-read-receipts.mdx +++ b/sdk/ios/delivery-read-receipts.mdx @@ -175,6 +175,47 @@ Starting v3, the messages will not be marked delivered internally by the SDK. Yo +--- + +## 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. + + + +```swift +CometChat.markConversationAsDelivered(conversationWithId: (conversation.conversationWith as? User)?.uid, receiverType: .user) { message in + print(message) +} onError: { error in + print(error.errorDescription) +} +``` + + + +```swift +CometChat.markConversationAsDelivered(conversationWithId: (conversation.conversationWith as? Group)?.guid, receiverType: .group) { message in + print(message) +} onError: { error in + print(error.errorDescription) +} +``` + + + + + +--- + ## Mark Messages as Read *In other words, as a recipient, how do I inform the sender I've read a message?* @@ -357,44 +398,95 @@ Starting v3, the `markAsRead()` method working with v2.x is deprecated and will +--- + +## 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. + + + +```swift +CometChat.markConversationAsRead(conversationWithId: (conversation.conversationWith as? User)?.uid, receiverType: .user) { message in + print(message) +} onError: { error in + print(error.errorDescription) +} +``` + + + + +```swift +CometChat.markConversationAsRead(conversationWithId: (conversation.conversationWith as? Group)?.guid, receiverType: .group) { message in + print(message) +} onError: { error in + print(error.errorDescription) +} +``` + + + + + +--- + ## 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. | + + +You cannot mark your own messages as unread. This method only works for messages received from other users. + - + ```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) } ``` + +```swift +CometChat.markMessageAsUnread(baseMessage: message, receiverType: .group) { conversation in + print(conversation) + print(conversation.unreadMessageCount) +} onError: { error in + print(error?.errorDescription) +} +``` + +--- + ## 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?* diff --git a/sdk/ios/overview.mdx b/sdk/ios/overview.mdx index 8143f370..d524723c 100644 --- a/sdk/ios/overview.mdx +++ b/sdk/ios/overview.mdx @@ -75,7 +75,7 @@ platform :ios, '12.0' use_frameworks! target 'YourApp' do - pod 'CometChatSDK', '4.0.72' + pod 'CometChatSDK', '4.0.73' end ``` diff --git a/sdk/ios/setup.mdx b/sdk/ios/setup.mdx index 1e70703a..71ff8164 100644 --- a/sdk/ios/setup.mdx +++ b/sdk/ios/setup.mdx @@ -53,7 +53,7 @@ platform :ios, '11.0' use_frameworks! target 'MyApp' do - pod 'CometChatSDK', '4.0.72' + pod 'CometChatSDK', '4.0.73' end ``` @@ -96,7 +96,7 @@ To install **Swift Packages** you can use Xcode package manager\*\*.\*\* -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.