From 4322081bb3ca52781ebd601fdce200b9bd7ab94a Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Fri, 11 Oct 2024 18:12:37 +0800 Subject: [PATCH 1/8] modify --- .../agora_chat_send_receive_message_android.md | 2 -- .../agora_chat_send_receive_message_flutter.md | 5 ++--- .../agora_chat_send_receive_message_ios.md | 18 ++++++++---------- .../agora_chat_send_receive_message_rn.md | 5 ++--- .../agora_chat_send_receive_message_unity.md | 17 +++++++---------- .../agora_chat_send_receive_message_web.md | 6 +++--- .../agora_chat_send_receive_message_windows.md | 2 -- 7 files changed, 22 insertions(+), 33 deletions(-) diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md index bfc8dbed63a..eabec0f712b 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md @@ -344,8 +344,6 @@ MessageListener msgListener = new MessageListener() ### Send a customized message -Custom messages are self-defined key-value pairs that include the message type and the message content. - The following code example shows how to create and send a customized message: ```java diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_flutter.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_flutter.md index bba9eebc1a8..7e283ece55d 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_flutter.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_flutter.md @@ -3,7 +3,6 @@ After logging in to Agora Chat, users can send the following types of messages t - Attachment messages, including image, voice, video, and file messages. - Location messages. - CMD messages. -- Extended messages. - Custom messages. In high-concurrency scenarios, you can set a certain message type or messages from a chat room member as high, normal, or low. In this case, low-priority messages are dropped first to reserve resources for the high-priority ones (e.g. gifts and announcements) when the server is overloaded. This ensures that the high-priority messages can be dealt with first when loads of messages are being sent in high concurrency or high frequency. Note that this feature can increase the delivery reliability of high-priority messages, but cannot guarantee the deliveries. Even high-priorities messages can be dropped when the server load goes too high. @@ -89,7 +88,7 @@ ChatMessage fileMsg = ChatMessage.createFileSendMessage( fileSize: fileSize, ); // Creates a location message. You need to set the longitude and latitude information of the location, as well as the name of the location. -// To send a location message, you need to integrate a third-party map service provider to get the longitude and latitude information of the location. When the recipient receives the location information, the service provider renders the location on the map according to the longitude and latitude information. +// To send a location message, you need to integrate a third-party map service to get the longitude and latitude information of the location. When the recipient receives the location information, the service renders the location on the map according to the longitude and latitude information. double latitude = 114.78; double longitude = 39.89; String address = "darwin"; @@ -201,7 +200,7 @@ When a voice message is received, the SDK automatically downloads the audio file For image and video messages, the SDK automatically generates a thumbnail when you create the message. When an image or video message is received, the SDK automatically downloads the thumbnail. To manually download the attachment files, follow the steps: -1. Set `isAutoDownloadThumbnail` as true when initializing the SDK. +1. Set `isAutoDownloadThumbnail` as `false` when initializing the SDK. ```dart ChatOptions options = ChatOptions( diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_ios.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_ios.md index 4f3bbfa85b1..80b603bec94 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_ios.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_ios.md @@ -170,7 +170,7 @@ AgoraChatMessage *message = [[AgoraChatMessage alloc] initWithConversationID:toC body:body ext:messageExt]; message.chatType = AgoraChatTypeChat; -// Set the chat type as Group chat. You can also set is as chat (one-to-one chat) or chat room. +// Set the chat type as Group chat. You can also set it as chat (one-to-one chat) or chat room. // message.chatType = AgoraChatTypeGroupChat; // Sends the message [[AgoraChatClient sharedClient].chatManager sendMessage:message @@ -212,7 +212,7 @@ AgoraChatMessage *message = [[AgoraChatMessage alloc] initWithConversationID:toC body:body ext:messageExt]; message.chatType = AgoraChatTypeChat; -// Set the chat type as Group chat. You can also set is as chat (one-to-one chat) or chat room. +// Set the chat type as Group chat. You can also set it as chat (one-to-one chat) or chat room. // message.chatType = AgoraChatTypeGroupChat; // Sends the message [[AgoraChatClient sharedClient].chatManager sendMessage:message @@ -235,7 +235,7 @@ NSString *remotePath = body.remotePath; NSString *thumbnailPath = body.thumbnailRemotePath; // Retrieves the path of the video file on the local device. NSString *localPath = body.localPath; -// Retrieves the thumbnail of the video file on the local deivce. +// Retrieves the thumbnail of the video file on the local device. NSString *thumbnailLocalPath = body.thumbnailLocalPath; ``` @@ -245,7 +245,7 @@ Refer to the following code example to create, send, and receive a file message: ```objective-c // Set fileData as the path of the file on the local device, and fileName the display name of the attachment file. -AgoraChatFileMessageBody *body = [[AgoraChatFileMessageBody initWithData:fileData +AgoraChatFileMessageBody *body = [AgoraChatFileMessageBody initWithData:fileData displayName:fileName]; AgoraChatMessage *message = [[AgoraChatMessage alloc] initWithConversationID:toChatUsername from:fromChatUsername @@ -253,7 +253,7 @@ AgoraChatMessage *message = [[AgoraChatMessage alloc] initWithConversationID:toC body:body ext:messageExt]; message.chatType = AgoraChatTypeChat; -// Set the chat type as Group chat. You can also set is as chat (one-to-one chat) or chat room. +// Set the chat type as Group chat. You can also set it as chat (one-to-one chat) or chat room. // message.chatType = AgoraChatTypeGroupChat; // Sends the message [[AgoraChatClient sharedClient].chatManager sendMessage:message @@ -294,7 +294,7 @@ AgoraChatMessage *message = [[AgoraChatMessage alloc] initWithConversationID:toC body:body ext:messageExt]; message.chatType = AgoraChatTypeChat; -// Set the chat type as Group chat. You can also set is as chat (one-to-one chat) or chat room. +// Set the chat type as Group chat. You can also set it as chat (one-to-one chat) or chat room. // message.chatType = AgoraChatTypeGroupChat; // Sends the message [[AgoraChatClient sharedClient].chatManager sendMessage:message @@ -317,7 +317,7 @@ AgoraChatMessage *message = [[AgoraChatMessage alloc] initWithConversationID:toC body:body ext:messageExt]; message.chatType = AgoraChatTypeChat; -// Set the chat type as Group chat. You can also set is as chat (one-to-one chat) or chat room. +// Set the chat type as Group chat. You can also set it as chat (one-to-one chat) or chat room. // message.chatType = AgoraChatTypeGroupChat; // Sends the message [[AgoraChatClient sharedClient].chatManager sendMessage:message @@ -325,7 +325,7 @@ message.chatType = AgoraChatTypeChat; completion:nil]; ``` -To notify the recipient that a CMD message is received, use a seperate delegate so that users can deal with the message differently. +To notify the recipient that a CMD message is received, use a separate delegate so that users can deal with the message differently. ```objective-c // Occurs when the CMD message is received. @@ -339,8 +339,6 @@ To notify the recipient that a CMD message is received, use a seperate delegate ### Send a customized message -Custom messages are self-defined key-value pairs that include the message type and the message content. - The following code example shows how to create and send a customized message: ```objective-c diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_rn.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_rn.md index e0b92aac6c3..8b1ee7024fb 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_rn.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_rn.md @@ -3,7 +3,6 @@ After logging in to Agora Chat, users can send the following types of messages t - Attachment messages, including image, voice, video, and file messages. - Location messages. - CMD messages. -- Extended messages. - Custom messages. In high-concurrency scenarios, you can set a certain message type or messages from a chat room member as high, normal, or low. In this case, low-priority messages are dropped first to reserve resources for the high-priority ones (e.g. gifts and announcements) when the server is overloaded. This ensures that the high-priority messages can be dealt with first when loads of messages are being sent in high concurrency or high frequency. Note that this feature can increase the delivery reliability of high-priority messages, but cannot guarantee the deliveries. Even high-priorities messages can be dropped when the server load goes too high. @@ -12,7 +11,7 @@ This page shows how to implement sending and receiving these messages using the ## Understand the tech -The Agora Chat SDK uses the `ChatMessage` and `ChatMessage` classes to send, receive, and withdraw messages. +The Agora Chat SDK uses the `ChatManager` and `ChatMessage` classes to send, receive, and withdraw messages. The process of sending and receiving a message is as follows: @@ -206,7 +205,7 @@ class ChatMessageEvent implements ChatMessageEventListener { console.log(`onConversationRead: `, from, to); } } -// Listen for the mesage event. +// Listen for the message event. const listener = new ChatMessageEvent(); ChatClient.getInstance().chatManager.addMessageListener(listener); // Remove the specified message listener. diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_unity.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_unity.md index 3cff075f22d..2de78cc1465 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_unity.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_unity.md @@ -3,7 +3,6 @@ After logging in to Agora Chat, users can send the following types of messages t - Attachment messages, including image, voice, video, and file messages. - Location messages. - CMD messages. -- Extended messages. - Custom messages. In high-concurrency scenarios, you can set a certain message type or messages from a chat room member as high, normal, or low. In this case, low-priority messages are dropped first to reserve resources for the high-priority ones (e.g. gifts and announcements) when the server is overloaded. This ensures that the high-priority messages can be dealt with first when loads of messages are being sent in high concurrency or high frequency. Note that this feature can increase the delivery reliability of high-priority messages, but cannot guarantee the deliveries. Even high-priorities messages can be dropped when the server load goes too high. @@ -18,7 +17,7 @@ The process of sending and receiving a message is as follows: 1. The message sender creates a text, file, or attachment message using the corresponding `Create` method. 2. The message sender calls `SendMessage` to send the message. -3. The message recipient calls `AddChatManagerDelegate` to listens for message events and receives the message in the `OnMessageReceived` callback. +3. The message recipient calls `AddChatManagerDelegate` to listen for message events and receive the message in the `OnMessageReceived` callback. ## Prerequistes @@ -42,7 +41,7 @@ Message msg = Message.CreateTextSendMessage(conversationId, content); // Set `MessageType` in `Message` as `Chat`, `Group`, or `Room` for one-to-one chat, group chat, or room chat. msg.MessageType = MessageType.Group; -// Set the priority of chat room messages. The default priority is `Normal`, indicating the normal priority. +// Set the priority of chat room messages. The default priority is `RoomMessagePriority.Normal`, indicating the normal priority. // msg.MessageType = MessageType.Room; // msg.SetRoomMessagePriority(RoomMessagePriority.High); @@ -113,7 +112,7 @@ void OnMessagesRecalled(List messages); ### Send and receive an attachment message -Voice, image, video, and file messages are issentially attachment messages. This section introduces how to send these types of messages. +Voice, image, video, and file messages are essentially attachment messages. This section introduces how to send these types of messages. #### Send and receive a voice message @@ -163,14 +162,14 @@ else { #### Send and receive an image message -By default, the SDK compresses the image file before sending it. To send the originial file, you can set `original` as `true`. +By default, the SDK compresses the image file before sending it. To send the original file, you can set `original` as `true`. Refer to the following code example to create and send an image message: ```C# // Create SendMessage to send the image message. // Set `localPath` as the path of the image file on the local device, `displayName` as the display name of the message, `fileSize` as the size of the image file, `width` as the width (in pixels) of the thumbnail, and `height` as the height (in pixels) of the thumbnail. -// `orignial` indicates whether to send the original image file. The default value is `false`. By default, the SDK compresses image files the exceeds 100 KB and sends the thumbnail. To send the originial image, set this parameter as `true`. +// `original` indicates whether to send the original image file. The default value is `false`. By default, the SDK compresses image files that exceeds 100 KB and sends the thumbnail. To send the original image, set this parameter as `true`. Message msg = Message.CreateImageSendMessage(toChatUsername,localPath, displayName, fileSize, original, width , height); // Set the message type using the `MessageType` attribute in `Message`. // You can set `MessageType` as `Chat`, `Group`, or `Room`, which indicates whether to send the message to a peer user, a chat group, or a chat room. @@ -244,7 +243,7 @@ If you do not want the SDK to automatically download the video thumbnail, set `O To download the actual video file, call `SDKClient.Instance.ChatManager.DownloadAttachment`, and get the path of the video file from the `LocalPath` member in `msg.Body`. ```C# -// When the recipent receives a video message, the SDK downloads and then open the video file. +// When the recipient receives a video message, the SDK downloads and then open the video file. SDKClient.Instance.ChatManager.DownloadAttachment("Message ID", new CallBack( onSuccess: () => { Debug.Log($"Attachment download succeeds."); @@ -350,7 +349,7 @@ SDKClient.Instance.ChatManager.SendMessage(ref msg, new CallBack( )); ``` -To notify the recipient that a CMD message is received, use a seperate delegate so that users can deal with the message differently. +To notify the recipient that a CMD message is received, use a separate delegate so that users can deal with the message differently. ```C# // Inherit and instantiate `IChatManagerDelegate`. @@ -373,8 +372,6 @@ SDKClient.Instance.ChatManager.AddChatManagerDelegate(adelegate); ### Send a customized message -Custom messages are self-defined key-value pairs that include the message type and the message content. - The following code example shows how to create and send a customized message: ```C# diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_web.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_web.md index 22b21ef782d..61856382f8e 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_web.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_web.md @@ -92,9 +92,9 @@ When a message arrives, the recipient receives an `onXXXMessage` callback. Each // Use `addEventHandler` to listen for callback events. connection.addEventHandler("eventName",{ // Occurs when the app is connected. - onOpened: function (message) {}, + onConnected: function (message) {}, // Occurs when the connection is lost. - onClosed: function (message) {}, + onDisconnected: function (message) {}, // Occurs when the text message is received. onTextMessage: function (message) {}, // Occurs when the image message is received. @@ -174,7 +174,7 @@ connection.addEventHandler('MESSAGES',{ Voice, image, video, and file messages are essentially attachment messages. When sending an attachment message, the SDK takes the following steps: -1. Uploads the attachment to the server and gets the information of the attachment file on the server +1. Uploads the attachment to the server and gets the information of the attachment file on the server. 2. Sends the attachment message, which contains the basic information of the message, and the path to the attachment file on the server. For the attachment messages, you can upload the attachment to your server, instead of the Agora server, before sending an attachment message. In this case, you need to set the `useOwnUploadFun` parameter in the `connection` class to `true` during SDK initialization. For example, to send an image message, you can call `sendPrivateUrlImg` to pass in the image URL after uploading the image attachment. diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_windows.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_windows.md index 44d40f394be..71b7a20966b 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_windows.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_windows.md @@ -373,8 +373,6 @@ SDKClient.Instance.ChatManager.AddChatManagerDelegate(adelegate); ### Send a customized message -Custom messages are self-defined key-value pairs that include the message type and the message content. - The following code example shows how to create and send a customized message: ```C# From cf58440634da7f052278e462e80c3bb5ea3c5f60 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Fri, 11 Oct 2024 18:38:29 +0800 Subject: [PATCH 2/8] modify --- ...agora_chat_send_receive_message_android.md | 119 +++++++++--------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md index eabec0f712b..c62b45ad42f 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md @@ -3,7 +3,6 @@ After logging in to Agora Chat, users can send the following types of messages t - Attachment messages, including image, voice, video, and file messages. - Location messages. - CMD messages. -- Extended messages. - Custom messages. In high-concurrency scenarios, you can set a certain message type or messages from a chat room member as high, normal, or low. In this case, low-priority messages are dropped first to reserve resources for the high-priority ones (e.g. gifts and announcements) when the server is overloaded. This ensures that the high-priority messages can be dealt with first when loads of messages are being sent in high concurrency or high frequency. Note that this feature can increase the delivery reliability of high-priority messages, but cannot guarantee the deliveries. Even high-priorities messages can be dropped when the server load goes too high. @@ -52,7 +51,6 @@ message.setChatType(ChatMessage.ChatType.GroupChat); @Override public void onSuccess() { showToast("Message sending succeeds"); - dialog.dismiss(); } @Override public void onError(int code, String error) { @@ -65,11 +63,13 @@ message.setChatType(ChatMessage.ChatType.GroupChat); You can set the priority of chat room messages. ```java +// Set `content` as the content of the text message. +// Set `conversationId` to chat room ID in room chat. ChatMessage message = ChatMessage.createTextSendMessage(content, conversationId); message.setChatType(ChatMessage.ChatType.ChatRoom); -// Set the message priority. The default value is `Normal`, indicating the normal priority. +// Set the message priority. The default value is `PriorityNormal`, indicating the normal priority. message.setPriority(ChatMessage.ChatRoomMessagePriority.PriorityHigh); -sendMessage(message); +ChatClient.getInstance().chatManager().sendMessage(message); ``` ### Receive a message @@ -112,10 +112,14 @@ try { You can also use `onMessageRecalled` to listen for the message recall state: ```java -/** - * Occurs when a received message is recalled. - */ -void onMessageRecalled(List messages); +MessageListener msgListener = new MessageListener() { + + /** + * Occurs when a received message is recalled. + */ + void onMessageRecalled(List messages); +}; + ``` ### Send and receive an attachment message @@ -132,8 +136,9 @@ Refer to the following code example to create and send a voice message: // Set voiceUri as the local URI of the audio file, and duration as the length of the file in seconds. ChatMessage message = ChatMessage.createVoiceSendMessage(voiceUri, duration, conversationId); // Sets the chat type as one-to-one chat, group chat, or chatroom. -if (chatType == CHATTYPE_GROUP) +if (chatType == CHATTYPE_GROUP) { message.setChatType(ChatType.GroupChat); +} ChatClient.getInstance().chatManager().sendMessage(message); ``` @@ -144,6 +149,9 @@ VoiceMessageBody voiceBody = (VoiceMessageBody) msg.getBody(); // Retrieves the URL of the audio file on the server. String voiceRemoteUrl = voiceBody.getRemoteUrl(); // Retrieves the URI if the audio file on the local device. +//If 'ChatClient.getInstance().getOptions().setAutodownloadThumbnail' is set as `false` or the attachment has not been downloaded yet, +//the file may not exist in 'voiceLocalUri' and you can manually call 'ChatClient.getInstance().chatManager().downloadAttachment(message)' to download the attachment, +//and call the 'message. SetMessageStatusCallback (the callback)' to see if the download succeeds. Uri voiceLocalUri = voiceBody.getLocalUri(); ``` @@ -158,8 +166,9 @@ Refer to the following code example to create and send an image message: // Set imageUri as the URI of the image file on the local device. false means not to send the original image. The SDK compresses image files that exceeds 100K before sending them. ChatMessage.createImageSendMessage(imageUri, false, conversationId); // Sets the chat type as one-to-one chat, group chat, or chatroom. -if (chatType == CHATTYPE_GROUP) +if (chatType == CHATTYPE_GROUP) { message.setChatType(ChatType.GroupChat); +} ChatClient.getInstance().chatManager().sendMessage(message); ``` @@ -178,7 +187,9 @@ Uri imgLocalUri = imgBody.getLocalUri(); Uri thumbnailLocalUri = imgBody.thumbnailLocalUri(); ``` -
If ChatClient.getInstance().getOptions().getAutodownloadThumbnail() is set as true on the recipient's client, the SDK automatically downloads the thumbnail after receiving the message. If not, you need to call ChatClient.getInstance().chatManager().downloadThumbnail(message) to download the thumbnail and get the path from the thumbnailLocalUri member in messageBody.
+
If ChatClient.getInstance().getOptions().getAutodownloadThumbnail() is set as true on the recipient's client, the SDK automatically downloads the thumbnail after receiving the message. If not, you need to call ChatClient.getInstance().chatManager().downloadThumbnail(message) to download the thumbnail and get the path from the thumbnailLocalUri member in messageBody. +If the file does not exist in imgLocalUri, you can manually call ChatClient.getInstance().chatManager().downloadAttachment(message) to download the attachment, and call the message. SetMessageStatusCallback (the callback)to see if the download succeeds. +
#### Send and receive a video message @@ -189,63 +200,46 @@ Refer to the following code example to create and send a video message: ```java String thumbPath = getThumbPath(videoUri); ChatMessage message = ChatMessage.createVideoSendMessage(videoUri, thumbPath, videoLength, conversationId); -sendMessage(message); +// Sets the chat type as one-to-one chat, group chat, or chatroom. +if (chatType == CHATTYPE_GROUP) { + message.setChatType(ChatType.GroupChat); +} +ChatClient.getInstance().chatManager().sendMessage(message); ``` By default, when the recipient receives the message, the SDK downloads the thumbnail of the video message. If you do not want the SDK to automatically download the video thumbnail, set `ChatClient.getInstance().getOptions().setAutodownloadThumbnail` as `false`, and to download the thumbnail, you need to call `ChatClient.getInstance().chatManager().downloadThumbnail(message)`, and get the path of the thumbnail from the `thumbnailLocalUri` member in `messageBody`. -To download the actual video file, call `SChatClient.getInstance().chatManager().downloadAttachment(message)`, and get the path of the video file from the `getLocalUri` member in `messageBody`. +To download the actual video file, call `ChatClient.getInstance().chatManager().downloadAttachment(message)`, and get the path of the video file from the `getLocalUri` member in `messageBody`. ```java // If you received a message with video attachment, you need download the attachment before you open it. if (message.getType() == ChatMessage.Type.VIDEO) { VideoMessageBody messageBody = (VideoMessageBody)message.getBody(); - // Get the URL of the video on the server. - String videoRemoteUrl = messageBody.getRemoteUrl(); - // Download the video. - ChatClient.getInstance().chatManager().downloadAttachment(message); - // Set Callback to know whether the download is finished. - public void onError(final int error, String message) { - EMLog.e(TAG, "offline file transfer error:" + message); - runOnUiThread(new Runnable() { - @Override - public void run() { - if (EaseShowBigImageActivity.this.isFinishing() || EaseShowBigImageActivity.this.isDestroyed()) { - return; - } - image.setImageResource(default_res); - pd.dismiss(); - if (error == Error.FILE_NOT_FOUND) { - Toast.makeText(getApplicationContext(), R.string.Image_expired, Toast.LENGTH_SHORT).show(); - } - } - }); - } - - public void onProgress(final int progress, String status) { - EMLog.d(TAG, "Progress: " + progress); - final String str2 = getResources().getString(R.string.Download_the_pictures_new); - runOnUiThread(new Runnable() { - @Override - public void run() { - if (EaseShowBigImageActivity.this.isFinishing() || EaseShowBigImageActivity.this.isDestroyed()) { - return; - } - pd.setMessage(str2 + progress + "%"); - } - }); - } - }; + // Set Callback to know whether the download is finished. + final CallBack callback = new CallBack() { + public void onSuccess() { + EMLog.e(TAG, "onSuccess" ); + // After the download finishes onSuccess, get the URI of the local file. + Uri videoLocalUri = messageBody.getLocalUri(); + + } + + public void onError(final int error, String message) { + EMLog.e(TAG, "offline file transfer error:" + message); + } + + public void onProgress(final int progress, String status) { + EMLog.d(TAG, "Progress: " + progress); + } + }; - msg.setMessageStatusCallback(callback); + message.setMessageStatusCallback(callback); - ChatClient.getInstance().chatManager().downloadAttachment(msg); - - // After the download finishes, get the URI of the local file. - Uri videoLocalUri = messageBody.getLocalUri(); + ChatClient.getInstance().chatManager().downloadAttachment(message); + } ``` @@ -257,7 +251,10 @@ Refer to the following code example to create, send, and receive a file message: // Set fileLocalUri as the URI of the file message on the local device. ChatMessage message = ChatMessage.createFileSendMessage(fileLocalUri, conversationId); // Sets the chat type as one-to-one chat, group chat, or chatroom. -if (chatType == CHATTYPE_GROUP) message.setChatType(ChatType.GroupChat);ChatClient.getInstance().chatManager().sendMessage(message); +if (chatType == CHATTYPE_GROUP){ + message.setChatType(ChatType.GroupChat); +} +ChatClient.getInstance().chatManager().sendMessage(message); ``` While sending a file message, refer to the following sample code to get the progress for uploading the attachment file: @@ -268,7 +265,6 @@ message.setMessageStatusCallback(new CallBack() { @Override public void onSuccess() { showToast("Message sending succeeds"); - dialog.dismiss(); } @Override public void onError(int code, String error) { @@ -294,6 +290,8 @@ String fileRemoteUrl = fileMessageBody.getRemoteUrl(); Uri fileLocalUri = fileMessageBody.getLocalUri(); ``` +
If the file does not exist in fileLocalUri, you can manually call ChatClient.getInstance().chatManager().downloadAttachment(message) to download the attachment, and call the message. SetMessageStatusCallback (the callback)to see if the download succeeds.
+ ### Send a location message To send and receive a location message, you need to integrate a third-party map service provider. When sending a location message, you get the longitude and latitude information of the location from the map service provider; when receiving a location message, you extract the received longitude and latitude information and displays the location on the third-party map. @@ -302,8 +300,9 @@ To send and receive a location message, you need to integrate a third-party map // Sets the latitude and longitude information of the address. ChatMessage message = ChatMessage.createLocationSendMessage(latitude, longitude, locationAddress, conversationId); // Sets the chat type as one-to-one chat, group chat, or chatroom. -if (chatType == CHATTYPE_GROUP) +if (chatType == CHATTYPE_GROUP){ message.setChatType(ChatType.GroupChat); +} ChatClient.getInstance().chatManager().sendMessage(message); ``` @@ -316,7 +315,9 @@ CMD messages are command messages that instruct a specified user to take a certa ```java ChatMessage cmdMsg = ChatMessage.createSendMessage(ChatMessage.Type.CMD); // Sets the chat type as one-to-one chat, group chat, or chat room. -cmdMsg.setChatType(ChatType.GroupChat); +if (chatType == CHATTYPE_GROUP){ + cmdMsg.setChatType(ChatType.GroupChat); +} String action="action1"; // You can customize the action. CmdMessageBody cmdBody = new CmdMessageBody(action); @@ -331,7 +332,7 @@ To notify the recipient that a CMD message is received, use a separate delegate ```java MessageListener msgListener = new MessageListener() { - // Occurs when the message is received + // Occurs when the normal message is received @Override public void onMessageReceived(List messages) { } From f39d1b36f19a8c538dc9e5943b555e92d89d94d3 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Sat, 12 Oct 2024 17:35:45 +0800 Subject: [PATCH 3/8] modify --- .../agora_chat_manage_message_android.md | 2 +- .../Manage Local Messages/agora_chat_manage_message_ios.md | 6 +++--- .../Manage Local Messages/agora_chat_manage_message_rn.md | 4 ++-- .../agora_chat_manage_message_unity.md | 2 +- .../agora_chat_send_receive_message_android.md | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_android.md b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_android.md index 2711c9ddf54..e193a7961eb 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_android.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_android.md @@ -131,7 +131,7 @@ List messages = conversation.searchMsgFromDB(keywords, timeStamp, m ### Import messages -Call `importMessages` to import multiple messages to the specified conversation. This applies to scenarios where chat users want to formard messages from another conversation. +Call `importMessages` to import multiple messages to the specified conversation. ```java ChatClient.getInstance().chatManager().importMessages(msgs); diff --git a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_ios.md b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_ios.md index 902834ca741..4be4f8c87e6 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_ios.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_ios.md @@ -89,12 +89,12 @@ AgoraChatConversation *conversation = [[AgoraChatClient sharedClient].chatManage You can delete conversations on both the local device and the server. -To delete them on the local device, call `deleteConversation` and `removeMessage`: +To delete them on the local device, call `deleteConversation` and `deleteMessageWithId`: ```objective-c // Deletes the specified conversation. To keep the historical messages, set isDeleteMessages as NO. [[AgoraChatClient sharedClient].chatManager deleteConversation:conversationId isDeleteMessages:YES completion:nil]; -// Deletes the specified conversation. +// Deletes the specified conversations. NSArray *conversations = @{@"conversationID1",@"conversationID2"}; [[AgoraChatClient sharedClient].chatManager deleteConversations:conversations isDeleteMessages:YES completion:nil]; // Deletes the specified message of the current conversation. @@ -142,7 +142,7 @@ NSArray *messages = [conversation loadMessagesWithKeyword:ke ### Import messages -Call `importMessages` to import multiple messages to the specified conversation. This applies to scenarios where chat users want to formard messages from another conversation. +Call `importMessages` to import multiple messages to the specified conversation. ```objective-c [[AgoraChatClient sharedClient].chatManager importMessages:messages completion:nil]; diff --git a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md index f01ae04ea03..40f152ebf55 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md @@ -137,7 +137,7 @@ ChatClient.getInstance() ### Delete conversations and historical messages -The SDK provides two methods, which enables you to delete the conversations and historical messages on the local device and on the server respectively. +The SDK provides two methods, which enable you to delete the conversations and historical messages on the local device and on the server respectively. To delete them on the local device, call `deleteConversation`: @@ -244,7 +244,7 @@ ChatClient.getInstance().chatManager.searchMsgFromDB( ### Import messages -Call `importMessages` to import multiple messages to the specified conversation. This applies to scenarios where chat users want to formard messages from another conversation. +Call `importMessages` to import multiple messages to the specified conversation. ```typescript // Construct the messages. diff --git a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_unity.md b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_unity.md index f93971f9932..ecafd8d3847 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_unity.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_unity.md @@ -155,7 +155,7 @@ List list = SDKClient.Instance.ChatManager.SearchMsgFromDB(keywords, ti ### Import messages -Call `ImportMessages` to import multiple messages to the specified conversation. This applies to scenarios where chat users want to formard messages from another conversation. +Call `ImportMessages` to import multiple messages to the specified conversation. ```C# SDKClient.Instance.ChatManager.ImportMessages(messages, new CallBack( diff --git a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md index c62b45ad42f..eef0aac2e02 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Send and Receive Messages/agora_chat_send_receive_message_android.md @@ -327,7 +327,7 @@ cmdMsg.addBody(cmdBody); ChatClient.getInstance().chatManager().sendMessage(cmdMsg); ``` -To notify the recipient that a CMD message is received, use a separate delegate so that users can deal with the message differently. +To notify the recipient that a CMD message is received, use a separate listener so that users can deal with the message differently. ```java MessageListener msgListener = new MessageListener() From 4b41122a0c5b21e68d477fabf747f97b0fb1d4a4 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Mon, 14 Oct 2024 16:12:30 +0800 Subject: [PATCH 4/8] modify --- .../Message Receipts/agora_chat_message_receipt_rn.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en-US/markdown/agora-chat/Develop/Messages/Message Receipts/agora_chat_message_receipt_rn.md b/en-US/markdown/agora-chat/Develop/Messages/Message Receipts/agora_chat_message_receipt_rn.md index a40c2fc399b..a2c8e180f23 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Message Receipts/agora_chat_message_receipt_rn.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Message Receipts/agora_chat_message_receipt_rn.md @@ -286,11 +286,11 @@ Follow the steps to implement read receipts for a chat group message: ChatClient.getInstance() .chatManager.sendGroupMessageReadAck(msgId, groupId) .then(() => { - // Print a log here is the message sending succeeds. + // Print a log here if the message sending succeeds. console.log("send message read success."); }) .catch((reason) => { - // Print a log here is the message sending fails. + // Print a log here if the message sending fails. console.log("send message read fail.", reason); }); ``` From b5021ed81e73de82088563e0700981b41eb0d98a Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Thu, 17 Oct 2024 11:19:02 +0800 Subject: [PATCH 5/8] modify --- .../RESTful API Reference/agora_chat_restful_message.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md index 4b15255df19..d092750faa6 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md @@ -168,7 +168,7 @@ The request body is a JSON object, which contains the following parameters: | Parameter | Type | Description | Required | | --- | --- | --- | --- | - | `customEvent` | String | The event type customized by the user. The value of this parameter should be a regular expression, for example, `[a-zA-Z0-9-_/\.]{1,32}`. | No | + | `customEvent` | String | The event type customized by the user. The value of this parameter should meet the restrictions placed by a regular expression, for example, `[a-zA-Z0-9-_/\.]{1,32}`. | No | | `customExts` | JSON | The event attribute customized by the user. The data type is `Map`. You can set a maximum of 16 elements. | No | #### HTTP response @@ -1838,7 +1838,7 @@ For the other parameters and detailed descriptions, see [Common parameters](#par | `new_msg` | JSON | The modified message. | Yes | | `new_msg.type` | String | The type of message to modify:
  • `txt`: The text message;
  • `custom`: The custom message.
| Yes | | `new_msg.msg` | String | The modified message content. **This parameter is valid only for text messages.** | Yes | -| `new_msg.customEvent` | String | The event type customized by the user. The value of this parameter should be a regular expression, for example, [a-zA-Z0-9-_/\.]{1,32}. This parameter value can contain up to 32 characters. **This parameter is valid only for custom messages.** | No | +| `new_msg.customEvent` | String | The event type customized by the user. The value of this parameter should meet restrictions placed by a regular expression, for example, [a-zA-Z0-9-_/\.]{1,32}. This parameter value can contain up to 32 characters. **This parameter is valid only for custom messages.** | No | | `new_msg.customExts` | JSON | The event attribute customized by the user. The data type is Map. You can set a maximum of 16 elements. **This parameter is valid only for custom messages.** | No | | `new_ext` | JSON | The modified message extension information. This parameter is valid only for custom messages. | No | | `is_combine_ext` | Boolean | Whether the modified message extension information is merged with or replaces the original information:
  • (Default)`true`: Merge;
  • `false`: Replace.
| No | From 3b6ee1bf8aed7d336efb5bbc2e53e50ae0bdf740 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Wed, 23 Oct 2024 10:08:26 +0800 Subject: [PATCH 6/8] modify --- .../Develop/Chat Groups/agora_chat_group_flutter.md | 8 ++++---- .../Develop/Chat Groups/agora_chat_group_ios.md | 2 +- .../Develop/Chat Groups/agora_chat_group_overview.md | 6 +++--- .../Develop/Chat Groups/agora_chat_group_unity.md | 6 +++--- .../Develop/Chat Groups/agora_chat_group_web.md | 4 ++-- .../Develop/Messages/agora_chat_message_overview.md | 8 ++++---- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md index 152f7856f65..d100c4b125c 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md @@ -42,14 +42,14 @@ Set `ChatGroupStyle` and `inviteNeedConfirm` before creating a chat group. 2. Does a group invitation require consent from an invitee to add them to the group (`inviteNeedConfirm`): - Yes (`ChatGroupOptions#inviteNeedConfirm` is set to `true`). After creating a group and sending group invitations, the subsequent logic varies based on whether an invitee automatically consents to the group invitation (`autoAcceptGroupInvitation`): - - Yes (`autoAcceptGroupInvitation` is set to `true`). The invitee automatically joins the chat group and receives the `ChatGroupEventHandler#onAutoAcceptInvitationFromGroup` callback, the chat group owner receives the `ChatGroupEventHandler#onInvitationAcceptedFromGroup` and `ChatGroupEventHandler#onMemberJoinedFromGroup` callbacks, and the other chat group members receives the `ChatGroupEventHandler#onMemberJoinedFromGroup` callback. + - Yes (`autoAcceptGroupInvitation` is set to `true`). The invitee automatically joins the chat group and receives the `ChatGroupEventHandler#onAutoAcceptInvitationFromGroup` callback, the inviter receives the `ChatGroupEventHandler#onInvitationAcceptedFromGroup` and `ChatGroupEventHandler#onMemberJoinedFromGroup` callbacks, and the other chat group members receives the `ChatGroupEventHandler#onMemberJoinedFromGroup` callback. - No (`autoAcceptGroupInvitation` is set to `false`). The invitee receives the `ChatGroupEventHandler#onInvitationReceivedFromGroup` callback and chooses whether to join the chat group: - - If the invitee accepts the group invitation, the chat group owner receives the `ChatGroupEventHandler#onInvitationAcceptedFromGroup` and `ChatGroupEventHandler#onMemberJoinedFromGroup` callbacks, and the other chat group members receive the `ChatGroupEventHandler#onMemberJoinedFromGroup` callback; + - If the invitee accepts the group invitation, the inviter receives the `ChatGroupEventHandler#onInvitationAcceptedFromGroup` and `ChatGroupEventHandler#onMemberJoinedFromGroup` callbacks, and the other chat group members receive the `ChatGroupEventHandler#onMemberJoinedFromGroup` callback; - If the invitee declines the group invitation, the chat group owner receives the `ChatGroupEventHandler#onInvitationDeclinedFromGroup` callback. ![](https://web-cdn.agora.io/docs-files/1653385689954) -- No (`ChatGroupOptions#inviteNeedConfirm` is set to `false`). After creating a chat group and sending group invitations, an invitee is added to the chat group regardless of their `autoAcceptGroupInvitation` setting. The invitee receives the `ChatGroupEventHandler#onAutoAcceptInvitationFromGroup` callback, the chat group owner receives the `ChatGroupEventHandler#onInvitationAcceptedFromGroup` and `ChatGroupEventHandler#onMemberJoinedFromGroup` callbacks, and the other chat group members receive the `ChatGroupEventHandler#onMemberJoinedFromGroup` callback. +- No (`ChatGroupOptions#inviteNeedConfirm` is set to `false`). After creating a chat group and sending group invitations, an invitee is added to the chat group regardless of their `autoAcceptGroupInvitation` setting. The invitee receives the `ChatGroupEventHandler#onAutoAcceptInvitationFromGroup` callback, the inviter receives the `ChatGroupEventHandler#onInvitationAcceptedFromGroup` and `ChatGroupEventHandler#onMemberJoinedFromGroup` callbacks, and the other chat group members receive the `ChatGroupEventHandler#onMemberJoinedFromGroup` callback. Users can call `createGroup` to create a chat group and set the chat group attributes such as the chat group name, description, maximum number of members, and reason for creating the group, by specifying `ChatGroupOptions`. @@ -125,7 +125,7 @@ try { ### Leave a chat group -Chat group members can call `leave` to leave the specified chat group, whereas the chat group owner cannot perform this operation. Once a member leaves a chat group, all the other chat group members receive the `ChatGroupEventHandler#onMemberExitedFromGroup` callback. +Chat group members can call `leaveGroup` to leave the specified chat group, whereas the chat group owner cannot perform this operation. Once a member leaves a chat group, all the other chat group members receive the `ChatGroupEventHandler#onMemberExitedFromGroup` callback. The following code sample shows how to leave a chat group: diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md index 4c775e1d612..c83318b4d7d 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md @@ -144,7 +144,7 @@ do { ### Block and unblock a chat group -All chat group members can block and unblock a chat group. Once a member block a chat group, they no longer receive messages from this chat group. +All chat group members can block and unblock a chat group. Once members block a chat group, they no longer receive messages from this chat group. Refer to the following sample code to block and unblock a chat group: diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_overview.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_overview.md index 7f205f5fb51..86dc83fb753 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_overview.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_overview.md @@ -1,4 +1,4 @@ -Chat groups are features that enable instant messaging among multiple chat users. The relationship between chat group members is persistent: chat group members can send and receive messages in the group and also receive push messages when they are offline. +Chat groups are features that enable instant messaging among multiple chat users. The relationship between chat group members is persistent: chat group members can send and receive messages in the group and also receive push notifications when they are offline. ## Chat group types @@ -29,8 +29,8 @@ The specific feature differences are listed in the following table: | --- | --- | --- | | Use cases | Group chat scenarios in Signal and Skype, where members have a preexisting relationship with each other. | Stream chat scenarios in Twitch, where viewers have no relationship with each other. Once a member quits the stream channel, they leave the chat room. | | Maximum number of members | 5,000 | 20,000+ | -| Message push support | Members receive push messages when they go offline. | Members do not receive push messages when they go offline. | -| Offline message storage | This feature is supported. Agora Chat servers store messages sent to offline group members and sends to them once they go back online. A maximum number of 200 messages across chat groups can be stored per end user. | Chat room does not store messages sent to offline chat room members and this feature is not supported in chat rooms. | +| Message push support | If the offline push function is integrated, members receive push notifications when they go offline. | Members do not receive push notifications when they go offline, as the offline push function is supported in chat rooms. | +| Offline message storage | This feature is supported. Agora Chat servers store messages sent to offline group members and send to them once they go back online. A maximum number of 200 messages across chat groups can be stored per end user. | Chat room does not store messages sent to offline chat room members and this feature is not supported in chat rooms. | | Message history | Agora Chat servers store message history, subject to the [data retention period of your package selection](https://docs.agora.io/en/agora-chat/reference/pricing-plan-details?platform=android#message). The history can be retrieved by your app server via [this RESTful API](https://docs.agora.io/en/agora-chat/restful-api/message-management?platform=android#retrieve-historical-messages), in the format of JSON files. You can call [this Client API](https://docs.agora.io/en/agora-chat/client-api/messages/retrieve-messages?platform=android#retrieve-historical-messages-of-the-specified-conversation) to allow the SDK to retrieve message history of a chat group. This allows end users to synchronize messages history across multiple end devices. | Agora Chat servers store message history, subject to the [data retention period of your package selection](https://docs.agora.io/en/agora-chat/reference/pricing-plan-details?platform=android#message). The history can be retrieved by your app server via [this RESTful API](https://docs.agora.io/en/agora-chat/restful-api/message-management?platform=android#retrieve-historical-messages), in the format of JSON files. Agora Chat currently does not support SDK retrieving message history of a chat room via client APIs. However, when a user joins a chat room, Agora Chat servers can send 10 most recent messages to the client side via the message receiving callback. To enable this function, you need to contact [support@agora.io](mailto:support@agora.io). The number of historical messages sent to the new chat room member can be increased up to 200, without additional charges.| | Message reliability | Each member receives all the messages in the chat group. | Members might not see all messages. The SDK discards messages if the chat room message threshold is exceeded. The default threshold is 100 messages per second. You can adjust this threshold according to your needs. | diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md index 9f1674e8143..d67b87e6cdc 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md @@ -42,10 +42,10 @@ Set `GroupStyle` and `inviteNeedConfirm` before creating a chat group. 2. Does a group invitation require consent from an invitee to add them to the group (`inviteNeedConfirm`): - Yes (`option.InviteNeedConfirm` is set to `true`). After creating a group and sending group invitations, the subsequent logic varies based on whether an invitee automatically consents to the group invitation (`AutoAcceptGroupInvitation`): - - Yes (`AutoAcceptGroupInvitation` is set to `true`). The invitee automatically joins the chat group and receives the `IGroupManagerDelegate#OnAutoAcceptInvitationFromGroup` callback, the chat group owner receives the `IGroupManagerDelegate#OnInvitationAcceptedFromGroup` and `IGroupManagerDelegate#OnMemberJoinedFromGroup` callbacks, and the other chat group members receives the `IGroupManagerDelegate#OnMemberJoinedFromGroup` callback. + - Yes (`AutoAcceptGroupInvitation` is set to `true`). The invitee automatically joins the chat group and receives the `IGroupManagerDelegate#OnAutoAcceptInvitationFromGroup` callback, the inviter receives the `IGroupManagerDelegate#OnInvitationAcceptedFromGroup` and `IGroupManagerDelegate#OnMemberJoinedFromGroup` callbacks, and the other chat group members receives the `IGroupManagerDelegate#OnMemberJoinedFromGroup` callback. - No (`AutoAcceptGroupInvitation` is set to `false`). The invitee receives the `IGroupManagerDelegate#OnInvitationReceivedFromGroup` callback and chooses whether to join the chat group: - - If the invitee accepts the group invitation, the chat group owner receives the `IGroupManagerDelegate#OnInvitationAcceptedFromGroup` and `IGroupManagerDelegate#OnMemberJoinedFromGroup` callbacks and the other chat group members receive the `IGroupManagerDelegate#OnMemberJoinedFromGroup` callback; - - If the invitee declines the group invitation, the chat group owner receives the`IGroupManagerDelegate#OnInvitationDeclinedFromGroup` callback. + - If the invitee accepts the group invitation, the inviter receives the `IGroupManagerDelegate#OnInvitationAcceptedFromGroup` and `IGroupManagerDelegate#OnMemberJoinedFromGroup` callbacks and the other chat group members receive the `IGroupManagerDelegate#OnMemberJoinedFromGroup` callback; + - If the invitee declines the group invitation, the inviter receives the`IGroupManagerDelegate#OnInvitationDeclinedFromGroup` callback. ![](https://web-cdn.agora.io/docs-files/1652923565779) diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md index cdf7cc5bfe5..a0e3a062e45 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md @@ -76,7 +76,7 @@ Users can request to join a public chat group as follows: - If the `approval` parameter of the group type is set to `false`, the request from the user is accepted automatically and the chat group members receive the `memberPresence` callback. - If the `approval` parameter is set to `true`, the chat group owner and chat group admins receive the `requestToJoin` callback and determine whether to accept the request from the user. -Users can call `memberAbsence` to leave a chat group. Once a user leaves the group, all the other group members receive the `memberAbsence` callback. +Users can call `joinGroup` to leave a chat group. Once a user leaves the group, all the other group members receive the `memberAbsence` callback. Refer to the following sample code to join and leave a chat group: @@ -105,7 +105,7 @@ let options = { }; conn.joinGroup(options).then(res => console.log(res)) -// Call memberAbsence to leave a chat group. +// Call leaveGroup to leave a chat group. let option = { groupId: "groupId" }; diff --git a/en-US/markdown/agora-chat/Develop/Messages/agora_chat_message_overview.md b/en-US/markdown/agora-chat/Develop/Messages/agora_chat_message_overview.md index d615714cf3f..f7de9aad6df 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/agora_chat_message_overview.md +++ b/en-US/markdown/agora-chat/Develop/Messages/agora_chat_message_overview.md @@ -75,9 +75,9 @@ Once you read all the messages, the number of the unread messages are cleared. Y You can delete the conversations on the local device, and while doing so, you can choose whether to clear the chat history or not. -### Search messages with key words +### Search for messages with key words -You can search the message in a conversation using key words. +You can search for the message in a conversation using key words. ### Import messages to the database @@ -97,9 +97,9 @@ The Agora Chat SDK stores historical messages in the chat server, and you can re ### Message resending mechanism -- For Android and iOS, the message resending mechanism is as follows: +- For Android, iOS, Unity, React Native, and Flutter, the message resending mechanism is as follows: -After the client calls the method of sending a message, it will wait for the server to return a response. The response timeout period is 10 seconds. If the sending fails due to a response timeout, the client will try to send the message again by reconnecting to the server through a persistent connection to send the message. If the sending fails again, the SDK considers the sending of the message failed, and returns error code 300 and the error message `SERVER_NOT_REACHABLE`, indicating that the server is unreachable. +After the client calls the method of sending a message, it will wait for the server to return a response. The response timeout period is 10 seconds. If the sending fails due to a response timeout, the client will try to send the message again by reconnecting to the server through a persistent connection to send the message. If the sending fails again, the SDK considers the sending of the message failed, and returns error code 300 (`SERVER_NOT_REACHABLE` for Android, Unity, and Windows and `EMErrorServerNotReachable` for iOS), indicating that the server is unreachable. - For Web, the message resending mechanism is as follows: From af1dc0695719f8c1bc1c11a583f5cefd6c20e458 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Wed, 23 Oct 2024 14:25:23 +0800 Subject: [PATCH 7/8] modify --- .../agora-chat/Develop/Chat Groups/agora_chat_group_web.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md index a0e3a062e45..8a3b4bb9af4 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md @@ -7,7 +7,7 @@ This page shows how to use the Agora Chat SDK to create and manage a chat group ## Understand the tech -The Agora Chat SDK provides the `GroupManager` and `Group` classes for chat group management, which allows you to implement the following features: +The Agora Chat SDK allows you to implement the following group management features: - Create and destroy a chat group - Join and leave a chat group From ce5feaa062750f3c6f0181542d858c75c4d9ba32 Mon Sep 17 00:00:00 2001 From: haoxiuwen Date: Wed, 23 Oct 2024 16:04:36 +0800 Subject: [PATCH 8/8] modify --- .../Develop/Push/agora_chat_push_android.md | 4 ++ .../Develop/Push/agora_chat_push_rn.md | 46 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_android.md b/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_android.md index cf1fbf2dc8e..7112c5dfa0b 100644 --- a/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_android.md +++ b/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_android.md @@ -366,6 +366,10 @@ You can call `updatePushNickname` to set the nickname displayed in your push not ChatClient.getInstance().pushManager().updatePushNickname("pushNickname"); ``` +// Add the following texts for Android, iOS, Flutter, and React Native. + +This nickname indicates the nickname of the message sender that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see Setting user attributes. + You can also call `updatePushDisplayStyle` to set the display style of push notifications, as shown in the following code sample: ```java diff --git a/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_rn.md b/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_rn.md index 208ee960121..87a60b459c6 100644 --- a/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_rn.md +++ b/en-US/markdown/agora-chat/Develop/Push/agora_chat_push_rn.md @@ -318,6 +318,52 @@ ChatClient.getInstance() }); ``` +## Set up display attributes + +### Set the display attributes of push notifications + +You can call `updatePushNickname` to set the nickname displayed in your push notifications, as shown in the following code sample: + +```typescript +ChatClient.getInstance() + .pushManager.updatePushNickname(nickname) + .then(() => { + console.log("Succeeded in updating the nickname."); + }) + .catch((reason) => { + console.log("Failed to update the nickname.", reason); + }); +``` + +This nickname indicates the nickname of the message sender that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see Setting user attributes. + +You can also call `updatePushDisplayStyle` to set the display style of push notifications, as shown in the following code sample: + +```typescript +ChatClient.getInstance() + .pushManager.updatePushDisplayStyle(displayStyle) + .then(() => { + console.log("Succeeded in updating the display style."); + }) + .catch((reason) => { + console.log("Failed to update the display style.", reason); + }); +``` + +### Retrieve the display attributes of push notifications + +You can call `fetchPushOptionFromServer` to retrieve the display attributes in push notifications, as shown in the following code sample: + +```typescript +ChatClient.getInstance() + .pushManager.fetchPushOptionFromServer() + .then(() => { + console.log("Succeeded in getting the push configurations."); + }) + .catch((reason) => { + console.log("Failed to get the push configuration.", reason); + }); +``` ## Set up push translations