[Update] Bug fixes and performance enhancements.
This commit is contained in:
@@ -6,7 +6,7 @@ class OnUserListener {
|
||||
Function(UserInfo info)? onSelfInfoUpdated;
|
||||
Function(UserStatusInfo info)? onUserStatusChanged;
|
||||
|
||||
OnUserListener({this.onSelfInfoUpdated});
|
||||
OnUserListener({this.onSelfInfoUpdated, this.onUserStatusChanged});
|
||||
|
||||
/// 自身信息发送变化回调
|
||||
void selfInfoUpdated(UserInfo info) {
|
||||
|
||||
@@ -65,7 +65,7 @@ class IMManager {
|
||||
break;
|
||||
case 'onUserStatusChanged':
|
||||
final status = Utils.toObj(data, (map) => UserStatusInfo.fromJson(map));
|
||||
userManager.listener.userStatusChanged(status);
|
||||
userManager.listener.userStatusChanged(status);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.groupListener) {
|
||||
|
||||
@@ -531,8 +531,7 @@ class MessageManager {
|
||||
},
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
|
||||
.then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map)));
|
||||
|
||||
/// 撤回消息
|
||||
/// [message] 被撤回的消息体
|
||||
@@ -587,8 +586,7 @@ class MessageManager {
|
||||
'lastMinSeq': lastMinSeq ?? 0,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
|
||||
.then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
|
||||
|
||||
/// 获取聊天记录(以startMsg为节点,新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息
|
||||
/// [conversationID] 会话id,查询通知时可用
|
||||
@@ -611,8 +609,7 @@ class MessageManager {
|
||||
'lastMinSeq': lastMinSeq ?? 0,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
|
||||
.then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
|
||||
|
||||
/// 查找消息详细
|
||||
/// [conversationID] 会话id
|
||||
@@ -628,8 +625,7 @@ class MessageManager {
|
||||
'searchParams': searchParams.map((e) => e.toJson()).toList(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
|
||||
.then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map)));
|
||||
|
||||
/// 富文本消息
|
||||
/// [text] 输入内容
|
||||
@@ -763,6 +759,22 @@ class MessageManager {
|
||||
return _channel.invokeMethod('setCustomBusinessListener', _buildParam({}));
|
||||
}
|
||||
|
||||
Future setMessageLocalEx({
|
||||
required String conversationID,
|
||||
required String clientMsgID,
|
||||
required String localEx,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setMessageLocalEx',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"clientMsgID": clientMsgID,
|
||||
"localEx": localEx,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}
|
||||
|
||||
///
|
||||
Future setMessageKvInfoListener(OnMessageKvInfoListener listener) {
|
||||
this.messageKvInfoListener = listener;
|
||||
@@ -782,8 +794,7 @@ class MessageManager {
|
||||
'list': list.map((e) => e.toJson()).toList(),
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
|
||||
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
|
||||
|
||||
Future<List<TypeKeySetResult>> deleteMessageReactionExtensions({
|
||||
required Message message,
|
||||
@@ -798,8 +809,7 @@ class MessageManager {
|
||||
'list': list,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
|
||||
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
|
||||
|
||||
Future<List<MessageTypeKeyMapping>> getMessageListReactionExtensions({
|
||||
List<Message> messageList = const [],
|
||||
@@ -812,8 +822,7 @@ class MessageManager {
|
||||
'messageList': messageList.map((e) => e.toJson()).toList(),
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(
|
||||
value, (map) => MessageTypeKeyMapping.fromJson(map)));
|
||||
.then((value) => Utils.toList(value, (map) => MessageTypeKeyMapping.fromJson(map)));
|
||||
|
||||
Future<List<TypeKeySetResult>> addMessageReactionExtensions({
|
||||
required Message message,
|
||||
@@ -828,8 +837,7 @@ class MessageManager {
|
||||
'list': list.map((e) => e.toJson()).toList(),
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
|
||||
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
|
||||
|
||||
Future<List<MessageTypeKeyMapping>> getMessageListSomeReactionExtensions({
|
||||
List<Message> messageList = const [],
|
||||
@@ -844,8 +852,7 @@ class MessageManager {
|
||||
'list': kvList.map((e) => e.toJson()).toList(),
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(
|
||||
value, (map) => MessageTypeKeyMapping.fromJson(map)));
|
||||
.then((value) => Utils.toList(value, (map) => MessageTypeKeyMapping.fromJson(map)));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "messageManager";
|
||||
|
||||
@@ -75,6 +75,76 @@ class UserManager {
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
Future<List<UserStatusInfo>> subscribeUsersStatus(
|
||||
List<String> userIDs, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'subscribeUsersStatus',
|
||||
_buildParam({
|
||||
'userIDs': userIDs,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
Future<List<UserStatusInfo>> unsubscribeUsersStatus(
|
||||
List<String> userIDs, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'unsubscribeUsersStatus',
|
||||
_buildParam({
|
||||
'userIDs': userIDs,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
Future<List<UserStatusInfo>> getSubscribeUsersStatus({
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'getSubscribeUsersStatus',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
Future<List<UserStatusInfo>> getUserStatus(
|
||||
List<String> userIDs, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'getUserStatus',
|
||||
_buildParam({
|
||||
'userIDs': userIDs,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
Future<List<UserInfo>> getUsersInfoStranger(
|
||||
List<String> userIDs,
|
||||
String groupID, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'getUsersInfoStranger',
|
||||
_buildParam({
|
||||
'userIDs': userIDs,
|
||||
'groupID': groupID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => UserInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "userManager";
|
||||
return param;
|
||||
|
||||
@@ -31,7 +31,7 @@ class Message {
|
||||
int? contentType;
|
||||
|
||||
/// 平台[Platform]
|
||||
int? platformID;
|
||||
int? senderPlatformID;
|
||||
|
||||
/// 发送者昵称
|
||||
String? senderNickname;
|
||||
@@ -131,7 +131,7 @@ class Message {
|
||||
this.recvID,
|
||||
this.msgFrom,
|
||||
this.contentType,
|
||||
this.platformID,
|
||||
this.senderPlatformID,
|
||||
this.senderNickname,
|
||||
this.senderFaceUrl,
|
||||
this.groupID,
|
||||
@@ -173,7 +173,7 @@ class Message {
|
||||
recvID = json['recvID'];
|
||||
msgFrom = json['msgFrom'];
|
||||
contentType = json['contentType'];
|
||||
platformID = json['platformID'];
|
||||
senderPlatformID = json['senderPlatformID'];
|
||||
senderNickname = json['senderNickname'];
|
||||
senderFaceUrl = json['senderFaceUrl'];
|
||||
groupID = json['groupID'];
|
||||
@@ -248,7 +248,7 @@ class Message {
|
||||
data['recvID'] = this.recvID;
|
||||
data['msgFrom'] = this.msgFrom;
|
||||
data['contentType'] = this.contentType;
|
||||
data['platformID'] = this.platformID;
|
||||
data['senderPlatformID'] = this.senderPlatformID;
|
||||
data['senderNickname'] = this.senderNickname;
|
||||
data['senderFaceUrl'] = this.senderFaceUrl;
|
||||
data['groupID'] = this.groupID;
|
||||
@@ -302,7 +302,7 @@ class Message {
|
||||
recvID = message.recvID;
|
||||
msgFrom = message.msgFrom;
|
||||
contentType = message.contentType;
|
||||
platformID = message.platformID;
|
||||
senderPlatformID = message.senderPlatformID;
|
||||
senderNickname = message.senderNickname;
|
||||
senderFaceUrl = message.senderFaceUrl;
|
||||
groupID = message.groupID;
|
||||
|
||||
@@ -102,15 +102,9 @@ class UserInfo {
|
||||
// }
|
||||
|
||||
UserInfo.fromJson(Map<String, dynamic> json) {
|
||||
publicInfo = json['publicInfo'] != null
|
||||
? PublicUserInfo.fromJson(json['publicInfo'])
|
||||
: null;
|
||||
friendInfo = json['friendInfo'] != null
|
||||
? FriendInfo.fromJson(json['friendInfo'])
|
||||
: null;
|
||||
blackInfo = json['blackInfo'] != null
|
||||
? BlacklistInfo.fromJson(json['blackInfo'])
|
||||
: null;
|
||||
publicInfo = json['publicInfo'] != null ? PublicUserInfo.fromJson(json['publicInfo']) : null;
|
||||
friendInfo = json['friendInfo'] != null ? FriendInfo.fromJson(json['friendInfo']) : null;
|
||||
blackInfo = json['blackInfo'] != null ? BlacklistInfo.fromJson(json['blackInfo']) : null;
|
||||
//
|
||||
isFriendship = friendInfo != null;
|
||||
isBlacklist = blackInfo != null;
|
||||
@@ -164,25 +158,17 @@ class UserInfo {
|
||||
|
||||
bool get isMale => gender == 1;
|
||||
|
||||
String get _userID => isFriendship!
|
||||
? friendInfo!.userID!
|
||||
: (isBlacklist! ? blackInfo!.userID! : publicInfo!.userID!);
|
||||
String get _userID => isFriendship! ? friendInfo!.userID! : (isBlacklist! ? blackInfo!.userID! : publicInfo!.userID!);
|
||||
|
||||
String? get _nickname => isFriendship!
|
||||
? friendInfo?.nickname
|
||||
: (isBlacklist! ? blackInfo?.nickname : publicInfo?.nickname);
|
||||
String? get _nickname =>
|
||||
isFriendship! ? friendInfo?.nickname : (isBlacklist! ? blackInfo?.nickname : publicInfo?.nickname);
|
||||
|
||||
String? get _faceUrl => isFriendship!
|
||||
? friendInfo?.faceURL
|
||||
: (isBlacklist! ? blackInfo?.faceURL : publicInfo?.faceURL);
|
||||
String? get _faceUrl =>
|
||||
isFriendship! ? friendInfo?.faceURL : (isBlacklist! ? blackInfo?.faceURL : publicInfo?.faceURL);
|
||||
|
||||
int? get _gender => isFriendship!
|
||||
? friendInfo?.gender
|
||||
: (isBlacklist! ? blackInfo?.gender : publicInfo?.gender);
|
||||
int? get _gender => isFriendship! ? friendInfo?.gender : (isBlacklist! ? blackInfo?.gender : publicInfo?.gender);
|
||||
|
||||
String? get _ex => isFriendship!
|
||||
? friendInfo?.ex
|
||||
: (isBlacklist! ? blackInfo?.ex : publicInfo?.ex);
|
||||
String? get _ex => isFriendship! ? friendInfo?.ex : (isBlacklist! ? blackInfo?.ex : publicInfo?.ex);
|
||||
|
||||
String? get _phoneNumber => friendInfo?.phoneNumber;
|
||||
|
||||
@@ -201,10 +187,7 @@ class UserInfo {
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserInfo &&
|
||||
runtimeType == other.runtimeType &&
|
||||
userID == other.userID;
|
||||
identical(this, other) || other is UserInfo && runtimeType == other.runtimeType && userID == other.userID;
|
||||
|
||||
@override
|
||||
int get hashCode => userID.hashCode;
|
||||
@@ -571,14 +554,14 @@ class UserStatusInfo {
|
||||
UserStatusInfo.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['userID'];
|
||||
status = json['status'];
|
||||
platformIDs = json['platformIDs'];
|
||||
platformIDs = json["platformIDs"] == null ? [] : List<int>.from(json["platformIDs"].map((x) => x));
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['userID'] = this.userID;
|
||||
data['status'] = this.status;
|
||||
data['platformIDs'] = this.platformIDs;
|
||||
data['platformIDs'] = List<dynamic>.from(platformIDs!.map((x) => x));
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OpenIM {
|
||||
static const version = '3.2.0';
|
||||
static const version = '3.2.1';
|
||||
|
||||
static const _channel = const MethodChannel('flutter_openim_sdk');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user