Implementation
@override
void addNativeCallback() {
_channel.setMethodCallHandler((call) async {
try {
if (call.method == ListenerType.simpleMsgListener) {
Map<String, dynamic> data = formatJson(call.arguments);
Map<String, dynamic> params = data['data'] == null ? formatJson({}) : formatJson(data["data"]);
String type = data['type'];
simpleMessageListenerList.forEach((key, value) {
final msgID = params['msgID'];
switch (type) {
case 'onRecvC2CCustomMessage':
// String msgID, V2TIMUserInfo sender, byte[] customData
final sender = V2TimUserInfo.fromJson(params['sender']);
_catchListenerError(() {
value.onRecvC2CCustomMessage(
msgID,
sender,
params['customData'],
);
});
break;
case 'onRecvC2CTextMessage':
// String msgID, V2TIMUserInfo sender, String text
final sender = V2TimUserInfo.fromJson(params['sender']);
_catchListenerError(() {
value.onRecvC2CTextMessage(
msgID,
sender,
params['text'],
);
});
break;
case 'onRecvGroupCustomMessage':
// String msgID, String groupID, V2TIMGroupMemberInfo sender, byte[] customData
final groupSender = V2TimGroupMemberInfo.fromJson(params['sender']);
_catchListenerError(() {
value.onRecvGroupCustomMessage(
msgID,
params['groupID'],
groupSender,
params['customData'],
);
});
break;
case 'onRecvGroupTextMessage':
// String msgID, String groupID, V2TIMGroupMemberInfo sender, String text
final groupSender = V2TimGroupMemberInfo.fromJson(params['sender']);
_catchListenerError(() {
value.onRecvGroupTextMessage(
params['msgID'],
params['groupID'],
groupSender,
params['text'],
);
});
break;
}
});
} else if (call.method == ListenerType.initSDKListener) {
Map<String, dynamic> data = formatJson(call.arguments);
Map<String, dynamic> params = formatJson(data['data']);
String type = data['type'];
initSDKListenerList.forEach((key, value) {
switch (type) {
case 'onSelfInfoUpdated':
final userInfo = V2TimUserFullInfo.fromJson(params);
_catchListenerError(() {
value.onSelfInfoUpdated(userInfo);
});
break;
case 'onConnectFailed':
_catchListenerError(() {
value.onConnectFailed(
params['code'],
params['desc'],
);
});
break;
case 'onConnecting':
_catchListenerError(() {
value.onConnecting();
});
break;
case 'onConnectSuccess':
_catchListenerError(() {
value.onConnectSuccess();
});
break;
case 'onKickedOffline':
_catchListenerError(() {
value.onKickedOffline();
});
break;
case 'onUserSigExpired':
_catchListenerError(() {
value.onUserSigExpired();
});
break;
case 'onUserStatusChanged':
List<dynamic> statusList = params['statusList'];
List<V2TimUserStatus> list = List.empty(growable: true);
for (var element in statusList) {
list.add(V2TimUserStatus.fromJson(element));
}
_catchListenerError(() {
value.onUserStatusChanged(list);
});
break;
case 'onLog':
int level = params['level'];
String log = params['content'];
_catchListenerError(() {
value.onLog(level, log);
});
break;
case "onExperimentalNotify":
String key = params["key"];
dynamic param = params["param"];
_catchListenerError(() {
value.onExperimentalNotify(key, param);
});
break;
case "onUserInfoChanged":
List<dynamic> userInfoList = params['userInfoList'];
List<V2TimUserFullInfo> list = List.empty(growable: true);
for (var element in userInfoList) {
list.add(V2TimUserFullInfo.fromJson(formatJson(element)));
}
_catchListenerError(() {
value.onUserInfoChanged(list);
});
break;
case "onAllReceiveMessageOptChanged":
final receiveMessageOptInfo = V2TimReceiveMessageOptInfo.fromJson(params);
_catchListenerError(() {
value.onAllReceiveMessageOptChanged(receiveMessageOptInfo);
});
break;
}
});
} else if (call.method == ListenerType.groupListener) {
Map<String, dynamic> data = formatJson(call.arguments);
String type = data['type'];
Map<String, dynamic> params = data['data'] == null ? formatJson({}) : formatJson(data['data']);
String groupID = params['groupID'] ?? '';
String opReason = params['opReason'] ?? '';
bool isAgreeJoin = params['isAgreeJoin'] ?? false;
String customData = params['customData'] ?? '';
String topicID = params["topicID"] ?? "";
List<String> topicIDList = params["topicIDList"] == null ? List.empty(growable: true) : List.castFrom(params["topicIDList"]);
V2TimTopicInfo topicInfo = params["topicInfo"] == null ? V2TimTopicInfo() : V2TimTopicInfo.fromJson(params['topicInfo']);
Map<String, String> groupAttributeMap = params['groupAttributeMap'] == null ? Map<String, String>.from({}) : Map<String, String>.from(params['groupAttributeMap']);
List<dynamic> memberListMap = params['memberList'] == null ? List.empty(growable: true) : List.from(params['memberList']);
List<dynamic> groupMemberChangeInfoListMap = params['groupMemberChangeInfoList'] == null ? List.empty(growable: true) : List.from(params['groupMemberChangeInfoList']);
List<dynamic> groupChangeInfoListMap = params['groupChangeInfoList'] == null ? List.empty(growable: true) : List.from(params['groupChangeInfoList']);
List<V2TimGroupChangeInfo> groupChangeInfoList = List.empty(growable: true);
List<V2TimGroupMemberChangeInfo> groupMemberChangeInfoList = List.empty(growable: true);
List<V2TimGroupMemberInfo> memberList = List.empty(growable: true);
if (memberListMap.isNotEmpty) {
for (var element in memberListMap) {
memberList.add(V2TimGroupMemberInfo.fromJson(element));
}
}
if (groupMemberChangeInfoListMap.isNotEmpty) {
for (var element in groupMemberChangeInfoListMap) {
groupMemberChangeInfoList.add(V2TimGroupMemberChangeInfo.fromJson(element));
}
}
if (groupChangeInfoListMap.isNotEmpty) {
for (var element in groupChangeInfoListMap) {
groupChangeInfoList.add(V2TimGroupChangeInfo.fromJson(element));
}
}
late V2TimGroupMemberInfo opUser;
late V2TimGroupMemberInfo member;
if (params['opUser'] != null) {
opUser = V2TimGroupMemberInfo.fromJson(params['opUser']);
}
if (params['member'] != null) {
member = V2TimGroupMemberInfo.fromJson(params['member']);
}
groupListenerList.forEach((key, value) {
switch (type) {
case 'onMemberEnter':
_catchListenerError(() {
value.onMemberEnter(
groupID,
memberList,
);
});
break;
case 'onMemberLeave':
_catchListenerError(() {
value.onMemberLeave(
groupID,
member,
);
});
break;
case 'onMemberInvited':
_catchListenerError(() {
value.onMemberInvited(
groupID,
opUser,
memberList,
);
});
break;
case 'onMemberKicked':
_catchListenerError(() {
value.onMemberKicked(
groupID,
opUser,
memberList,
);
});
break;
case 'onMemberInfoChanged':
_catchListenerError(() {
value.onMemberInfoChanged(
groupID,
groupMemberChangeInfoList,
);
});
break;
case 'onGroupCreated':
_catchListenerError(() {
value.onGroupCreated(groupID);
});
break;
case 'onGroupDismissed':
_catchListenerError(() {
value.onGroupDismissed(
groupID,
opUser,
);
});
break;
case 'onGroupRecycled':
_catchListenerError(() {
value.onGroupRecycled(
groupID,
opUser,
);
});
break;
case 'onGroupInfoChanged':
_catchListenerError(() {
value.onGroupInfoChanged(
groupID,
groupChangeInfoList,
);
});
break;
case 'onReceiveJoinApplication':
_catchListenerError(() {
value.onReceiveJoinApplication(
groupID,
member,
opReason,
);
});
break;
case 'onApplicationProcessed':
_catchListenerError(() {
value.onApplicationProcessed(
groupID,
opUser,
isAgreeJoin,
opReason,
);
});
break;
case 'onGrantAdministrator':
_catchListenerError(() {
value.onGrantAdministrator(
groupID,
opUser,
memberList,
);
});
break;
case 'onRevokeAdministrator':
_catchListenerError(() {
value.onRevokeAdministrator(
groupID,
opUser,
memberList,
);
});
break;
case 'onQuitFromGroup':
_catchListenerError(() {
value.onQuitFromGroup(groupID);
});
break;
case 'onReceiveRESTCustomData':
_catchListenerError(() {
value.onReceiveRESTCustomData(
groupID,
customData,
);
});
break;
case 'onGroupAttributeChanged':
_catchListenerError(() {
value.onGroupAttributeChanged(
groupID,
groupAttributeMap,
);
});
break;
case "onTopicCreated":
_catchListenerError(() {
value.onTopicCreated(
groupID,
topicID,
);
});
break;
case "onTopicDeleted":
_catchListenerError(() {
value.onTopicDeleted(
groupID,
topicIDList,
);
});
break;
case "onTopicInfoChanged":
_catchListenerError(() {
value.onTopicInfoChanged(
groupID,
topicInfo,
);
});
break;
case "onGroupCounterChanged":
String key = params["key"] ?? "";
int vv = params["value"] ?? 0;
_catchListenerError(() {
value.onGroupCounterChanged(
groupID,
key,
vv,
);
});
break;
case "onAllGroupMembersMuted":
bool isMute = params["isMute"] ?? false;
_catchListenerError(() {
value.onAllGroupMembersMuted(
groupID,
isMute,
);
});
break;
case "onMemberMarkChanged":
bool enableMark = params["enableMark"] ?? false;
List<String> memberIDList = List.from(params["memberIDList"] ?? []);
int markType = params["markType"] ?? 0;
_catchListenerError(() {
value.onMemberMarkChanged(
groupID,
memberIDList,
markType,
enableMark,
);
});
break;
}
});
} else if (call.method == ListenerType.advancedMsgListener) {
Map<String, dynamic> data = formatJson(call.arguments);
String type = data['type'];
dynamic params = data['data'] ?? formatJson({});
switch (type) {
case 'onRecvNewMessage':
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvNewMessage(V2TimMessage.fromJson(params));
});
});
break;
case 'onRecvMessageModified':
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvMessageModified(V2TimMessage.fromJson(params));
});
});
break;
case 'onRecvC2CReadReceipt':
List<dynamic> dataList = params;
List<V2TimMessageReceipt> receiptList = List.empty(growable: true);
for (var element in dataList) {
receiptList.add(V2TimMessageReceipt.fromJson(element));
}
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvC2CReadReceipt(receiptList);
});
});
break;
case 'onRecvMessageRevoked':
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvMessageRevoked(params);
});
});
break;
case 'onSendMessageProgress':
final message = V2TimMessage.fromJson(params['message']);
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onSendMessageProgress(
message,
params['progress'],
);
});
});
break;
case 'onRecvMessageReadReceipts':
List<dynamic> dataList = List<dynamic>.from(params);
List<V2TimMessageReceipt> receiptList = List.empty(growable: true);
for (var element in dataList) {
receiptList.add(V2TimMessageReceipt.fromJson(element));
}
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvMessageReadReceipts(receiptList);
});
});
break;
case "onRecvMessageExtensionsChanged":
Map<String, dynamic> cbdata = Map<String, Object>.from(params);
String msgID = cbdata["msgID"] ?? "";
List<dynamic> extensions = List.from(cbdata["extensions"] ?? []);
List<V2TimMessageExtension> resList = List.empty(growable: true);
for (var element in extensions) {
var elem = formatJson(element);
resList.add(V2TimMessageExtension(
extensionKey: elem["extensionKey"] ?? "",
extensionValue: elem["extensionValue"] ?? "",
));
}
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvMessageExtensionsChanged(
msgID,
resList,
);
});
});
break;
case "onRecvMessageExtensionsDeleted":
Map<String, dynamic> cbdata = formatJson(params);
String msgID = cbdata["msgID"] ?? "";
List<String> extensionKeys = List<String>.from(cbdata["extensionKeys"] ?? []);
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvMessageExtensionsDeleted(
msgID,
extensionKeys,
);
});
});
break;
case "onMessageDownloadProgressCallback":
Map<String, dynamic> cbdata = formatJson(params);
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onMessageDownloadProgressCallback(
V2TimMessageDownloadProgress.fromJson(cbdata),
);
});
});
break;
case "onRecvMessageReactionsChanged":
List<dynamic> changeInfosm = List<dynamic>.from(params["changeInfos"]);
List<V2TIMMessageReactionChangeInfo> infos = List.empty(growable: true);
changeInfosm.forEach(((element) {
infos.add(V2TIMMessageReactionChangeInfo.fromJson(element));
}));
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvMessageReactionsChanged(infos);
});
});
break;
case "onRecvMessageRevokedWithInfo":
String msgID = params["msgID"];
V2TimUserFullInfo operateUser = V2TimUserFullInfo.fromJson(params['operateUser'] ?? {});
String reason = params["reason"];
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onRecvMessageRevokedWithInfo(msgID, operateUser, reason);
});
});
break;
case "onGroupMessagePinned":
String groupID = params["groupID"] ?? "";
V2TimMessage message = V2TimMessage.fromJson(params['message'] ?? {});
bool isPinned = params["isPinned"] ?? true;
V2TimGroupMemberInfo opUser = V2TimGroupMemberInfo.fromJson(params['opUser'] ?? {});
advancedMsgListenerList.forEach((key, listener) {
_catchListenerError(() {
listener.onGroupMessagePinned(groupID, message, isPinned, opUser);
});
});
break;
}
} else if (call.method == ListenerType.conversationListener) {
Map<String, dynamic> data = formatJson(call.arguments);
String type = data['type'];
conversationListenerList.forEach((key, value) {
switch (type) {
case 'onSyncServerStart':
_catchListenerError(() {
value.onSyncServerStart();
});
break;
case 'onSyncServerFinish':
_catchListenerError(() {
value.onSyncServerFinish();
});
break;
case 'onSyncServerFailed':
_catchListenerError(() {
value.onSyncServerFailed();
});
break;
case 'onNewConversation':
List<dynamic> params = data['data'] == null ? List.empty(growable: true) : List.from(data['data']);
List<V2TimConversation> conversationList = List.empty(growable: true);
for (var element in params) {
conversationList.add(V2TimConversation.fromJson(element));
}
_catchListenerError(() {
value.onNewConversation(conversationList);
});
break;
case 'onConversationChanged':
List<dynamic> params = data['data'] == null ? List.empty(growable: true) : List<dynamic>.from(data['data']);
List<V2TimConversation> conversationList = List.empty(growable: true);
for (var element in params) {
conversationList.add(V2TimConversation.fromJson(element));
}
_catchListenerError(() {
value.onConversationChanged(conversationList);
});
break;
case 'onTotalUnreadMessageCountChanged':
int params = data['data'] ?? 0;
_catchListenerError(() {
value.onTotalUnreadMessageCountChanged(params);
});
break;
case "onConversationGroupCreated":
Map<String, dynamic> param = formatJson(data["data"]);
String groupName = param["groupName"];
List<V2TimConversation> list = List.empty(growable: true);
for (var v in List.from(param["conversationList"])) {
list.add(V2TimConversation.fromJson(v));
}
_catchListenerError(() {
value.onConversationGroupCreated(groupName, list);
});
break;
case "onConversationGroupDeleted":
_catchListenerError(() {
value.onConversationGroupDeleted(data["data"]);
});
break;
case "onConversationGroupNameChanged":
Map<String, dynamic> param = formatJson(data["data"]);
_catchListenerError(() {
value.onConversationGroupNameChanged(param["oldName"], param["newName"]);
});
break;
case "onConversationsAddedToGroup":
Map<String, dynamic> param = formatJson(data["data"]);
String groupName = param["groupName"];
List<V2TimConversation> list = List.empty(growable: true);
for (var v in List.from(param["conversationList"])) {
list.add(V2TimConversation.fromJson(v));
}
_catchListenerError(() {
value.onConversationsAddedToGroup(groupName, list);
});
break;
case "onConversationsDeletedFromGroup":
Map<String, dynamic> param = formatJson(data["data"]);
String groupName = param["groupName"];
List<V2TimConversation> list = List.empty(growable: true);
for (var v in List.from(param["conversationList"])) {
list.add(V2TimConversation.fromJson(v));
}
_catchListenerError(() {
value.onConversationsDeletedFromGroup(groupName, list);
});
break;
case "onConversationDeleted":
List<String> list = List<String>.from(data["data"] ?? []);
_catchListenerError(() {
value.onConversationDeleted(list);
});
break;
case "onUnreadMessageCountChangedByFilter":
Map<String, dynamic> param = formatJson(data["data"]);
V2TimConversationFilter filter = V2TimConversationFilter.fromJson(param["filter"] ?? {});
int totalUnreadCount = param["totalUnreadCount"] ?? 0;
_catchListenerError(() {
value.onUnreadMessageCountChangedByFilter(filter, totalUnreadCount);
});
break;
}
});
} else if (call.method == ListenerType.friendListener) {
Map<String, dynamic> data = formatJson(call.arguments);
String type = data['type'];
dynamic params = data['data'] ?? formatJson({});
friendListenerList.forEach((key, value) {
switch (type) {
case "onMutualFollowersListChanged":
Map<String, dynamic> formatedData = formatJson(params);
List<V2TimUserFullInfo> usersinfo = List.empty(growable: true);
List<dynamic> usersinfomap = List<dynamic>.from(formatedData["userInfoList"] ?? []);
for (int i = 0; i < usersinfomap.length; i++) {
usersinfo.add(V2TimUserFullInfo.fromJson(usersinfomap[i]));
}
bool isAdd = formatedData["isAdd"] ?? false;
_catchListenerError(() {
value.onMutualFollowersListChanged(
usersinfo,
isAdd,
);
});
break;
case "onMyFollowersListChanged":
Map<String, dynamic> formatedData = formatJson(params);
List<V2TimUserFullInfo> usersinfo = List.empty(growable: true);
List<dynamic> usersinfomap = List<dynamic>.from(formatedData["userInfoList"] ?? []);
for (int i = 0; i < usersinfomap.length; i++) {
usersinfo.add(V2TimUserFullInfo.fromJson(usersinfomap[i]));
}
bool isAdd = formatedData["isAdd"] ?? false;
_catchListenerError(() {
value.onMyFollowersListChanged(
usersinfo,
isAdd,
);
});
break;
case "onMyFollowingListChanged":
Map<String, dynamic> formatedData = formatJson(params);
List<V2TimUserFullInfo> usersinfo = List.empty(growable: true);
List<dynamic> usersinfomap = List<dynamic>.from(formatedData["userInfoList"] ?? []);
for (int i = 0; i < usersinfomap.length; i++) {
usersinfo.add(V2TimUserFullInfo.fromJson(usersinfomap[i]));
}
bool isAdd = formatedData["isAdd"] ?? false;
_catchListenerError(() {
value.onMyFollowingListChanged(
usersinfo,
isAdd,
);
});
break;
case "onOfficialAccountDeleted":
String officialAccountID = params;
_catchListenerError(() {
value.onOfficialAccountDeleted(
officialAccountID,
);
});
break;
case "onOfficialAccountInfoChanged":
_catchListenerError(() {
value.onOfficialAccountInfoChanged(
V2TimOfficialAccountInfo.fromJson(params),
);
});
break;
case "onOfficialAccountSubscribed":
_catchListenerError(() {
value.onOfficialAccountSubscribed(
V2TimOfficialAccountInfo.fromJson(params),
);
});
break;
case "onOfficialAccountUnsubscribed":
String officialAccountID = params;
_catchListenerError(() {
value.onOfficialAccountUnsubscribed(
officialAccountID,
);
});
break;
case 'onFriendApplicationListAdded':
List<dynamic> applicationListMap = params;
List<V2TimFriendApplication> applicationList = List.empty(growable: true);
for (var element in applicationListMap) {
applicationList.add(V2TimFriendApplication.fromJson(element));
}
_catchListenerError(() {
value.onFriendApplicationListAdded(applicationList);
});
break;
case 'onFriendApplicationListDeleted':
List<String> userIDList = List.from(params);
_catchListenerError(() {
value.onFriendApplicationListDeleted(userIDList);
});
break;
case 'onFriendApplicationListRead':
_catchListenerError(() {
value.onFriendApplicationListRead();
});
break;
case 'onFriendListAdded':
List<dynamic> userMap = List<dynamic>.from(params);
List<V2TimFriendInfo> users = List.empty(growable: true);
for (var element in userMap) {
users.add(V2TimFriendInfo.fromJson(element));
}
_catchListenerError(() {
value.onFriendListAdded(users);
});
break;
case 'onFriendListDeleted':
List<String> userList = List.from(params);
_catchListenerError(() {
value.onFriendListDeleted(userList);
});
break;
case 'onBlackListAdd':
List<dynamic> infoListMap = List<dynamic>.from(params);
List<V2TimFriendInfo> infoList = List.empty(growable: true);
for (var element in infoListMap) {
infoList.add(V2TimFriendInfo.fromJson(element));
}
_catchListenerError(() {
value.onBlackListAdd(infoList);
});
break;
case 'onBlackListDeleted':
List<String> userList = List.from(params);
_catchListenerError(() {
value.onBlackListDeleted(userList);
});
break;
case 'onFriendInfoChanged':
List<dynamic> infoListMap = List<dynamic>.from(params);
List<V2TimFriendInfo> infoList = List.empty(growable: true);
for (var element in infoListMap) {
infoList.add(V2TimFriendInfo.fromJson(element));
}
_catchListenerError(() {
value.onFriendInfoChanged(infoList);
});
break;
}
});
} else if (call.method == 'logFromSwift') {
} else if (call.method == ListenerType.signalingListener) {
Map<String, dynamic> d = formatJson(call.arguments);
String type = d['type'];
Map<String, dynamic> params = formatJson(d['data']);
String inviteID = params['inviteID'] ?? '';
String inviter = params['inviter'] ?? '';
String groupID = params['groupID'] ?? '';
List<String>? inviteeList = params['inviteeList'] == null ? null : List.from(params['inviteeList']);
String data = params['data'] ?? '';
String invitee = params['invitee'] ?? '';
signalingListenerList.forEach((key, value) {
switch (type) {
case 'onReceiveNewInvitation':
_catchListenerError(() {
value.onReceiveNewInvitation(inviteID, inviter, groupID, inviteeList!, data);
});
break;
case 'onInviteeAccepted':
_catchListenerError(() {
value.onInviteeAccepted(inviteID, invitee, data);
});
break;
case 'onInviteeRejected':
_catchListenerError(() {
value.onInviteeRejected(inviteID, invitee, data);
});
break;
case 'onInvitationCancelled':
_catchListenerError(() {
value.onInvitationCancelled(inviteID, inviter, data);
});
break;
case 'onInvitationTimeout':
_catchListenerError(() {
value.onInvitationTimeout(inviteID, inviteeList!);
});
break;
}
});
} else if (call.method == ListenerType.communityListener) {
Map<String, dynamic> data = formatJson(call.arguments);
Map<String, dynamic> params = data['data'] == null ? formatJson({}) : formatJson(data["data"]);
String type = data['type'];
communityListenerList.forEach((key, value) {
switch (type) {
case "onCreateTopic":
String groupID = params["groupID"] ?? "";
String topicID = params["topicID"] ?? "";
value.onCreateTopic(groupID, topicID);
break;
case "onDeleteTopic":
String groupID = params["groupID"] ?? "";
List<String> topicIDList = params["topicIDList"] == null ? [] : List<String>.from(params["topicIDList"]);
value.onDeleteTopic(groupID, topicIDList);
break;
case "onChangeTopicInfo":
String groupID = params["groupID"] ?? "";
value.onChangeTopicInfo(groupID, V2TimTopicInfo.fromJson(params["topicInfo"] ?? {}));
break;
case "onReceiveTopicRESTCustomData":
String topicID = params["topicID"] ?? "";
String customData = params["customData"] ?? "";
value.onReceiveTopicRESTCustomData(topicID, customData);
break;
case "onCreatePermissionGroup":
String groupID = params["groupID"] ?? "";
value.onCreatePermissionGroup(
groupID,
V2TimPermissionGroupInfo.fromJson(params["permissionGroupInfo"] ?? {}),
);
break;
case "onDeletePermissionGroup":
String groupID = params["groupID"] ?? "";
List<String> permissionGroupIDList = params["permissionGroupIDList"] == null ? [] : List<String>.from(params["permissionGroupIDList"]);
value.onDeletePermissionGroup(groupID, permissionGroupIDList);
break;
case "onChangePermissionGroupInfo":
String groupID = params["groupID"] ?? "";
value.onChangePermissionGroupInfo(groupID, V2TimPermissionGroupInfo.fromJson(params["permissionGroupInfo"] ?? {}));
break;
case "onAddMembersToPermissionGroup":
String groupID = params["groupID"] ?? "";
String permissionGroupID = params["permissionGroupID"] ?? "";
List<String> memberIDList = params["memberIDList"] == null ? [] : List<String>.from(params["memberIDList"]);
value.onAddMembersToPermissionGroup(groupID, permissionGroupID, memberIDList);
break;
case "onRemoveMembersFromPermissionGroup":
String groupID = params["groupID"] ?? "";
String permissionGroupID = params["permissionGroupID"] ?? "";
List<String> memberIDList = params["memberIDList"] == null ? [] : List<String>.from(params["memberIDList"]);
value.onRemoveMembersFromPermissionGroup(groupID, permissionGroupID, memberIDList);
break;
case "onAddTopicPermission":
String groupID = params["groupID"] ?? "";
String permissionGroupID = params["permissionGroupID"] ?? "";
value.onAddTopicPermission(groupID, permissionGroupID, params["topicPermissionMap"] ?? {});
break;
case "onDeleteTopicPermission":
String groupID = params["groupID"] ?? "";
String permissionGroupID = params["permissionGroupID"] ?? "";
List<String> topicIDList = params["topicIDList"] == null ? [] : List<String>.from(params["topicIDList"]);
value.onDeleteTopicPermission(groupID, permissionGroupID, topicIDList);
break;
case "onModifyTopicPermission":
String groupID = params["groupID"] ?? "";
String permissionGroupID = params["permissionGroupID"] ?? "";
value.onModifyTopicPermission(groupID, permissionGroupID, params["topicPermissionMap"] ?? {});
break;
}
});
}
} catch (err) {
debugPrint("重点关注,回调失败了,数据类型异常。$err ${call.method} ${call.arguments['type']} ${call.arguments['data']}");
}
});
}