upgrade sdk

This commit is contained in:
hrxiang
2021-09-14 17:33:19 +08:00
parent d11fdfa0f7
commit c53b119e60
12 changed files with 945 additions and 12 deletions

View File

@@ -47,6 +47,12 @@ class FriendshipManager {
.then((value) => _toList(value));
}
Future<List<dynamic>> getFriendListMap() {
return _channel
.invokeMethod('getFriendList', _buildParam({}))
.then((value) => _toListMap(value));
}
/// modify friend information, only [comment] can be modified
///
Future<dynamic> setFriendInfo({required UserInfo info}) {
@@ -131,6 +137,11 @@ class FriendshipManager {
return (list as List).map((e) => UserInfo.fromJson(e)).toList();
}
static List<dynamic> _toListMap(String? value) {
var list = _formatJson(value);
return list;
}
static UserInfo _toObj(String value) => UserInfo.fromJson(_formatJson(value));
static dynamic _formatJson(value) {

View File

@@ -90,6 +90,24 @@ class GroupManager {
.then((value) => GroupMembersList.fromJson(_formatJson(value)));
}
// filter 0: all user, 1: group owner, 2: administrator
/// begin index, pull and fill 0 for the first time
Future<dynamic> getGroupMemberListMap({
required String groupId,
int filter = 0,
int next = 0,
}) {
return _channel
.invokeMethod(
'getGroupMemberList',
_buildParam({
'gid': groupId,
'filter': filter,
'next': next,
}))
.then((value) => _formatJson(value));
}
/// find all groups you have joined
Future<List<GroupInfo>> getJoinedGroupList() {
return _channel.invokeMethod('getJoinedGroupList', _buildParam({})).then(
@@ -98,6 +116,13 @@ class GroupManager {
.toList());
}
/// find all groups you have joined
Future<List<dynamic>> getJoinedGroupListMap() {
return _channel
.invokeMethod('getJoinedGroupList', _buildParam({}))
.then((value) => _formatJson(value));
}
/// check
Future<bool> isJoinedGroup({required String gid}) {
return getJoinedGroupList()

View File

@@ -302,12 +302,12 @@ class MessageManager {
}
///
Future<Message> createForwardMessage({required List<Message> messageList}) {
Future<Message> createForwardMessage({required Message message}) {
return _channel
.invokeMethod(
'createForwardMessage',
_buildParam({
'message': messageList.map((e) => e.toJson()).toList(),
'message': message.toJson(),
}))
.then((value) => _toObj(value));
}
@@ -361,6 +361,18 @@ class MessageManager {
.then((value) => _toObj(value));
}
Future<Message> createCardMessage({
required Map<String, dynamic> data,
}) {
return _channel
.invokeMethod(
'createCardMessage',
_buildParam({
'cardMessage': data,
}))
.then((value) => _toObj(value));
}
///
Future<dynamic> getTotalUnreadMsgCount() {
return _channel.invokeMethod('getTotalUnreadMsgCount', _buildParam({}));