sendMessageReadReceipts static method
Future<V2TimCallback>
sendMessageReadReceipts(
{ - required List<String> messageIDList,
})
Implementation
static Future<V2TimCallback> sendMessageReadReceipts({
required List<String> messageIDList,
}) async {
List<Map<String, dynamic>> originMessage = List<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(messageIDList));
if (messageIDList.isEmpty) {
return V2TimCallback.fromJson({
"code": -3,
"desc": "messageIDList is empty",
});
}
int res = desktopSDK.D_TIMMsgFindMessages(json_message_id_array, user_data_find);
if (res != TIMResult.TIM_SUCC) {
return V2TimCallback.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;
}
}
if (originMessage.isEmpty) {
return V2TimCallback.fromJson({
"code": -2,
"desc": "find message error",
});
}
print(2222);
print(originMessage);
Pointer<Uint8> json_msg_param = Tools.string2PointerInt8(json.encode(originMessage));
int res2 = desktopSDK.D_TIMMsgSendMessageReadReceipts(json_msg_param, user_data);
if (res2 != TIMResult.TIM_SUCC) {
return V2TimCallback.fromJson({
"code": res2,
"desc": "",
});
} else {
Map<String, dynamic> data = await getAsyncData(apiKey: userData);
return V2TimCallback.fromJson({
"code": data["code"],
"desc": data["desc"],
});
}
}