This commit is contained in:
hrxiang
2022-04-24 12:12:26 +08:00
parent fcc8373560
commit 6edf9b74fa
29 changed files with 545 additions and 27 deletions

View File

@@ -365,6 +365,23 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID),
}));
/// Set group user nickname
/// 设置群成员昵称
Future<dynamic> setGroupMemberNickname({
required String groupID,
required String userID,
String? groupNickname,
String? operationID,
}) =>
_channel.invokeMethod(
'setGroupMemberNickname',
_buildParam({
'gid': groupID,
'uid': userID,
'groupNickname': groupNickname ?? '',
'operationID': Utils.checkOperationID(operationID),
}));
static Map _buildParam(Map param) {
param["ManagerName"] = "groupManager";
return param;

View File

@@ -13,6 +13,7 @@ class IMManager {
// late OfflinePushManager offlinePushManager;
late SignalingManager signalingManager;
late WorkMomentsManager workMomentsManager;
late OnConnectListener _connectListener;
late String uid;
@@ -27,6 +28,7 @@ class IMManager {
userManager = UserManager(_channel);
// offlinePushManager = OfflinePushManager(_channel);
signalingManager = SignalingManager(_channel);
workMomentsManager = WorkMomentsManager(_channel);
_addNativeCallback(_channel);
}
@@ -212,7 +214,7 @@ class IMManager {
data, (map) => FriendApplicationInfo.fromJson(map));
friendshipManager.listener.friendApplicationDeleted(u);
break;
case 'onFriendApplicationListRejected':
case 'onFriendApplicationRejected':
final u = Utils.toObj(
data, (map) => FriendApplicationInfo.fromJson(map));
friendshipManager.listener.friendApplicationRejected(u);
@@ -257,6 +259,13 @@ class IMManager {
signalingManager.listener.inviteeRejectedByOtherDevice(u);
break;
}
} else if (call.method == ListenerType.workMomentsListener) {
String type = call.arguments['type'];
switch (type) {
case 'OnRecvNewNotification':
workMomentsManager.listener.recvNewNotification();
break;
}
}
} catch (err) {
print(

View File

@@ -214,7 +214,9 @@ class MessageManager {
/// 创建@消息
Future<Message> createTextAtMessage({
required String text,
required List<String> atUidList,
required List<String> atUserIDList,
List<AtUserInfo> atUserInfoList = const [],
Message? quoteMessage,
String? operationID,
}) =>
_channel
@@ -222,7 +224,9 @@ class MessageManager {
'createTextAtMessage',
_buildParam({
'text': text,
'atUserList': atUidList,
'atUserIDList': atUserIDList,
'atUserInfoList': atUserInfoList.map((e) => e.toJson()).toList(),
'quoteMessage': quoteMessage?.toJson(),
"operationID": Utils.checkOperationID(operationID),
}),
)

View File

@@ -0,0 +1,59 @@
import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class WorkMomentsManager {
MethodChannel _channel;
late OnWorkMomentsListener listener;
WorkMomentsManager(this._channel);
/// Observe work moments changes
Future setWorkMomentsListener(OnWorkMomentsListener listener) {
this.listener = listener;
return _channel.invokeMethod('setWorkMomentsListener', _buildParam({}));
}
/// Get work moments unread count
Future<int> getWorkMomentsUnReadCount({
String? operationID,
}) =>
_channel
.invokeMethod(
'getWorkMomentsUnReadCount',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => map['unread_count']));
/// Get work moments notification list
Future<List<WorkMomentsInfo>> getWorkMomentsNotification({
required int offset,
required int count,
String? operationID,
}) =>
_channel
.invokeMethod(
'getWorkMomentsNotification',
_buildParam({
'offset': offset,
'count': count,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (map) => WorkMomentsInfo.fromJson(map)));
/// Clear work moments notification
Future clearWorkMomentsNotification({
String? operationID,
}) =>
_channel.invokeMethod(
'clearWorkMomentsNotification',
_buildParam({
'operationID': Utils.checkOperationID(operationID),
}));
static Map _buildParam(Map param) {
param["ManagerName"] = "workMomentsManager";
return param;
}
}