getGroupMessageReadMemberList static method
Future<V2TimValueCallback<V2TimGroupMessageReadMemberList>>
getGroupMessageReadMemberList(
{ - required String messageID,
- required GetGroupMessageReadMemberListFilter filter,
- int nextSeq = 0,
- int count = 100,
})
Implementation
static Future<V2TimValueCallback<V2TimGroupMessageReadMemberList>> getGroupMessageReadMemberList({
required String messageID,
required GetGroupMessageReadMemberListFilter filter,
int nextSeq = 0,
int count = 100,
}) async {
Map<String, dynamic> originMessage = Map<String, dynamic>.from({});
String userData = Tools.generateUserData();
String userDataFind = Tools.generateUserData(methodName: "findMessage");
Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
Pointer<Uint8> user_data_find = Tools.string2PointerInt8(userDataFind);
Pointer<Uint8> json_message_id_array = Tools.string2PointerInt8(json.encode(List.from([messageID])));
int res = desktopSDK.D_TIMMsgFindMessages(json_message_id_array, user_data_find);
if (res != TIMResult.TIM_SUCC) {
return V2TimValueCallback<V2TimGroupMessageReadMemberList>.fromJson({
"code": -2,
"desc": "find message error",
});
} else {
Map<String, dynamic> messageData = await getAsyncData(apiKey: userDataFind);
List<Map<String, dynamic>> nativeMessage = List<Map<String, dynamic>>.from(json.decode(messageData["json_param"].isEmpty ? json.encode([]) : messageData["json_param"]));
if (nativeMessage.isNotEmpty) {
originMessage = nativeMessage.first;
}
}
if (originMessage.isEmpty) {
return V2TimValueCallback<V2TimGroupMessageReadMemberList>.fromJson({
"code": -2,
"desc": "find message error",
});
}
Pointer<Uint8> json_msg = Tools.string2PointerInt8(json.encode(originMessage));
int res2 = desktopSDK.D_TIMMsgGetGroupMessageReadMemberList(json_msg, filter.index, nextSeq, count, user_data);
if (res2 != TIMResult.TIM_SUCC) {
return V2TimValueCallback<V2TimGroupMessageReadMemberList>.fromJson({
"code": res2,
"desc": "",
});
} else {
Map<String, dynamic> data = await getAsyncData(apiKey: userData);
List<Map<String, dynamic>> memberArray = List<Map<String, dynamic>>.from(json.decode(data["json_group_member_array"].isEmpty ? json.encode([]) : data["json_group_member_array"]));
List<Map<String, dynamic>> dartMemberList = List.from([]);
for (var element in memberArray) {
dartMemberList.add(Tools.groupMemberInfo2dartGroupMemberInfo(element).toJson());
}
Map<String, dynamic> dartData = Map<String, dynamic>.from({
"nextSeq": data["next_seq"],
"isFinished": data["is_finished"],
"memberInfoList": dartMemberList,
});
return V2TimValueCallback<V2TimGroupMessageReadMemberList>.fromJson({
"code": data["code"],
"desc": data["desc"],
"data": dartData,
});
}
}