diff --git a/CHANGELOG.md b/CHANGELOG.md index ec8bda0d..b72a9157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +## 4.1.3 + +#### 新增 + +- 支持 安卓 14; +- 新增 开启 荣耀推送开关 `EMOptions#enableHonorPush` 方法; + +#### 修复 + +- 修复调用 `EMChatManager#getThreadConversation` 报错; +- 修复 `EMMessage#chatThread` 方法报错; +- 修复 `EMChatRoomEventHandler#onSpecificationChanged` 回调不执行。 +- 修复 `EMChatThreadManager#fetchChatThreadMembers` 崩溃。 +- 修复特殊场景下,安卓平台退出后再登录会丢失聊天室监听事件问题。 +- 修复修改消息后,离线用户上线后拉取历史消息,消息体中缺乏 from 属性的问题。 + ## 4.1.0 #### 新增: diff --git a/android/build.gradle b/android/build.gradle index 213dea09..17be4a21 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -48,5 +48,5 @@ tasks.withType(JavaCompile){ dependencies { api 'androidx.appcompat:appcompat:1.1.0' - implementation 'io.hyphenate:hyphenate-chat:4.1.1' + implementation 'io.hyphenate:hyphenate-chat:4.1.3' } diff --git a/android/src/main/java/com/easemob/im_flutter_sdk/EMChatRoomManagerWrapper.java b/android/src/main/java/com/easemob/im_flutter_sdk/EMChatRoomManagerWrapper.java index c4068162..b68d2146 100644 --- a/android/src/main/java/com/easemob/im_flutter_sdk/EMChatRoomManagerWrapper.java +++ b/android/src/main/java/com/easemob/im_flutter_sdk/EMChatRoomManagerWrapper.java @@ -850,7 +850,7 @@ public void onSpecificationChanged(EMChatRoom room) { ()-> { Map data = new HashMap<>(); data.put("room", EMChatRoomHelper.toJson(room)); - data.put("type", "onSpecificationChanged"); + data.put("type", "onRoomSpecificationChanged"); post(() -> channel.invokeMethod(EMSDKMethod.chatRoomChange, data)); } ); diff --git a/android/src/main/java/com/easemob/im_flutter_sdk/EMHelper.java b/android/src/main/java/com/easemob/im_flutter_sdk/EMHelper.java index f9db774c..8ca46008 100644 --- a/android/src/main/java/com/easemob/im_flutter_sdk/EMHelper.java +++ b/android/src/main/java/com/easemob/im_flutter_sdk/EMHelper.java @@ -119,6 +119,9 @@ static EMOptions fromJson(JSONObject json, Context context) throws JSONException if (pushConfig.getBoolean("enableVivoPush")) { builder.enableVivoPush(); } + if(pushConfig.getBoolean("enableHonorPush")) { + builder.enableHonorPush(); + } options.setPushConfig(builder.build()); } return options; @@ -456,7 +459,7 @@ static EMMessage fromJson(JSONObject json) throws JSONException { if (statusFromInt(json.getInt("status")) == EMMessage.Status.SUCCESS) { message.setUnread(!json.getBoolean("hasRead")); } - message.setDeliverAcked(json.getBoolean("hasDeliverAck")); + // message.setDeliverAcked(json.getBoolean("hasDeliverAck")); message.setIsNeedGroupAck(json.getBoolean("needGroupAck")); if (json.has("groupAckCount")) { message.setGroupAckCount(json.getInt("groupAckCount")); @@ -916,7 +919,7 @@ static EMVideoMessageBody videoBodyFromJson(JSONObject json) throws JSONExceptio static Map videoBodyToJson(EMVideoMessageBody body) { Map data = getParentMap(body); data.put("localPath", body.getLocalUrl()); - data.put("thumbnailLocalPath", body.getLocalThumbUri()); + data.put("thumbnailLocalPath", body.getLocalThumb()); data.put("duration", body.getDuration()); data.put("thumbnailRemotePath", body.getThumbnailUrl()); data.put("thumbnailSecret", body.getThumbnailSecret()); @@ -1405,23 +1408,28 @@ static Map toJson(EMChatThread thread) { class EMChatThreadEventHelper { static Map toJson(EMChatThreadEvent event) { Map data = new HashMap<>(); - switch (event.getType()) { - case UNKNOWN: - data.put("type", 0); - break; - case CREATE: - data.put("type", 1); - break; - case UPDATE: - data.put("type", 2); - break; - case DELETE: - data.put("type", 3); - break; - case UPDATE_MSG: - data.put("type", 4); - break; + if(event.getType() != null) { + switch (event.getType()) { + case UNKNOWN: + data.put("type", 0); + break; + case CREATE: + data.put("type", 1); + break; + case UPDATE: + data.put("type", 2); + break; + case DELETE: + data.put("type", 3); + break; + case UPDATE_MSG: + data.put("type", 4); + break; + } + }else { + data.put("type", 0); } + data.put("from", event.getFrom()); if (event.getChatThread() != null) { data.put("thread", EMChatThreadHelper.toJson(event.getChatThread())); diff --git a/android/src/main/java/com/easemob/im_flutter_sdk/EMMessageWrapper.java b/android/src/main/java/com/easemob/im_flutter_sdk/EMMessageWrapper.java index 457087b8..8829bfc7 100644 --- a/android/src/main/java/com/easemob/im_flutter_sdk/EMMessageWrapper.java +++ b/android/src/main/java/com/easemob/im_flutter_sdk/EMMessageWrapper.java @@ -73,10 +73,11 @@ private void getChatThread(JSONObject params, String channelName, MethodChannel. String msgId = params.getString("msgId"); EMMessage msg = getMessageWithId(msgId); asyncRunnable(()->{ - if (msg == null) { + if (msg != null) { onSuccess(result, channelName, msg.getChatThread() != null ? EMChatThreadHelper.toJson(msg.getChatThread()) : null); + }else { + onSuccess(result, channelName, null); } - onSuccess(result, channelName, null); }); } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 844d6704..706925e4 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,9 +1,9 @@ PODS: - Flutter (1.0.0) - - HyphenateChat (4.0.3) + - HyphenateChat (4.1.1) - im_flutter_sdk (0.0.1): - Flutter - - HyphenateChat (= 4.0.3) + - HyphenateChat (= 4.1.1) DEPENDENCIES: - Flutter (from `Flutter`) @@ -21,8 +21,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - HyphenateChat: 35826ebaa42ebac897b39e29a06f2215a060011a - im_flutter_sdk: bbcfbe596ef4682c9518604e1cb319e967f6b163 + HyphenateChat: 95aa4abbad0e763f513acbe21ff9543f50b886cd + im_flutter_sdk: 9242a0d080c2f4ade4a0247a21b034036320233e PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d diff --git a/example/lib/main.dart b/example/lib/main.dart index cdf5ef9b..0068690c 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:im_flutter_sdk/im_flutter_sdk.dart'; -var appKey = "easemob-demo#flutter"; +var appKey = ""; void main() async { WidgetsFlutterBinding.ensureInitialized(); + assert(appKey.isNotEmpty, "appKey is empty"); EMOptions options = EMOptions(appKey: appKey, autoLogin: false, debugModel: true); await EMClient.getInstance.init(options); @@ -297,7 +298,7 @@ class _MyHomePageState extends State { content: _messageContent, ); - EMClient.getInstance.chatManager.sendMessage(msg); + await EMClient.getInstance.chatManager.sendMessage(msg); } void _addLogToConsole(String log) { diff --git a/example/pubspec.lock b/example/pubspec.lock index 6b244eba..4d912413 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -97,7 +97,7 @@ packages: path: ".." relative: true source: path - version: "4.0.3" + version: "4.1.3" js: dependency: transitive description: diff --git a/ios/Classes/EMChatManagerWrapper.m b/ios/Classes/EMChatManagerWrapper.m index b6f3ec31..ea3a1a97 100644 --- a/ios/Classes/EMChatManagerWrapper.m +++ b/ios/Classes/EMChatManagerWrapper.m @@ -1247,4 +1247,8 @@ - (void)onMessageContentChanged:(EMChatMessage *)message operatorId:(NSString *) arguments:dict]; } +- (void)messageAttachmentStatusDidChange:(EMChatMessage *)aMessage error:(EMError *)aError { + +} + @end diff --git a/ios/Classes/EMChatMessageWrapper.m b/ios/Classes/EMChatMessageWrapper.m index 12412519..c9f1dcd2 100644 --- a/ios/Classes/EMChatMessageWrapper.m +++ b/ios/Classes/EMChatMessageWrapper.m @@ -33,7 +33,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { } else if([ChatGroupAckCount isEqualToString:call.method]) { [self getGroupAckCount:call.arguments channelName:call.method result:result]; } else if([ChatThread isEqualToString:call.method]) { - + [self getChatThread:call.arguments channelName:call.method result:result]; } else { [super handleMethodCall:call result:result]; diff --git a/ios/im_flutter_sdk.podspec b/ios/im_flutter_sdk.podspec index bc72e3e4..ff698ee0 100644 --- a/ios/im_flutter_sdk.podspec +++ b/ios/im_flutter_sdk.podspec @@ -21,7 +21,7 @@ A new flutter plugin project. s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' - s.dependency 'HyphenateChat','4.1.0' + s.dependency 'HyphenateChat','4.1.1' s.ios.deployment_target = '11.0' end diff --git a/lib/src/em_chat_manager.dart b/lib/src/em_chat_manager.dart index 3c6ca593..8da50287 100644 --- a/lib/src/em_chat_manager.dart +++ b/lib/src/em_chat_manager.dart @@ -157,14 +157,7 @@ class EMChatManager { /// /// **Throws** 如果有异常会在这里抛出,包含错误码和错误描述,详见 [EMError]。 /// ~end - Future sendMessage( - EMMessage message, { - void Function( - void Function(EMMessage)? onSuccess, - void Function(EMMessage)? onError, - void Function(int)? onProgress, - )? callback, - }) async { + Future sendMessage(EMMessage message) async { message.status = MessageStatus.PROGRESS; Map result = await ChatChannel.invokeMethod( ChatMethodKeys.sendMessage, message.toJson()); @@ -486,16 +479,20 @@ class EMChatManager { /// /// **Throws** 如果有异常会在这里抛出,包含错误码和错误描述,详见 [EMError]。 /// ~end - Future getThreadConversation(String threadId) async { + Future getThreadConversation(String threadId) async { Map result = await ChatChannel.invokeMethod( ChatMethodKeys.getThreadConversation, - {"convId", threadId}, + {"convId": threadId}, ); try { + EMConversation? ret; EMError.hasErrorFromResult(result); - return EMConversation.fromJson( - result[ChatMethodKeys.getThreadConversation]); + if (result[ChatMethodKeys.getThreadConversation] != null) { + ret = EMConversation.fromJson( + result[ChatMethodKeys.getThreadConversation]); + } + return ret; } on EMError catch (e) { throw e; } @@ -1696,7 +1693,7 @@ class EMChatManager { /// 只能调用该方法修改单聊和群聊中的文本消息,不能修改聊天室消息。 /// /// Param [messageId] 消息实例 ID。 - /// + /// /// Param [msgBody] 文本消息体实例 [EMTextMessageBody]。 /// /// **Return** 修改后的消息实例。 diff --git a/lib/src/em_chat_room_manager.dart b/lib/src/em_chat_room_manager.dart index 62f92c1b..2e65b9fb 100644 --- a/lib/src/em_chat_room_manager.dart +++ b/lib/src/em_chat_room_manager.dart @@ -910,7 +910,7 @@ class EMChatRoomManager { /// ~end Future blockChatRoomMembers( String roomId, - List members, + List members, ) async { Map req = {"roomId": roomId, "members": members}; Map result = @@ -947,7 +947,7 @@ class EMChatRoomManager { /// ~end Future unBlockChatRoomMembers( String roomId, - List members, + List members, ) async { Map req = {"roomId": roomId, "members": members}; Map result = diff --git a/lib/src/em_chat_thread_manager.dart b/lib/src/em_chat_thread_manager.dart index afbcd426..1af3c70e 100644 --- a/lib/src/em_chat_thread_manager.dart +++ b/lib/src/em_chat_thread_manager.dart @@ -309,11 +309,11 @@ class EMChatThreadManager { /// /// Param [limit] 每页期望返回的成员数。取值范围为 [1,50]。 /// - /// **Return** 若调用成功,返回子区成员列表;失败则抛出异常。 + /// **Return** 若调用成功,返回子区成员 [EMCursorResult];失败则抛出异常。 /// /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 [EMError]。 /// ~end - Future> fetchChatThreadMembers({ + Future> fetchChatThreadMembers({ required String chatThreadId, String? cursor, int limit = 20, @@ -329,13 +329,9 @@ class EMChatThreadManager { ); try { EMError.hasErrorFromResult(result); - List list = []; - result[ChatMethodKeys.fetchChatThreadMember]?.forEach((element) { - if (element is String) { - list.add(element); - } - }); - return list; + return EMCursorResult.fromJson( + result[ChatMethodKeys.fetchChatThreadMember], + dataItemCallback: (obj) => obj); } on EMError catch (e) { throw e; } @@ -379,7 +375,7 @@ class EMChatThreadManager { } for (var key in map.keys) { - Map msgMap = map[key].cast>(); + Map msgMap = map[key]; ret[key] = EMMessage.fromJson(msgMap); } return ret; diff --git a/lib/src/em_client.dart b/lib/src/em_client.dart index 744d5db2..f8b39933 100644 --- a/lib/src/em_client.dart +++ b/lib/src/em_client.dart @@ -698,7 +698,7 @@ class EMClient { /// ~chinese /// 获取指定账号下登录的在线设备列表。 /// - /// Param [userId] 用户 ID。 + /// Param [userId] 用户 ID。 /// /// Param [pwdOrToken] 密码或者 token。 /// @@ -906,8 +906,8 @@ class EMClient { Future _onMultiDeviceThreadEvent(Map map) async { EMMultiDevicesEvent event = convertIntToEMMultiDevicesEvent(map['event'])!; - String target = map['target']; - List users = map['users']; + String target = map['target'] ?? ''; + List users = map.getList("users") ?? []; for (var handler in _multiDeviceEventHandler.values) { handler.onChatThreadEvent?.call(event, target, users); diff --git a/lib/src/em_contact_manager.dart b/lib/src/em_contact_manager.dart index 04a75bc6..0f677e87 100644 --- a/lib/src/em_contact_manager.dart +++ b/lib/src/em_contact_manager.dart @@ -141,7 +141,7 @@ class EMContactManager { /// /// Param [reason] (可选)添加为好友的原因。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future addContact( String userId, { @@ -181,7 +181,7 @@ class EMContactManager { /// - `true`:是; /// - (默认)`false`:否。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future deleteContact( String username, { @@ -209,7 +209,7 @@ class EMContactManager { /// /// **Return** 联系人列表。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future> getAllContactsFromServer() async { Map result = @@ -241,7 +241,7 @@ class EMContactManager { /// /// **Return** 调用成功会返回好友列表。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future> getAllContactsFromDB() async { Map result = @@ -276,7 +276,7 @@ class EMContactManager { /// /// Param [username] 要加入黑名单的用户的用户 ID。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future addUserToBlockList( String username, @@ -306,7 +306,7 @@ class EMContactManager { /// /// Param [username] 要在黑名单中移除的用户 ID。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future removeUserFromBlockList(String username) async { Map req = {'username': username}; @@ -332,7 +332,7 @@ class EMContactManager { /// /// **Return** 该方法调用成功会返回黑名单列表。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future> getBlockListFromServer() async { Map result = @@ -364,7 +364,7 @@ class EMContactManager { /// /// **Return** 该方法调用成功会返回黑名单列表。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future> getBlockListFromDB() async { Map result = await _channel.invokeMethod(ChatMethodKeys.getBlockListFromDB); @@ -395,7 +395,7 @@ class EMContactManager { /// /// Param [username] 发起好友邀请的用户 ID。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future acceptInvitation(String username) async { Map req = {'username': username}; @@ -421,7 +421,7 @@ class EMContactManager { /// /// Param [username] 发起好友邀请的用户 ID。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future declineInvitation(String username) async { Map req = {'username': username}; @@ -447,7 +447,7 @@ class EMContactManager { /// /// **Return** 该方法调用成功会返回 ID 列表。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future> getSelfIdsOnOtherPlatform() async { Map result = diff --git a/lib/src/em_group_manager.dart b/lib/src/em_group_manager.dart index 56135b29..4c9fad1a 100644 --- a/lib/src/em_group_manager.dart +++ b/lib/src/em_group_manager.dart @@ -153,7 +153,7 @@ class EMGroupManager { /// /// **Return** 群组列表。 /// - /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 {@link EMError}。 + /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 [EMError]。 /// ~end Future> getJoinedGroups() async { Map result = await _channel.invokeMethod(ChatMethodKeys.getJoinedGroups); @@ -193,7 +193,7 @@ class EMGroupManager { /// /// **Return** 当前用户加入的群组的列表。 /// - /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 {@link EMError}。 + /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 [EMError]。 /// ~end Future> fetchJoinedGroupsFromServer({ int pageSize = 20, @@ -242,7 +242,7 @@ class EMGroupManager { /// /// **Return** 包含用于下次获取数据的 cursor 以及群组列表。返回的结果中,当 `EMCursorResult.getCursor()` 为空字符串 ("") 时,表示没有更多数据。 /// - /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 {@link EMError}。 + /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 [EMError]。 /// ~end Future> fetchPublicGroupsFromServer({ int pageSize = 200, @@ -315,7 +315,7 @@ class EMGroupManager { /// /// **Return** 创建成功的群对象。 /// - /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 {@link EMError}。 + /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 [EMError]。 /// ~end Future createGroup({ String? groupName, @@ -418,7 +418,7 @@ class EMGroupManager { /// /// **Return** 分页获取结果 [EMCursorResult],包含用于下次获取数据的 cursor 以及群组成员列表。返回的结果中,当 [EMCursorResult.cursor] 为空字符串 ("") 时,表示没有更多数据。 /// - /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 {@link EMError}。 + /// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 [EMError]。 /// ~end Future> fetchMemberListFromServer( String groupId, { @@ -1847,7 +1847,7 @@ class EMGroupManager { /// /// Param [userId] The user ID of the group member for whom the custom attributes are set. The default value is the current user ID. /// - /// Param [attributes] The map of custom attributes in key-value format. + /// Param [attributes] The map of custom attributes in key-value format. /// In a key-value pair, if the value is set to an empty string, the custom attribute will be deleted. /// /// **Throws** A description of the exception. See [EMError]. diff --git a/lib/src/em_presence_manager.dart b/lib/src/em_presence_manager.dart index e8b822d4..fc2383ff 100644 --- a/lib/src/em_presence_manager.dart +++ b/lib/src/em_presence_manager.dart @@ -108,7 +108,7 @@ class EMPresenceManager { /// /// Param [description] 用户在线状态的扩展信息。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 [EMError]。 /// ~end Future publishPresence( String description, @@ -144,7 +144,7 @@ class EMPresenceManager { /// /// **Return** 返回被订阅用户的当前状态。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 [EMError]。 /// ~end Future> subscribe({ required List members, @@ -178,7 +178,7 @@ class EMPresenceManager { /// /// Param [members] 要取消订阅在线状态的用户 ID 数组。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 [EMError]。 /// ~end Future unsubscribe({ required List members, @@ -214,7 +214,7 @@ class EMPresenceManager { /// /// **Return** 返回订阅的在线状态所属的用户 ID。若当前未订阅任何用户的在线状态,返回空列表。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 [EMError]。 /// ~end Future> fetchSubscribedMembers({ int pageNum = 1, @@ -255,7 +255,7 @@ class EMPresenceManager { /// /// **Return** 被订阅用户的当前状态。 /// - /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 {@link EMError}。 + /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。参见 [EMError]。 /// ~end Future> fetchPresenceStatus({ required List members, diff --git a/lib/src/event_handler/manager_event_handler.dart b/lib/src/event_handler/manager_event_handler.dart index 7d0fe25f..5d93e4ef 100644 --- a/lib/src/event_handler/manager_event_handler.dart +++ b/lib/src/event_handler/manager_event_handler.dart @@ -984,7 +984,7 @@ class EMChatThreadEventHandler { /// ~end /// /// ~chinese - /// Thread 事件监听。 + /// Thread 事件监听。 /// /// Param [onChatThreadCreate] 子区创建回调。 /// diff --git a/lib/src/internal/em_push_config.dart b/lib/src/internal/em_push_config.dart index a9c30ba6..805ccad6 100644 --- a/lib/src/internal/em_push_config.dart +++ b/lib/src/internal/em_push_config.dart @@ -26,7 +26,7 @@ class EMPushConfig { bool? enableVivoPush = false; bool? enableHWPush = false; - + bool? enableHonorPush = false; bool? enableAPNS = false; EMPushConfig(); @@ -48,6 +48,7 @@ class EMPushConfig { enableVivoPush = json.boolValue('enableVivoPush'); enableHWPush = json.boolValue('enableHWPush'); enableAPNS = json.boolValue('enableAPNS'); + enableHonorPush = json.boolValue('enableHonorPush'); } /// @nodoc @@ -68,6 +69,7 @@ class EMPushConfig { data.putIfNotNull("enableHWPush", enableHWPush); data.putIfNotNull("enableVivoPush", enableVivoPush); data.putIfNotNull("enableAPNS", enableAPNS); + data.putIfNotNull("enableHonorPush", enableHonorPush); return data; } diff --git a/lib/src/models/em_message.dart b/lib/src/models/em_message.dart index 52b1aa73..56364f1d 100644 --- a/lib/src/models/em_message.dart +++ b/lib/src/models/em_message.dart @@ -211,7 +211,7 @@ class EMMessage { /// ~chinese /// 消息的扩展字段。 /// ~end - Map? attributes; + Map? attributes; /// ~english /// Whether the message is delivered only when the recipient(s) is/are online: @@ -817,7 +817,7 @@ class EMMessage { /// /// Param [summary] The summary of the combined message. /// - /// Param [compatibleText] The compatible text of the combined message. + /// Param [compatibleText] The compatible text of the combined message. /// /// Param [msgIds] The list of original messages included in the combined message. /// @@ -1049,7 +1049,7 @@ class EMMessage { /// **Throws** 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。 /// ~end Future chatThread() async { - Map req = {"msg": msgId}; + Map req = {"msgId": msgId}; Map result = await _emMessageChannel.invokeMethod(ChatMethodKeys.getChatThread, req); try { diff --git a/lib/src/models/em_options.dart b/lib/src/models/em_options.dart index 88fc3c32..61ed8729 100644 --- a/lib/src/models/em_options.dart +++ b/lib/src/models/em_options.dart @@ -417,6 +417,17 @@ class EMOptions { _pushConfig.apnsCertName = certName; } + /// ~english + /// Enable Honor Push on vivo devices. + /// ~end + /// + /// ~chinese + /// 开启 荣耀 推送。 + /// ~end + void enableHonorPush() { + _pushConfig.enableHonorPush = true; + } + /// ~english /// Sets the app options. /// diff --git a/lib/src/tools/em_extension.dart b/lib/src/tools/em_extension.dart index d82c9d43..91162d92 100644 --- a/lib/src/tools/em_extension.dart +++ b/lib/src/tools/em_extension.dart @@ -26,8 +26,9 @@ extension MapExtension on Map { this[key] = value; } - Map? getMapValue(String key, {Map? defaultValue}) { - Map? ret = {}; + Map? getMapValue(String key, + {Map? defaultValue}) { + Map? ret = {}; if (this.containsKey(key)) { Map tmpMap = this[key]; for (var tmpKey in tmpMap.keys) { diff --git a/pubspec.yaml b/pubspec.yaml index dd746a6b..1fa49101 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: im_flutter_sdk description: Integrate the Chat SDK to enjoy the global IM services with high reliability, ultra-low latency, and high concurrency. -version: 4.1.0 +version: 4.1.3 homepage: https://www.easemob.com/product/im environment: diff --git a/update_to_agora.py b/update_to_agora.py index 79ec5b19..431a5bb4 100644 --- a/update_to_agora.py +++ b/update_to_agora.py @@ -354,6 +354,7 @@ def walkFile(file): "EMConnection":"Connection", "EMMultiDevice":"ChatMultiDevice", "EMChatEventHandler":"ChatEventHandler", + "EMCombineMessageBody":"CombineMessageBody", #podspec