Skip to content

Commit

Permalink
Merge pull request #3801 from haoxiuwen/agora-chat
Browse files Browse the repository at this point in the history
Modify Agora Chat EN Docs
  • Loading branch information
haoxiuwen authored Nov 18, 2024
2 parents e0df0cd + 631c6ae commit 1a3ef3d
Show file tree
Hide file tree
Showing 33 changed files with 116 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,31 @@ try {
}
```

#### Download chat group shared files

All chat group members can call `downloadGroupSharedFile` to download shared files in a chat group.

```dart
try {
List<ChatGroupSharedFile> list =
await ChatClient.getInstance.groupManager.fetchGroupFileListFromServer(
groupId,
pageNum: 1,
pageSize: 10,
);
if (list.isNotEmpty) {
await ChatClient.getInstance.groupManager.downloadGroupSharedFile(
groupId: groupId,
fileId: list.first.fileId!,
savePath: savePath,
);
}
} on ChatError catch (e) {
debugPrint('$e');
}
```

#### Delete chat group shared files

All chat group members can call `removeGroupSharedFile` to delete shared files in a chat group. Once a shared file is deleted, all the other chat group members receive the `ChatGroupEventHandler#onSharedFileDeletedFromGroup` callback. The chat group owner and chat group admins can delete all of the shared files, whereas chat group members can only delete the shared files that they have personally uploaded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ChatClient.getInstance()

### Update the chat group announcements

Only the chat group owner and admins can call `updateGroupAnnouncement` to set and update the announcements. Once the chat group announcements are updated, all the other chat group members receive the `IGroupManagerDelegate#OnAnnouncementChangedFromGroup` callback. The maximum total length of chat group announcements is 512 characters.
Only the chat group owner and admins can call `updateGroupAnnouncement` to set and update the announcements. Once the chat group announcements are updated, all the other chat group members receive the `IGroupManagerDelegate#onAnnouncementChanged` callback. The maximum total length of chat group announcements is 512 characters.

The following code sample shows how to update the chat group announcements:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This page shows how to use the Agora Chat SDK to manage the attributes of a chat

## 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 provides the following group attribute management features:

- Modify the chat group name and description
- Manage chat group announcements
Expand Down Expand Up @@ -75,7 +75,7 @@ Refer to the following sample code to manage chat group shared files:

```javascript
// All chat group members can call uploadGroupSharedFile to upload group shared files. The file size can be up to 10 MB.
// Once shared files are uploaded, group members receive the onSharedFileAdded callback.
// Once shared files are uploaded, group members receive the uploadFile callback.
let option = {
groupId: "groupId",
file: file, // <input type="file"/>Choose the file to upload and share.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void unmuteAllMembers(final String groupId, final ValueCallBack<Group> ca

The chat group owner and admins are added to the chat group allow list by default.

Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, adding this member to the allow list does not take effect.
Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, this member still cannot send send messages in the group even after being added to the group allow list.

Refer to the following sample code to manage the chat group allow list:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ The chat group owner and admins are added to the chat group allow list by defaul

#### Add a member to the chat group allow list

Only the chat group owner and admins can call `addAllowList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, adding this member to the allow list does not enable them to send messages. The mute list takes precedence.
Only the chat group owner and admins can call `addAllowList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, this member still cannot send send messages in the group even after being added to the group allow list.

The following code sample shows how to add a member to the chat group allow list:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Refer to the following sample code to mute and unmute all the chat group members
The chat group owner and admins are added to the chat group allow list by default.
Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, adding this member to the allow list does not take effect.
Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, this member still cannot send send messages in the group even after being added to the allow list.
Refer to the following sample code to manage the chat group allow list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ChatClient.getInstance()

#### Transfer the chat group ownership

Only the chat group owner can call `changeOwner` to transfer the ownership to the specified chat group member. Once the ownership is transferred, the former chat group owner becomes a regular member, and the new owner receives the `ChatGroupEventListener#OnOwnerChangedFromGroup` callback.
Only the chat group owner can call `changeOwner` to transfer the ownership to the specified chat group member. Once the ownership is transferred, the former chat group owner becomes a regular member, and the new owner receives the `ChatGroupEventListener#OnOwnerChanged` callback.

The following code sample shows how to transfer the chat group ownership:

Expand All @@ -85,7 +85,7 @@ ChatClient.getInstance()

#### Add a chat group admin

Only the chat group owner can call `addAdmin` to add an admin. Once promoted to an admin, the new admin and the other chat group admins receive the `ChatGroupEventListener#OnAdminAddedFromGroup` callback.
Only the chat group owner can call `addAdmin` to add an admin. Once promoted to an admin, the new admin and the other chat group admins receive the `ChatGroupEventListener#OnAdminAdded` callback.

The following code sample shows how to add a chat group admin:

Expand All @@ -102,7 +102,7 @@ ChatClient.getInstance()

#### Remove a chat group admin

Only the chat group owner can call `removeAdmin` to remove an admin. Once demoted to a regular member, the former admin and the other chat group admins receive the `ChatGroupEventListener#OnAdminRemovedFromGroup` callback.
Only the chat group owner can call `removeAdmin` to remove an admin. Once demoted to a regular member, the former admin and the other chat group admins receive the `ChatGroupEventListener#OnAdminRemoved` callback.

The following code sample shows how to remove a chat group admin:

Expand Down Expand Up @@ -192,7 +192,7 @@ ChatClient.getInstance()

#### Remove a member from the chat group mute list

Only the chat group owner and admins can call `unMuteMembers` to remove the specified member from the chat group mute list. Once removed from the chat group mute list, this member and all the other chat group admins or owner receive the `ChatGroupEventListener#OnMuteListRemovedFromGroup` callback.
Only the chat group owner and admins can call `unMuteMembers` to remove the specified member from the chat group mute list. Once removed from the chat group mute list, this member and all the other chat group admins or owner receive the `ChatGroupEventListener#onMuteListRemoved` callback.

The following code sample shows how to remove a member from the chat group mute list:

Expand Down Expand Up @@ -270,7 +270,7 @@ The chat group owner and admins are added to the chat group allow list by defaul

#### Add a member to the chat group allow list

Only the chat group owner and admins can call `addAllowList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, adding this member to the allow list does not enable them to send messages. The mute list takes precedence.
Only the chat group owner and admins can call `addAllowList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, this member still cannot send send messages in the group even after being added to the group allow list.

The following code sample shows how to add a member to the chat group allow list:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ The chat group owner and admins are added to the chat group allow list by defaul

#### Add a member to the chat group allow list

Only the chat group owner and admins can call `AddGroupWhiteList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, adding this member to the allow list does not enable them to send messages. The mute list takes precedence.
Only the chat group owner and admins can call `AddGroupWhiteList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, this member still cannot send send messages in the group even after being added to the group allow list.


The following code sample shows how to add a member to the chat group allow list:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ conn.enableSendGroupMsg(options).then(res => console.log(res))

The chat group owner and admins are added to the chat group allow list by default.

Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, adding this member to the allow list does not take effect.
Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, this member still cannot send send messages in the group even after being added to the allow list.

Refer to the following sample code to manage the chat group allow list:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ The chat group owner and admins are added to the chat group allow list by defaul

#### Add a member to the chat group allow list

Only the chat group owner and admins can call `AddGroupWhiteList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, adding this member to the allow list does not enable them to send messages. The mute list takes precedence.
Only the chat group owner and admins can call `AddGroupWhiteList` to add the specified member to the chat group allow list. Members in the chat group allow list can send chat group messages even when the chat group owner or admin has muted all chat group members. However, if a member is already in the chat group mute list, this member still cannot send send messages in the group even after being added to the group allow list.

The following code sample shows how to add a member to the chat group allow list:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public interface ChatRoomChangeListener {


/**
* Occurs when the chat room announcements change.
* Occurs when the chat room announcement is changed.
* @param chatRoomId The chat room ID
* @param announcement The new chat room announcements
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This section introduces how to call the APIs provided by the Agora Chat SDK to i
### Manage basic chat room attributes

#### Retrieve basic chat room attributes
All the chat room members can call `fetchChatRoomFromServer` to retrieve the detailed information of the current chat room, including the subject, announcements, description, member type, and admin list.
All the chat room members can call `fetchChatRoomFromServer` to retrieve the detailed information of the current chat room, including the subject, announcement, description, member type, and admin list.

```java
// Fetches basic attributes including ID, name, description, maximum members, owners, roles, and whether all members are muted.
Expand All @@ -46,16 +46,16 @@ ChatRoom chatRoom = ChatClient.getInstance().chatroomManager().changeChatRoomSub
ChatRoom chatRoom = ChatClient.getInstance().chatroomManager().changeChatroomDescription(chatRoomId, newDescription);
```

#### Retrieve or change chat room announcements
All the chat room members can retrieve the chat room announcements.
#### Retrieve or change the chat room announcement
All the chat room members can retrieve the chat room announcement.

Only the chat room owner and admin can set and update the announcements. Once the announcements are updated, all the chat room members receive the `onAnnouncementChanged` callback.
Only the chat room owner and admin can set and update the announcement. Once the announcement is updated, all the chat room members receive the `onAnnouncementChanged` callback.

```java
// Retrieves the chat room announcements.
// Retrieves the chat room announcement.
String announcement = ChatClient.getInstance().chatroomManager().fetchChatRoomAnnouncement(chatRoomId);

// Sets or updates the chat room announcements.
// Sets or updates the chat room announcement.
ChatClient.getInstance().chatroomManager().updateChatRoomAnnouncement(chatRoomId, announcement);
```

Expand Down Expand Up @@ -88,7 +88,7 @@ ChatClient.getInstance().chatroomManager().asyncFetchChatRoomAllAttributesFromSe


#### Set a custom attribute
Chat room members can call `asyncSetChatroomAttributes` to set one single custom attribute. Use this method to add new custom attributes or update existing attributes that set by yourself. After you successfully call this method, other members in the chat room receive an `onAttributesUpdate` callback.
Chat room members can call `asyncSetChatroomAttributes` to set one single custom or update an existing attribute set by themselves. After you successfully call this method, other members in the chat room receive an `onAttributesUpdate` callback.

```java
// Sets a custom attribute by specifying chat room ID, attribute key, and attribute value.
Expand Down Expand Up @@ -118,7 +118,7 @@ ChatClient.getInstance().chatroomManager().asyncSetChatroomAttributesForced(chat


#### Set multiple custom attributes
To set multiple custom attributes, call the `asyncSetChatroomAttributes` method with same name. Use this method to add new custom attributes or update existing attributes that set by yourself. After you successfully call this method, other members in the chat room receive an `onAttributesUpdate` callback.
Chat room members can call the `asyncSetChatroomAttributes` method add new custom attributes or update existing attributes set by themselves. After you successfully call this method, other members in the chat room receive an `onAttributesUpdate` callback.

```java
// Sets multiple custom attribute by specifying chat room ID and the key-value maps of the attributes.
Expand Down Expand Up @@ -148,7 +148,7 @@ ChatClient.getInstance().chatroomManager().asyncSetChatroomAttributesForced(chat


#### Remove a custom attribute
Chat room members can call `asyncRemoveChatRoomAttributesFromServer` to remove one single custom attribute that is set by themselves. After you successfully call this method, other members in the chat room receive an `onAttributesRemoved` callback.
Chat room members can call `asyncRemoveChatRoomAttributeFromServer` to remove one single custom attribute that is set by themselves. After you successfully call this method, other members in the chat room receive an `onAttributesRemoved` callback.

```java
// Removes a custom attribute by specifying chat room ID and attribute key.
Expand All @@ -162,7 +162,7 @@ ChatClient.getInstance().chatroomManager().asyncRemoveChatRoomAttributeFromServe
});
```

If you want to update custom attributes that set by other members, call `asyncRemoveChatRoomAttributesFromServerForced` instead. After you successfully call this method, other members in the chat room receive an `onAttributesRemoved` callback.
If you want to update a custom attribute set by another member, call `asyncRemoveChatRoomAttributeFromServerForced` instead. After you successfully call this method, other members in the chat room receive an `onAttributesRemoved` callback.

```java
// Removes a custom attribute by specifying chat room ID and attribute key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ try {
} on ChatError catch (e) {
}
```

// Note: You can replace the `chat room subject` with `chat room name`.
Please search for `subject` in chat room documents for all platforms and frameworks and replace with `name`.
#### Change the chat room subject or description

Only the chat room owner and admin can set and update the chat room subject and description.
Expand All @@ -65,7 +66,7 @@ try {
}
```

#### Retrieve or change chat room announcements
#### Retrieve or change chat room announcement

All chat room members can retrieve the chat room announcement.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ SDKClient.Instance.RoomManager.AddAttributes(roomId, kv, deleteWhenExit, forced,
onSuccessResult: (Dictionary<string, int> failInfo) => {
if(failInfo.Count == 0)
{
//AddAttributes success
//All custom attributes are successfully set.
}
else
{
//AddAttributes partial success
//Failed to set certain custom attributes.
}
},
onError: (code, desc) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ SDKClient.Instance.RoomManager.AddAttributes(roomId, kv, deleteWhenExit, forced,
onSuccessResult: (Dictionary<string, int> failInfo) => {
if(failInfo.Count == 0)
{
//AddAttributes success
//All custom attributes are successfully set.
}
else
{
//AddAttributes partial success
//Certain custom attributes fail to be set.
}
},
onError: (code, desc) => {
Expand Down
Loading

0 comments on commit 1a3ef3d

Please sign in to comment.