This commit is contained in:
BIN
lib/.DS_Store
vendored
BIN
lib/.DS_Store
vendored
Binary file not shown.
@@ -5,8 +5,6 @@ class OnAdvancedMsgListener {
|
||||
Function(Message msg)? onMsgDeleted;
|
||||
Function(RevokedInfo info)? onNewRecvMessageRevoked;
|
||||
Function(List<ReadReceiptInfo> list)? onRecvC2CReadReceipt;
|
||||
Function(List<ReadReceiptInfo> list)? onRecvGroupReadReceipt;
|
||||
Function(String msgID, List<String> list)? onRecvMessageExtensionsDeleted;
|
||||
Function(Message msg)? onRecvNewMessage;
|
||||
Function(Message msg)? onRecvOfflineNewMessage;
|
||||
Function(Message msg)? onRecvOnlineOnlyMessage;
|
||||
@@ -18,8 +16,6 @@ class OnAdvancedMsgListener {
|
||||
this.onMsgDeleted,
|
||||
this.onNewRecvMessageRevoked,
|
||||
this.onRecvC2CReadReceipt,
|
||||
this.onRecvGroupReadReceipt,
|
||||
this.onRecvMessageExtensionsDeleted,
|
||||
this.onRecvNewMessage,
|
||||
this.onRecvOfflineNewMessage,
|
||||
this.onRecvOnlineOnlyMessage,
|
||||
@@ -39,17 +35,6 @@ class OnAdvancedMsgListener {
|
||||
onRecvC2CReadReceipt?.call(list);
|
||||
}
|
||||
|
||||
/// Group Message Read Receipt
|
||||
void recvGroupReadReceipt(List<ReadReceiptInfo> list) {
|
||||
onRecvGroupReadReceipt?.call(list);
|
||||
}
|
||||
|
||||
/// Received Extended Message Deleted
|
||||
/// [list] TypeKey that was deleted
|
||||
void recvMessageExtensionsDeleted(String msgID, List<String> list) {
|
||||
onRecvMessageExtensionsDeleted?.call(msgID, list);
|
||||
}
|
||||
|
||||
/// Received a new message
|
||||
void recvNewMessage(Message msg) {
|
||||
onRecvNewMessage?.call(msg);
|
||||
|
||||
@@ -8,16 +8,25 @@ class OnUploadLogsListener {
|
||||
}
|
||||
|
||||
class OnUploadFileListener {
|
||||
OnUploadFileListener({
|
||||
this.onComplete,
|
||||
this.onHashPartComplete,
|
||||
this.onHashPartProgress,
|
||||
this.onOpen,
|
||||
this.onPartSize,
|
||||
this.onUploadID,
|
||||
this.onUploadPartComplete,
|
||||
this.onUploadProgress,
|
||||
});
|
||||
|
||||
Function(String id, int size, String url, int type)? onComplete;
|
||||
Function(String id, String partHash, String fileHash)? onHashPartComplete;
|
||||
Function(String id, int index, int size, String partHash)? onHashPartProgress;
|
||||
Function(String id, int size)? onOpen;
|
||||
Function(String id, int partSize, int num)? onPartSize;
|
||||
Function(String id, int fileSize, int streamSize, int storageSize)?
|
||||
onUploadProgress;
|
||||
Function(String id, int fileSize, int streamSize, int storageSize)? onUploadProgress;
|
||||
Function(String id, String uploadID)? onUploadID;
|
||||
Function(String id, int index, int partSize, String partHash)?
|
||||
onUploadPartComplete;
|
||||
Function(String id, int index, int partSize, String partHash)? onUploadPartComplete;
|
||||
|
||||
void complete(String id, int size, String url, int type) {
|
||||
onComplete?.call(id, size, url, type);
|
||||
@@ -39,8 +48,7 @@ class OnUploadFileListener {
|
||||
onPartSize?.call(id, partSize, num);
|
||||
}
|
||||
|
||||
void uploadProgress(
|
||||
String id, int fileSize, int streamSize, int storageSize) {
|
||||
void uploadProgress(String id, int fileSize, int streamSize, int storageSize) {
|
||||
onUploadProgress?.call(id, fileSize, streamSize, storageSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
import '../models/update_req.dart';
|
||||
|
||||
class ConversationManager {
|
||||
MethodChannel _channel;
|
||||
late OnConversationListener listener;
|
||||
@@ -98,14 +101,11 @@ class ConversationManager {
|
||||
required String conversationID,
|
||||
required bool isPinned,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'pinConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPinned": isPinned,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(isPinned: isPinned);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Hide a Conversation
|
||||
/// [conversationID] Conversation ID
|
||||
@@ -161,22 +161,20 @@ class ConversationManager {
|
||||
/// Message Do-Not-Disturb Setting
|
||||
/// [conversationID] Conversation ID
|
||||
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> setConversationRecvMessageOpt({
|
||||
required String conversationID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationRecvMessageOpt',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"status": status,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(recvMsgOpt: status);
|
||||
|
||||
/// Query Do-Not-Disturb Status
|
||||
/// [conversationIDList] List of conversation IDs
|
||||
/// Returns: [{"conversationId":"single_13922222222","result":0}], result values: 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Message Do-Not-Disturb Setting
|
||||
/// [conversationID] Conversation ID
|
||||
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
|
||||
Future<List<dynamic>> getConversationRecvMessageOpt({
|
||||
required List<String> conversationIDList,
|
||||
String? operationID,
|
||||
@@ -193,18 +191,16 @@ class ConversationManager {
|
||||
/// Self-Destruct Messages
|
||||
/// [conversationID] Conversation ID
|
||||
/// [isPrivate] true: enable, false: disable
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> setConversationPrivateChat({
|
||||
required String conversationID,
|
||||
required bool isPrivate,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationPrivateChat',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPrivate": isPrivate,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(isPrivateChat: isPrivate);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Delete a Conversation Locally and from the Server
|
||||
/// [conversationID] Conversation ID
|
||||
@@ -245,16 +241,15 @@ class ConversationManager {
|
||||
|
||||
/// Reset Mentioned (Group At) Flags [GroupAtType]
|
||||
/// [conversationID] Conversation ID
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> resetConversationGroupAtType({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'resetConversationGroupAtType',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(groupAtType: 0);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Query @ All Flag
|
||||
Future<dynamic> getAtAllTag({
|
||||
@@ -271,32 +266,27 @@ class ConversationManager {
|
||||
|
||||
/// Global Do-Not-Disturb
|
||||
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
|
||||
@Deprecated('use [OpenIM.iMManager.userManager.setSelfInfo()] instead')
|
||||
Future<dynamic> setGlobalRecvMessageOpt({
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGlobalRecvMessageOpt',
|
||||
_buildParam({
|
||||
"status": status,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
throw UnimplementedError('setGlobalRecvMessageOpt');
|
||||
}
|
||||
|
||||
/// Set Self-Destruct Message Duration
|
||||
/// [conversationID] Conversation ID
|
||||
/// [burnDuration] Duration in seconds, default: 30s
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future<dynamic> setConversationBurnDuration({
|
||||
required String conversationID,
|
||||
int burnDuration = 30,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationBurnDuration',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"burnDuration": burnDuration,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = ConversationReq(burnDuration: burnDuration);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Mark Messages as Read
|
||||
/// [conversationID] Conversation ID
|
||||
@@ -311,36 +301,6 @@ class ConversationManager {
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Enable Regular Deletion
|
||||
/// [isMsgDestruct] true: enable
|
||||
Future<dynamic> setConversationIsMsgDestruct({
|
||||
required String conversationID,
|
||||
bool isMsgDestruct = true,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationIsMsgDestruct',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isMsgDestruct": isMsgDestruct,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Regularly Delete Chat Records
|
||||
/// [duration] Seconds
|
||||
Future<dynamic> setConversationMsgDestructTime({
|
||||
required String conversationID,
|
||||
int duration = 1 * 24 * 60 * 60,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationMsgDestructTime',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"duration": duration,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// search Conversations
|
||||
Future<List<ConversationInfo>> searchConversations(
|
||||
String name, {
|
||||
@@ -356,18 +316,15 @@ class ConversationManager {
|
||||
.then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
@Deprecated('use [setConversation] instead')
|
||||
Future setConversationEx(
|
||||
String conversationID, {
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setConversationEx',
|
||||
_buildParam({
|
||||
'conversationID': conversationID,
|
||||
'ex': ex,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
final req = ConversationReq(ex: ex);
|
||||
|
||||
return setConversation(conversationID, req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Custom Sort for Conversation List
|
||||
@@ -424,14 +381,34 @@ class ConversationManager {
|
||||
),
|
||||
)
|
||||
.then((value) {
|
||||
print('getInputStates: $value');
|
||||
final result = Utils.toListMap(value);
|
||||
return List<int>.from(result);
|
||||
});
|
||||
}
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
Future setConversation(
|
||||
String conversationID,
|
||||
ConversationReq req, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setConversation',
|
||||
_buildParam(
|
||||
{
|
||||
'conversationID': conversationID,
|
||||
'req': req.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "conversationManager";
|
||||
param = Utils.cleanMap(param);
|
||||
log('param: $param');
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
import '../models/update_req.dart';
|
||||
|
||||
class FriendshipManager {
|
||||
MethodChannel _channel;
|
||||
late OnFriendshipListener listener;
|
||||
@@ -15,8 +19,9 @@ class FriendshipManager {
|
||||
|
||||
/// Query Friend Information
|
||||
/// [userIDList] List of user IDs
|
||||
Future<List<FullUserInfo>> getFriendsInfo({
|
||||
Future<List<PublicUserInfo>> getFriendsInfo({
|
||||
required List<String> userIDList,
|
||||
bool filterBlack = false,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
@@ -24,9 +29,10 @@ class FriendshipManager {
|
||||
'getFriendsInfo',
|
||||
_buildParam({
|
||||
"userIDList": userIDList,
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
/// Send a Friend Request, the other party needs to accept the request to become friends.
|
||||
/// [userID] User ID to be invited
|
||||
@@ -63,23 +69,35 @@ class FriendshipManager {
|
||||
.then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
|
||||
|
||||
/// Get Friend List, including friends who have been put into the blacklist
|
||||
Future<List<FullUserInfo>> getFriendList({String? operationID}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendList',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
Future<List<PublicUserInfo>> getFriendList({
|
||||
String? operationID,
|
||||
bool filterBlack = false,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getFriendList',
|
||||
_buildParam({
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
Future<List<FullUserInfo>> getFriendListPage({String? operationID, int offset = 0, int count = 40}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
Future<List<PublicUserInfo>> getFriendListPage({
|
||||
bool filterBlack = false,
|
||||
int offset = 0,
|
||||
int count = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
/// Get Friend List, including friends who have been put into the blacklist (returns a map)
|
||||
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel
|
||||
@@ -90,31 +108,36 @@ class FriendshipManager {
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
Future<List<dynamic>> getFriendListPageMap({String? operationID, int offset = 0, int count = 40}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
Future<List<dynamic>> getFriendListPageMap({
|
||||
bool filterBlack = false,
|
||||
String? operationID,
|
||||
int offset = 0,
|
||||
int count = 40,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getFriendListPage',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'filterBlack': filterBlack,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// Set Friend's Remark
|
||||
/// [userID] Friend's userID
|
||||
/// [remark] Friend's remark
|
||||
@Deprecated('Use [updateFriends] instead')
|
||||
Future<dynamic> setFriendRemark({
|
||||
required String userID,
|
||||
required String remark,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setFriendRemark',
|
||||
_buildParam({
|
||||
'toUserID': userID,
|
||||
'remark': remark,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = UpdateFriendsReq(friendUserIDs: [userID], remark: remark);
|
||||
|
||||
return updateFriends(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Add to Blacklist
|
||||
/// [userID] Friend's ID to be added to the blacklist
|
||||
@@ -239,22 +262,35 @@ class FriendshipManager {
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => SearchFriendsInfo.fromJson(map)));
|
||||
|
||||
Future<String?> setFriendsEx(
|
||||
@Deprecated('Use [updateFriends] instead')
|
||||
Future setFriendsEx(
|
||||
List<String> friendIDs, {
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setFriendsEx',
|
||||
_buildParam({
|
||||
"friendIDs": friendIDs,
|
||||
"ex": ex,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
final req = UpdateFriendsReq(friendUserIDs: friendIDs, ex: ex);
|
||||
|
||||
return updateFriends(req, operationID: operationID);
|
||||
}
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
Future<dynamic> updateFriends(
|
||||
UpdateFriendsReq updateFriendsReq, {
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'updateFriends',
|
||||
_buildParam({
|
||||
'req': updateFriendsReq.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => value);
|
||||
}
|
||||
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "friendshipManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:developer';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
import 'package:flutter_openim_sdk/src/models/set_group_member_info.dart';
|
||||
|
||||
class GroupManager {
|
||||
MethodChannel _channel;
|
||||
@@ -18,39 +19,43 @@ class GroupManager {
|
||||
/// Invite users to a group, allowing them to join without approval.
|
||||
/// [groupID] Group ID
|
||||
/// [userIDList] List of user IDs
|
||||
Future inviteUserToGroup({
|
||||
Future<List<GroupInviteResult>> inviteUserToGroup({
|
||||
required String groupID,
|
||||
required List<String> userIDList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'inviteUserToGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'inviteUserToGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// Remove group members
|
||||
/// [groupID] Group ID
|
||||
/// [userIDList] List of user IDs
|
||||
/// [reason] Reason for removal
|
||||
Future kickGroupMember({
|
||||
Future<List<GroupInviteResult>> kickGroupMember({
|
||||
required String groupID,
|
||||
required List<String> userIDList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'kickGroupMember',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'kickGroupMember',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userIDList': userIDList,
|
||||
'reason': reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// Query group member information
|
||||
/// [groupID] Group ID
|
||||
@@ -213,15 +218,17 @@ class GroupManager {
|
||||
|
||||
/// Apply to join a group, requiring approval from an administrator or the group.
|
||||
/// [joinSource] 2: Invited, 3: Searched, 4: Using a QR code
|
||||
Future<dynamic> joinGroup({required String groupID, String? reason, String? operationID, int joinSource = 3, String? ex}) => _channel.invokeMethod(
|
||||
'joinGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'reason': reason,
|
||||
'joinSource': joinSource,
|
||||
'ex': ex,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
Future<dynamic> joinGroup(
|
||||
{required String groupID, String? reason, String? operationID, int joinSource = 3, String? ex}) =>
|
||||
_channel.invokeMethod(
|
||||
'joinGroup',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'reason': reason,
|
||||
'joinSource': joinSource,
|
||||
'ex': ex,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Exit a group
|
||||
Future<dynamic> quitGroup({
|
||||
@@ -357,20 +364,17 @@ class GroupManager {
|
||||
/// [groupID] Group ID
|
||||
/// [userID] User ID of the group member
|
||||
/// [groupNickname] Group nickname
|
||||
@Deprecated('Use [setGroupMemberInfo] instead')
|
||||
Future<dynamic> setGroupMemberNickname({
|
||||
required String groupID,
|
||||
required String userID,
|
||||
String? groupNickname,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupMemberNickname',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'groupNickname': groupNickname ?? '',
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = SetGroupMemberInfo(groupID: groupID, userID: userID, nickname: groupNickname);
|
||||
|
||||
return setGroupMemberInfo(groupMembersInfo: req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Query a group
|
||||
/// [keywordList] Search keywords; currently, only one keyword is supported, and it cannot be empty.
|
||||
@@ -399,20 +403,17 @@ class GroupManager {
|
||||
/// [groupID] Group ID
|
||||
/// [userID] User ID of the group member
|
||||
/// [roleLevel] Role level; see [GroupRoleLevel]
|
||||
@Deprecated('Use [setGroupMemberInfo] instead')
|
||||
Future<dynamic> setGroupMemberRoleLevel({
|
||||
required String groupID,
|
||||
required String userID,
|
||||
required int roleLevel,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupMemberRoleLevel',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'userID': userID,
|
||||
'roleLevel': roleLevel,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = SetGroupMemberInfo(groupID: groupID, userID: userID, roleLevel: roleLevel);
|
||||
|
||||
return setGroupMemberInfo(groupMembersInfo: req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Get a group member list based on join time
|
||||
Future<List<GroupMembersInfo>> getGroupMemberListByJoinTime({
|
||||
@@ -441,50 +442,44 @@ class GroupManager {
|
||||
/// Set group verification for joining
|
||||
/// [groupID] Group ID
|
||||
/// [needVerification] Verification setting; see [GroupVerification] class
|
||||
@Deprecated('Use [setGroupInfo] instead')
|
||||
Future<dynamic> setGroupVerification({
|
||||
required String groupID,
|
||||
required int needVerification,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupVerification',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'needVerification': needVerification,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = GroupInfo(groupID: groupID, needVerification: needVerification);
|
||||
|
||||
/// Allow/disallow members to view each other's information through the group
|
||||
/// [groupID] Group ID
|
||||
/// [status] 0: Disable, 1: Enable
|
||||
Future<dynamic> setGroupLookMemberInfo({
|
||||
required String groupID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupLookMemberInfo',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'status': status,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
return setGroupInfo(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Allow/disallow members to add friends through the group
|
||||
/// [groupID] Group ID
|
||||
/// [status] 0: Disable, 1: Enable
|
||||
@Deprecated('Use [setGroupInfo] instead')
|
||||
Future<dynamic> setGroupLookMemberInfo({
|
||||
required String groupID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) {
|
||||
final req = GroupInfo(groupID: groupID, lookMemberInfo: status);
|
||||
|
||||
return setGroupInfo(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Allow/disallow members to add friends through the group
|
||||
/// [groupID] Group ID
|
||||
/// [status] 0: Disable, 1: Enable
|
||||
@Deprecated('Use [setGroupInfo] instead')
|
||||
Future<dynamic> setGroupApplyMemberFriend({
|
||||
required String groupID,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupApplyMemberFriend',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
'status': status,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
final req = GroupInfo(groupID: groupID, applyMemberFriend: status);
|
||||
|
||||
return setGroupInfo(req, operationID: operationID);
|
||||
}
|
||||
|
||||
/// Get group owners and administrators
|
||||
/// [groupId] Group ID
|
||||
@@ -567,7 +562,7 @@ class GroupManager {
|
||||
|
||||
/// Modify the GroupMemberInfo ex field
|
||||
Future<dynamic> setGroupMemberInfo({
|
||||
required GroupMembersInfo groupMembersInfo,
|
||||
required SetGroupMemberInfo groupMembersInfo,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
@@ -590,9 +585,13 @@ class GroupManager {
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "groupManager";
|
||||
param = Utils.cleanMap(param);
|
||||
log('param: $param');
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
@@ -141,18 +142,6 @@ class IMManager {
|
||||
var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
|
||||
messageManager.msgListener.recvC2CReadReceipt(list);
|
||||
break;
|
||||
case 'onRecvGroupReadReceipt':
|
||||
var value = call.arguments['data']['groupMsgReceiptList'];
|
||||
var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
|
||||
messageManager.msgListener.recvGroupReadReceipt(list);
|
||||
break;
|
||||
case 'onRecvMessageExtensionsDeleted':
|
||||
var msgID = call.arguments['data']['msgID'];
|
||||
var value = call.arguments['data']['reactionExtensionKeyList'];
|
||||
var list = Utils.toList(value, (map) => '$map');
|
||||
messageManager.msgListener.recvMessageExtensionsDeleted(msgID, list);
|
||||
break;
|
||||
|
||||
case 'onRecvNewMessage':
|
||||
var value = call.arguments['data']['message'];
|
||||
final msg = Utils.toObj(value, (map) => Message.fromJson(map));
|
||||
@@ -367,10 +356,8 @@ class IMManager {
|
||||
OnConnectListener listener, {
|
||||
String? operationID,
|
||||
}) {
|
||||
this._connectListener = listener;
|
||||
if (config.logFilePath == null) {
|
||||
config.logFilePath = config.dataDir;
|
||||
}
|
||||
_connectListener = listener;
|
||||
config.logFilePath ??= config.dataDir;
|
||||
return _channel.invokeMethod(
|
||||
'initSDK',
|
||||
_buildParam(
|
||||
@@ -387,7 +374,6 @@ class IMManager {
|
||||
/// [apiAddr] SDK API address
|
||||
/// [wsAddr] SDK WebSocket address
|
||||
/// [dataDir] SDK database storage directory
|
||||
/// [objectStorage] Object storage minio
|
||||
/// [logLevel] Log level, 1: no printing
|
||||
/// [enabledEncryption] true: encryption
|
||||
/// [enabledCompression] true: compression
|
||||
@@ -398,12 +384,13 @@ class IMManager {
|
||||
required String dataDir,
|
||||
required OnConnectListener listener,
|
||||
int logLevel = 6,
|
||||
bool isNeedEncryption = false,
|
||||
bool isCompression = false,
|
||||
bool isLogStandardOutput = true,
|
||||
String? logFilePath,
|
||||
String? operationID,
|
||||
}) {
|
||||
this._connectListener = listener;
|
||||
_connectListener = listener;
|
||||
return _channel.invokeMethod(
|
||||
'initSDK',
|
||||
_buildParam(
|
||||
@@ -414,8 +401,10 @@ class IMManager {
|
||||
"dataDir": dataDir,
|
||||
"logLevel": logLevel,
|
||||
"isCompression": isCompression,
|
||||
'isNeedEncryption': isNeedEncryption,
|
||||
"isLogStandardOutput": isLogStandardOutput,
|
||||
"logFilePath": logFilePath,
|
||||
'systemType': 'flutter',
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
},
|
||||
),
|
||||
@@ -535,7 +524,7 @@ class IMManager {
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 上传日志
|
||||
/// Upload logs
|
||||
Future uploadLogs({
|
||||
String? ex,
|
||||
int line = 0,
|
||||
@@ -549,6 +538,27 @@ class IMManager {
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
Future logs({
|
||||
int logLevel = 5,
|
||||
String? file,
|
||||
int line = 0,
|
||||
String? msgs,
|
||||
String? err,
|
||||
List<dynamic>? keyAndValues,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'logs',
|
||||
_buildParam({
|
||||
'line': line,
|
||||
'logLevel': logLevel,
|
||||
'file': file,
|
||||
'msgs': msgs,
|
||||
'err': err,
|
||||
if (keyAndValues != null) 'keyAndValue': jsonEncode(keyAndValues),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
void setUploadLogsListener(OnUploadLogsListener listener) {
|
||||
_uploadLogsListener = listener;
|
||||
}
|
||||
@@ -569,8 +579,10 @@ class IMManager {
|
||||
|
||||
MethodChannel get channel => _channel;
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "imManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,18 +147,14 @@ class MessageManager {
|
||||
|
||||
/// Typing status update
|
||||
/// [msgTip] Custom content
|
||||
@Deprecated('Use [OpenIM.iMManager.conversationManager.changeInputStates(conversationID:focus:)] instead')
|
||||
Future typingStatusUpdate({
|
||||
required String userID,
|
||||
String? msgTip,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'typingStatusUpdate',
|
||||
_buildParam({
|
||||
"msgTip": msgTip,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
}) {
|
||||
throw UnimplementedError('typingStatusUpdate');
|
||||
}
|
||||
|
||||
/// Create a text message
|
||||
Future<Message> createTextMessage({
|
||||
@@ -551,6 +547,7 @@ class MessageManager {
|
||||
/// Mark messages as read
|
||||
/// [conversationID] Conversation ID
|
||||
/// [messageIDList] List of clientMsgIDs of messages to be marked as read
|
||||
@Deprecated('Use markConversationMessageAsRead instead')
|
||||
Future markMessagesAsReadByMsgID({
|
||||
required String conversationID,
|
||||
required List<String> messageIDList,
|
||||
@@ -791,8 +788,10 @@ class MessageManager {
|
||||
}));
|
||||
}
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "messageManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class UserManager {
|
||||
|
||||
/// Get user information
|
||||
/// [userIDList] List of user IDs
|
||||
Future<List<FullUserInfo>> getUsersInfo({
|
||||
Future<List<PublicUserInfo>> getUsersInfo({
|
||||
required List<String> userIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
@@ -26,7 +26,7 @@ class UserManager {
|
||||
'userIDList': userIDList,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => FullUserInfo.fromJson(v)));
|
||||
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
|
||||
|
||||
/// Get information of the currently logged-in user
|
||||
Future<UserInfo> getSelfUserInfo({
|
||||
@@ -48,17 +48,16 @@ class UserManager {
|
||||
Future<String?> setSelfInfo({
|
||||
String? nickname,
|
||||
String? faceURL,
|
||||
int? appManagerLevel,
|
||||
int? globalRecvMsgOpt,
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setSelfInfo',
|
||||
_buildParam({
|
||||
// 'userID': userID,
|
||||
'nickname': nickname,
|
||||
'faceURL': faceURL,
|
||||
'appManagerLevel': appManagerLevel,
|
||||
'globalRecvMsgOpt': globalRecvMsgOpt,
|
||||
'ex': ex,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
@@ -115,37 +114,28 @@ class UserManager {
|
||||
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
|
||||
}
|
||||
|
||||
Future<List<FullUserInfo>> getUsersInfoWithCache(
|
||||
@Deprecated('Use [getUsersInfo] instead')
|
||||
Future<List<PublicUserInfo>> getUsersInfoWithCache(
|
||||
List<String> userIDs, {
|
||||
String? groupID,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'getUsersInfoWithCache',
|
||||
_buildParam({
|
||||
'userIDs': userIDs,
|
||||
'groupID': groupID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => FullUserInfo.fromJson(map)));
|
||||
return getUsersInfo(userIDList: userIDs, operationID: operationID);
|
||||
}
|
||||
|
||||
/*
|
||||
Future<String?> setSelfUserInfoEx(
|
||||
UserInfo userInfo, {
|
||||
/// Global Do Not Disturb
|
||||
/// [status] 0: Normal; 1: Do not accept messages; 2: Accept online messages but not offline messages;
|
||||
@Deprecated('use [setSelfInfo] instead')
|
||||
Future<dynamic> setGlobalRecvMessageOpt({
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel.invokeMethod(
|
||||
'setSelfUserInfoEx',
|
||||
_buildParam({
|
||||
...userInfo.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
return setSelfInfo(globalRecvMsgOpt: status);
|
||||
}
|
||||
*/
|
||||
static Map _buildParam(Map param) {
|
||||
|
||||
static Map _buildParam(Map<String, dynamic> param) {
|
||||
param["ManagerName"] = "userManager";
|
||||
param = Utils.cleanMap(param);
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,16 +115,11 @@ class GroupInfo {
|
||||
}
|
||||
|
||||
/// Corresponding Conversation Type for Group Type
|
||||
int get sessionType => groupType == GroupType.general
|
||||
? ConversationType.group
|
||||
: ConversationType.superGroup;
|
||||
int get sessionType => groupType == GroupType.general ? ConversationType.group : ConversationType.superGroup;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is GroupInfo &&
|
||||
runtimeType == other.runtimeType &&
|
||||
groupID == other.groupID;
|
||||
identical(this, other) || other is GroupInfo && runtimeType == other.runtimeType && groupID == other.groupID;
|
||||
|
||||
@override
|
||||
int get hashCode => groupID.hashCode;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class InitConfig {
|
||||
String systemType;
|
||||
int platformID;
|
||||
String apiAddr;
|
||||
String wsAddr;
|
||||
@@ -6,6 +7,7 @@ class InitConfig {
|
||||
int logLevel;
|
||||
bool isLogStandardOutput;
|
||||
String? logFilePath;
|
||||
bool enabledCompression;
|
||||
|
||||
InitConfig({
|
||||
required this.platformID,
|
||||
@@ -15,18 +17,21 @@ class InitConfig {
|
||||
this.logLevel = 6,
|
||||
this.isLogStandardOutput = true,
|
||||
this.logFilePath,
|
||||
this.enabledCompression = false,
|
||||
this.systemType = 'flutter',
|
||||
});
|
||||
|
||||
factory InitConfig.fromJson(Map<String, dynamic> json) {
|
||||
return InitConfig(
|
||||
platformID: json['platformID'],
|
||||
apiAddr: json['apiAddr'],
|
||||
wsAddr: json['wsAddr'],
|
||||
dataDir: json['dataDir'],
|
||||
logLevel: json['logLevel'],
|
||||
isLogStandardOutput: json['isLogStandardOutput'],
|
||||
logFilePath: json['logFilePath'],
|
||||
);
|
||||
platformID: json['platformID'],
|
||||
apiAddr: json['apiAddr'],
|
||||
wsAddr: json['wsAddr'],
|
||||
dataDir: json['dataDir'],
|
||||
logLevel: json['logLevel'],
|
||||
isLogStandardOutput: json['isLogStandardOutput'],
|
||||
logFilePath: json['logFilePath'],
|
||||
enabledCompression: json['isCompression'],
|
||||
systemType: json['systemType']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
@@ -38,6 +43,8 @@ class InitConfig {
|
||||
'logLevel': logLevel,
|
||||
'isLogStandardOutput': isLogStandardOutput,
|
||||
'logFilePath': logFilePath,
|
||||
'isCompression': enabledCompression,
|
||||
'systemType': systemType,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
41
lib/src/models/set_group_member_info.dart
Normal file
41
lib/src/models/set_group_member_info.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
class SetGroupMemberInfo {
|
||||
SetGroupMemberInfo({
|
||||
required this.groupID,
|
||||
required this.userID,
|
||||
this.roleLevel,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
final String groupID;
|
||||
final String userID;
|
||||
final int? roleLevel;
|
||||
final String? nickname;
|
||||
final String? faceURL;
|
||||
final String? ex;
|
||||
|
||||
SetGroupMemberInfo.fromJson(Map<String, dynamic> json)
|
||||
: groupID = json['groupID'],
|
||||
userID = json['userID'],
|
||||
roleLevel = json['roleLevel'],
|
||||
nickname = json['nickname'],
|
||||
faceURL = json['faceURL'],
|
||||
ex = json['ex'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['groupID'] = groupID;
|
||||
data['userID'] = userID;
|
||||
data['roleLevel'] = roleLevel;
|
||||
data['nickname'] = nickname;
|
||||
data['faceURL'] = faceURL;
|
||||
data['ex'] = ex;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetGroupMemberInfo{groupID: $groupID, userID: $userID, roleLevel: $roleLevel, nickname: $nickname, faceURL: $faceURL, ex: $ex}';
|
||||
}
|
||||
}
|
||||
91
lib/src/models/update_req.dart
Normal file
91
lib/src/models/update_req.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
class UpdateFriendsReq {
|
||||
final String? ownerUserID;
|
||||
final List<String>? friendUserIDs;
|
||||
final bool? isPinned;
|
||||
final String? remark;
|
||||
final String? ex;
|
||||
|
||||
UpdateFriendsReq({
|
||||
this.ownerUserID,
|
||||
this.friendUserIDs,
|
||||
this.isPinned,
|
||||
this.remark,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
UpdateFriendsReq.fromJson(Map<String, dynamic> json)
|
||||
: ownerUserID = json['ownerUserID'],
|
||||
friendUserIDs = json['friendUserIDs'],
|
||||
isPinned = json['isPinned'],
|
||||
remark = json['remark'],
|
||||
ex = json['ex'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['ownerUserID'] = ownerUserID;
|
||||
data['friendUserIDs'] = friendUserIDs;
|
||||
data['isPinned'] = isPinned;
|
||||
data['remark'] = remark;
|
||||
data['ex'] = ex;
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateFriendsReq{ownerUserID: $ownerUserID, friendUserIDs: $friendUserIDs, isPinned: $isPinned, remark: $remark, ex: $ex}';
|
||||
}
|
||||
}
|
||||
|
||||
class ConversationReq {
|
||||
final String? userID;
|
||||
final String? groupID;
|
||||
final int? recvMsgOpt;
|
||||
final bool? isPinned;
|
||||
final bool? isPrivateChat;
|
||||
final String? ex;
|
||||
final int? burnDuration;
|
||||
final bool? isMsgDestruct;
|
||||
final int? msgDestructTime;
|
||||
final int? groupAtType;
|
||||
|
||||
ConversationReq({
|
||||
this.userID,
|
||||
this.groupID,
|
||||
this.recvMsgOpt,
|
||||
this.isPinned,
|
||||
this.isPrivateChat,
|
||||
this.ex,
|
||||
this.burnDuration,
|
||||
this.isMsgDestruct,
|
||||
this.msgDestructTime,
|
||||
this.groupAtType,
|
||||
});
|
||||
|
||||
ConversationReq.fromJson(Map<String, dynamic> json)
|
||||
: userID = json['userID'],
|
||||
groupID = json['groupID'],
|
||||
recvMsgOpt = json['recvMsgOpt'],
|
||||
isPinned = json['isPinned'],
|
||||
isPrivateChat = json['isPrivateChat'],
|
||||
ex = json['ex'],
|
||||
burnDuration = json['burnDuration'],
|
||||
isMsgDestruct = json['isMsgDestruct'],
|
||||
msgDestructTime = json['msgDestructTime'],
|
||||
groupAtType = json['groupAtType'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
data['userID'] = userID;
|
||||
data['groupID'] = groupID;
|
||||
data['recvMsgOpt'] = recvMsgOpt;
|
||||
data['isPinned'] = isPinned;
|
||||
data['isPrivateChat'] = isPrivateChat;
|
||||
data['ex'] = ex;
|
||||
data['burnDuration'] = burnDuration;
|
||||
data['isMsgDestruct'] = isMsgDestruct;
|
||||
data['msgDestructTime'] = msgDestructTime;
|
||||
data['groupAtType'] = groupAtType;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -74,48 +74,6 @@ class UserInfo {
|
||||
int get hashCode => userID.hashCode;
|
||||
}
|
||||
|
||||
class FullUserInfo {
|
||||
/// User's public information
|
||||
PublicUserInfo? publicInfo;
|
||||
|
||||
/// Information visible only to friends
|
||||
FriendInfo? friendInfo;
|
||||
|
||||
/// Blacklist information
|
||||
BlacklistInfo? blackInfo;
|
||||
|
||||
FullUserInfo.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;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['publicInfo'] = this.publicInfo?.toJson();
|
||||
data['friendInfo'] = this.friendInfo?.toJson();
|
||||
data['blackInfo'] = this.blackInfo?.toJson();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
String get userID {
|
||||
return publicInfo?.userID ?? friendInfo?.userID ?? blackInfo?.userID ?? '';
|
||||
}
|
||||
|
||||
String get nickname {
|
||||
return publicInfo?.nickname ?? friendInfo?.nickname ?? blackInfo?.nickname ?? '';
|
||||
}
|
||||
|
||||
String get faceURL {
|
||||
return publicInfo?.faceURL ?? friendInfo?.faceURL ?? blackInfo?.faceURL ?? '';
|
||||
}
|
||||
|
||||
String get showName {
|
||||
return friendInfo?.nickname ?? nickname;
|
||||
}
|
||||
}
|
||||
|
||||
class PublicUserInfo {
|
||||
/// User ID
|
||||
String? userID;
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OpenIM {
|
||||
static const version = '3.8.1-rc.0';
|
||||
static const version = '3.8.1';
|
||||
|
||||
static const _channel = const MethodChannel('flutter_openim_sdk');
|
||||
static const _channel = MethodChannel('flutter_openim_sdk');
|
||||
|
||||
static final iMManager = IMManager(_channel);
|
||||
|
||||
|
||||
@@ -4,13 +4,21 @@ class Utils {
|
||||
static List<T> toList<T>(String value, T f(Map<String, dynamic> map)) =>
|
||||
(formatJson(value) as List).map((e) => f(e)).toList();
|
||||
|
||||
static T toObj<T>(String value, T f(Map<String, dynamic> map)) =>
|
||||
f(formatJson(value));
|
||||
static T toObj<T>(String value, T f(Map<String, dynamic> map)) => f(formatJson(value));
|
||||
|
||||
static List<dynamic> toListMap(String value) => formatJson(value);
|
||||
|
||||
static dynamic formatJson(String value) => jsonDecode(value);
|
||||
|
||||
static String checkOperationID(String? obj) =>
|
||||
obj ?? DateTime.now().millisecondsSinceEpoch.toString();
|
||||
static String checkOperationID(String? obj) => obj ?? DateTime.now().millisecondsSinceEpoch.toString();
|
||||
|
||||
static Map<String, dynamic> cleanMap(Map<String, dynamic> map) {
|
||||
map.removeWhere((key, value) {
|
||||
if (value is Map<String, dynamic>) {
|
||||
cleanMap(value);
|
||||
}
|
||||
return value == null;
|
||||
});
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user