Skip to content

Commit 4149696

Browse files
authored
Merge pull request #988 from haoxiuwen/flutter481
Add Flutter SDK 4.8.1 Release Notes
2 parents c1fc684 + 85af317 commit 4149696

File tree

9 files changed

+163
-6
lines changed

9 files changed

+163
-6
lines changed

docs/document/flutter/message_retrieve.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,19 @@ EMConversation? conv =
168168
// 每次获取的消息数量。取值范围为 [1,400]。
169169
count: 50,
170170
);
171+
```
172+
173+
### 获取会话在一定时间内的消息数
174+
175+
你可以调用 `loadMessagesFromTime` 方法从 SDK 本地数据库中获取会话在某个时间段内的全部消息数。
176+
177+
```dart
178+
EMConversation? conversation =
179+
await EMClient.getInstance.chatManager.getConversation(conversationId);
180+
if (conversation != null) {
181+
List<EMMessage> messages = await conversation.loadMessagesFromTime(
182+
startTime: startMs,
183+
endTime: endMs,
184+
);
185+
}
171186
```

docs/document/flutter/message_search.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- `EMChatManager.searchMsgFromDB`:根据关键字搜索会话消息。
1212
- `EMChatManager#loadMessagesWithKeyword`:根据搜索范围搜索所有会话中的消息。
1313
- `EMConversation#loadMessagesWithKeyword`:根据搜索范围搜索当前会话中的消息。
14+
- `EMChatManager#searchMsgsByOptions`:根据单个或多个消息类型,搜索本地数据库中所有会话的消息。
15+
- `EMConversation#searchMsgsByOptions` 根据单个或多个消息类型,搜索本地数据库中单个会话的消息。
1416

1517
## 前提条件
1618

@@ -90,4 +92,58 @@ try {
9092
debugPrint("loadMessagesWithKeyword error: ${e.code}, ${e.description}");
9193
}
9294
93-
```
95+
```
96+
97+
### 根据消息类型搜索所有会话中的消息
98+
99+
你可以调用 `EMChatManager#searchMsgsByOptions` 方法除了设置消息时间戳、消息数量、发送方、搜索方向等条件搜索当前会话中的消息,你还可以设置单个或多个消息类型搜索本地数据库中所有会话的消息。
100+
101+
:::tip
102+
若使用该功能,需将 SDK 升级至 V4.8.1 或以上版本。
103+
:::
104+
105+
```dart
106+
// from:会话中发送方的用户 ID。若传空字符串,搜索对发送方不限制。
107+
// count:要查询的消息条数。取值范围为 [1,400]。
108+
try {
109+
const searchOptions = MessageSearchOptions(
110+
types: [MessageType.TXT, MessageType.IMAGE],
111+
from: fromUser,
112+
ts: startTime,
113+
direction: EMSearchDirection.Up,
114+
count: 50
115+
);
116+
List<EMMessage> msgs =
117+
await EMClient.getInstance.chatManager.searchMsgsByOptions(
118+
searchOptions,
119+
);
120+
} on EMError catch (e) {
121+
debugPrint("error code: ${e.code}, desc: ${e.description}");
122+
}
123+
```
124+
125+
### 根据消息类型搜索当前会话中的消息
126+
127+
你可以调用 `EMConversation#searchMsgsByOptions` 方法除了设置消息时间戳、消息数量、发送方、搜索方向等条件搜索当前会话中的消息,你还可以设置单个或多个消息类型搜索本地数据库中单个会话的消息。
128+
129+
:::tip
130+
若使用该功能,需将 SDK 升级至 V4.8.1 或以上版本。
131+
:::
132+
133+
```dart
134+
// from:当前会话中发送方的用户 ID。若传空字符串,搜索对发送方不限制。
135+
// count:要查询的消息条数。取值范围为 [1,400]。
136+
try {
137+
const searchOptions = MessageSearchOptions(
138+
types: [MessageType.TXT, MessageType.IMAGE],
139+
from: fromUser,
140+
ts: startTime,
141+
direction: EMSearchDirection.Up,
142+
count: 50);
143+
conversation.searchMsgsByOptions(
144+
searchOptions,
145+
);
146+
} on EMError catch (e) {
147+
debugPrint("error code: ${e.code}, desc: ${e.description}");
148+
}
149+
```

docs/document/flutter/multi_device.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,41 @@ final options = EMOptions(appKey: appKey, osType: 1);
137137
EMClient.getInstance.init(options);
138138
```
139139

140+
### 设置登录设备的扩展信息
141+
142+
即时通讯 IM 自 4.8.1 版本开始支持设备的自定义扩展信息,这样在多设备场景下,若有设备被踢下线,被踢设备能获得该设备的自定义扩展信息。
143+
144+
初始化 SDK 时,你可以调用 `EMOptions.loginExtension` 方法设置登录设备的自定义扩展信息。设置后,若因达到了登录设备数量限制而导致在已登录的设备上强制退出时(例如 Android 平台提示 `206` 错误,`USER_LOGIN_ANOTHER_DEVICE`),被踢设备收到的 `EMConnectionEventHandler#onUserDidLoginFromOtherDevice` 回调会包含导致该设备被踢下线的新登录设备的自定义扩展信息。
145+
146+
:::notice
147+
登录成功后才会将该设置发送到服务器。
148+
:::
149+
150+
```dart
151+
// 设置登录设备的扩展信息
152+
final options = EMOptions(appKey: appKey, loginExtension: "extension");
153+
154+
// 添加连接事件监听
155+
EMClient.getInstance.addConnectionEventHandler(
156+
"identifier",
157+
EMConnectionEventHandler(
158+
onUserDidLoginFromOtherDevice: (info) {
159+
debugPrint(info.deviceName);
160+
debugPrint(info.ext);
161+
},
162+
),
163+
);
164+
165+
166+
...
167+
168+
// 移除连接事件监听
169+
EMClient.getInstance.removeConnectionEventHandler("identifier");
170+
...
171+
172+
173+
```
174+
140175
### 强制指定账号从单个设备下线
141176

142177
你可以调用 `kickDevice` 方法通过传入用户 ID 和登录密码或用户 token 将指定账号从单个登录设备踢下线。被踢设备会收到 `onUserKickedByOtherDevice` 回调。调用该方法前,你需要首先通过 `EMClient#fetchLoggedInDevices` 方法获取设备 ID。

docs/document/flutter/releasenote.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
<Toc />
44

5+
## 版本 V4.8.1 2024-10-14
6+
7+
#### 新增特性
8+
9+
- 支持[加入聊天室时携带扩展信息、是否退出之前加入的全部聊天室](room_manage.html#加入聊天室)
10+
- 新增 `EMChatRoomManager.joinChatRoom(String roomId, {bool leaveOther = true,String? ext,})` 方法,支持设置加入聊天室时携带的扩展信息,并指定是否退出所有其他聊天室。
11+
- 新增 `EMChatRoomEventHandler.onMemberJoinedFromChatRoom(String roomId, String participant, String? ext)` 回调,当用户加入聊天室携带了扩展信息时,聊天室内其他人可以在用户加入聊天室的回调中,获取到扩展信息。
12+
- 新增 `EMPushManager.syncConversationsSilentMode()` 方法,支持从服务器获取所有会话的推送通知方式的设置。
13+
- 新增 `EMPushManager.bindDeviceToken(String notifierName, String deviceToken)` 方法。
14+
- 新增 `EMConversation.remindType()` 方法,用于本地存储会话的推送通知方式。
15+
- 新增 `EMConversation.getLocalMessageCount()` 方法,用于[获取 SDK 本地数据库中会话在某个时间段内的全部消息数](message_retrieve.html#获取会话在一定时间内的消息数)
16+
- 新增[设备登录时允许携带自定义消息,并将其传递给被踢的设备](multi_device.html#设置登录设备的扩展信息)
17+
- 新增 `LoginExtensionInfo` 用户设备扩展信息。
18+
- 新增 `EMOptions.loginExtension` 设置登录时携带的扩展信息。
19+
- [IM SDK] 新增根据多个消息类型搜索本地消息:
20+
- `EMChatManager#searchMsgsByOptions`[根据单个或多个消息类型,搜索本地数据库中所有会话的消息](message_search.html#根据消息类型搜索所有会话中的消息)
21+
- `EMConversation#searchMsgsByOptions`[根据单个或多个消息类型,搜索本地数据库中单个会话的消息](message_search.html#根据消息类型搜索当前会话中的消息)
22+
23+
#### 优化
24+
25+
- 支持 AUT 协议, 优化弱网环境下的服务连接成功率;
26+
- `updateHMSPushToken``updateFCMPushToken``updateAPNsDeviceToken` 方法过期,`EMOptions` 中的 `enableOppoPush``enableMiPush``enableMeiZuPush``enableFCM``enableVivoPush``enableHWPush``enableAPNs``enableHonorPush` 过期, 使用 `EMPushManager.bindDeviceToken` 代替;
27+
- 修改 `EMConnectionEventHandler.onUserDidLoginFromOtherDevice(String deviceName)` 方法为 `EMConnectionEventHandler.onUserDidLoginFromOtherDevice(LoginExtensionInfo info)`
28+
29+
#### 修复
30+
31+
- 修复 `fetchConversationsByOptions` 偶尔引起的崩溃;
32+
- 修复拉黑联系人时缓存未及时更新的问题;
33+
- 修复退出登录再登录后推送可能不工作的问题。
34+
535
## 版本 V4.6.1 2024-6-11
636

737
### 新增特性

docs/document/flutter/room_manage.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,27 @@ try {
7878
}
7979
```
8080

81+
同时,你可以调用 `EMChatRoomManager.joinChatRoom` 方法,设置加入聊天室时携带的扩展信息,并指定是否退出所有其他聊天室。调用该方法后,聊天室内其他成员会收到 `EMChatRoomEventHandler.onMemberJoinedFromChatRoom(String roomId, String participant, String? ext)` 回调,当用户加入聊天室携带了扩展信息时,聊天室内其他人可以在用户加入聊天室的回调中,获取到扩展信息。
82+
83+
```dart
84+
EMClient.getInstance.chatRoomManager.joinChatRoom(
85+
"roomId",
86+
leaveOther: false,
87+
ext: 'ext',
88+
);
89+
90+
// 添加聊天室事件监听
91+
EMClient.getInstance.chatRoomManager.addEventHandler(
92+
"identifier",
93+
EMChatRoomEventHandler(
94+
onMemberJoinedFromChatRoom: (roomId, participant, ext) {},
95+
),
96+
);
97+
98+
// 移除聊天室事件监听
99+
EMClient.getInstance.chatRoomManager.removeEventHandler("identifier");
100+
```
101+
81102
### 获取聊天室详情
82103

83104
聊天室所有成员均可以调用 `EMChatManager#fetchChatRoomInfoFromServer` 获取聊天室详情,包括聊天室 ID、聊天室名称,聊天室描述、最大成员数、聊天室所有者、是否全员禁言以及聊天室权限类型。聊天室公告、管理员列表、成员列表、黑名单列表、禁言列表需单独调用接口获取。

docs/product/product_dynamics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
| 动态名称 | 动态描述 | 发布时间 | 相关文档 |
2424
| :----- | :------- | :---------------- | :---------------- |
25-
| SDK 4.8.0 开发版发布 | **新增特性**:<br/> - 移动端支持 AUT 协议,优化弱网环境下的服务连接成功率。<br/> - 移动端支持[本地存储会话的推送通知方式](/document/ios/push/push_notification_mode_dnd.html#从服务器获取所有会话的推送通知方式设置),并支持从服务器获取所有会话的推送通知方式的设置。<br/> - 移动端支持[本地获取指定会话某个时间段内的消息数](/document/android/message_retrieve.html#获取会话在一定时间内的消息数)。<br/> - 客户端支持[加入聊天室时携带的扩展信息,并可指定是否退出所有其他聊天室](/document/android/room_manage.html#加入聊天室)。<br/> - Web 端[设备登录时允许携带自定义扩展消息并传递给被踢的设备](/document/web/multi_device.html#设置登录设备的扩展信息),应用于被踢设备展示提示信息或进行业务判断。<br/> - Web 端支持[使用固定的设备 ID](/document/web/multi_device.html),这会影响多端登录互踢的策略。<br/> - Web 端支持[聊天室所有者解散聊天室](/document/web/room_manage.html#解散聊天室)。<br/>**优化**:<br/> 移动端设置和获取用户属性时,包括[设置当前用户的属性](/document/web/userprofile.html#设置当前用户的属性)、[获取单个或多个用户的用户属性](/document/web/userprofile.html#获取用户属性)和[获取指定用户的指定用户属性](/document/web/userprofile.html#获取指定用户的指定用户属性)时,若超过调用频率限制,会上报错误码 4 `EMErrorExceedServiceLimit`(iOS)或 `EXCEED_SERVICE_LIMIT`(Android)。| 2024-07-01 | <br/> - [Android 4.8.0 更新日志](/document/android/releasenote.html#版本-v4-8-0-dev-2024-07-01-开发版)<br/> - [iOS 4.8.0 更新日志](/document/ios/releasenote.html#版本-v4-8-0-dev-2024-07-01-开发版)。<br/> - [Web 4.8.0 更新日志](/document/web/releasenote.html#版本-v4-8-0-dev-2024-07-01-开发版)。|
25+
| SDK 4.8.0 开发版发布 | **新增特性**:<br/> - 移动端支持 AUT 协议,优化弱网环境下的服务连接成功率。<br/> - 移动端支持[本地存储会话的推送通知方式](/document/ios/push/push_notification_mode_dnd.html#从服务器获取所有会话的推送通知方式设置),并支持从服务器获取所有会话的推送通知方式的设置。<br/> - 移动端支持[本地获取指定会话某个时间段内的消息数](/document/android/message_retrieve.html#获取会话在一定时间内的消息数)。<br/> - 客户端支持[加入聊天室时携带的扩展信息,并可指定是否退出所有其他聊天室](/document/android/room_manage.html#加入聊天室)。<br/> - Web 端[设备登录时允许携带自定义扩展消息并传递给被踢的设备](/document/web/multi_device.html#设置登录设备的扩展信息),应用于被踢设备展示提示信息或进行业务判断。<br/> - Web 端支持[使用固定的设备 ID](/document/web/multi_device.html),这会影响多端登录互踢的策略。<br/> - Web 端支持[聊天室所有者解散聊天室](/document/web/room_manage.html#解散聊天室)。<br/>**优化**:<br/> 移动端设置和获取用户属性时,包括[设置当前用户的属性](/document/web/userprofile.html#设置当前用户的属性)、[获取单个或多个用户的用户属性](/document/web/userprofile.html#获取用户属性)和[获取指定用户的指定用户属性](/document/web/userprofile.html#获取指定用户的指定用户属性)时,若超过调用频率限制,会上报错误码 4 `EMErrorExceedServiceLimit`(iOS)或 `EXCEED_SERVICE_LIMIT`(Android)。| 2024-07-01 | <br/> - [Android 4.8.0 更新日志](/document/android/releasenote.html#版本-v4-8-0-dev-2024-07-01-开发版)<br/> - [iOS 4.8.0 更新日志](/document/ios/releasenote.html#版本-v4-8-0-dev-2024-07-01-开发版)。<br/> - [Web 4.8.0 更新日志](/document/web/releasenote.html#版本-v4-8-0-dev-2024-07-01-开发版)。<br/> - [Flutter 4.8.1 更新日志](/document/flutter/releasenote.html#版本-v4-8-1-dev-2024-10-15-开发版)。|
2626

2727
| 动态名称 | 动态描述 | 发布时间 | 相关文档 |
2828
| :----- | :------- | :---------------- | :---------------- |

docs/uikit/chatuikit/android/chatfeature_message.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
#### 如何使用
4545

46-
消息转发特性在 `EaseChatConfig` 中默认开启,即 `enableReplyMessage` 的默认值为 `true`。要关闭该特性,需将该参数设置为 `false`
46+
消息引用特性在 `EaseChatConfig` 中默认开启,即 `enableReplyMessage` 的默认值为 `true`。要关闭该特性,需将该参数设置为 `false`
4747

4848
示例代码如下:
4949

docs/uikit/chatuikit/android/chatuikit_contactlist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ EaseContactsListFragment.Builder()
130130
class CustomContactListAdapter : EaseContactListAdapter() {
131131
override fun getItemNotEmptyViewType(position: Int): Int {
132132
// 根据消息类型设置自定义 itemViewType。
133-
// 如果使用默认的 itemViewTyp,返回 super.getItemNotEmptyViewType(position) 即可。
133+
// 如果使用默认的 itemViewTyp2,返回 super.getItemNotEmptyViewType(position) 即可。
134134
return CUSTOM_YOUR_CONTACT_TYPE
135135
}
136136

docs/uikit/chatuikit/android/chatuikit_conversation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ EaseConversationListFragment.Builder()
8888
class CustomConversationListAdapter : EaseConversationListAdapter() {
8989
override fun getItemNotEmptyViewType(position: Int): Int {
9090
// 根据消息类型设置自定义 itemViewType。
91-
// 如果使用默认的 itemViewTyp,返回 super.getItemNotEmptyViewType(position) 即可。
91+
// 如果使用默认的 itemViewType,返回 super.getItemNotEmptyViewType(position) 即可。
9292
return CUSTOM_YOUR_CONVERSATION_TYPE
9393
}
9494

@@ -233,7 +233,7 @@ binding?.titleConversations?.setBackgroundColor(ContextCompat.getColor(mContext,
233233

234234
```kotlin
235235

236-
// 是否使用默认的搜索功能(跳转 EaseSearchActivity 搜索页面 目前支持搜索用户、会话、消息、黑名单用户。
236+
// 是否使用默认的搜索功能(跳转 EaseSearchActivity 搜索页面)。目前支持搜索用户、会话、消息、黑名单用户。
237237
// true:是;(默认) false: 否。
238238
EaseConversationListFragment.Builder().useSearchBar(true)
239239

0 commit comments

Comments
 (0)