getMessageReadReceipts method
Implementation
Future<V2TimValueCallback<List<V2TimMessageReceipt>>> getMessageReadReceipts({
required List<String> messageIDList,
}) async {
try {
final originalMessageList = messageIDList.map((e) => timeweb!.findMessage(e)).toList();
final res = await wrappedPromiseToFuture(timeweb!.getMessageReadReceiptList(originalMessageList));
if (res.code == 0) {
final resData = res.data;
final messageList = jsToMap(resData)['messageList'] as List;
final formatedList = messageList.map((item) {
final itemMap = jsToMap(item);
final readReceiptInfo = jsToMap(itemMap['readReceiptInfo']);
final isGroup = itemMap['conversationType'] == "GROUP";
return {
"userID": isGroup ? '' : itemMap['to'],
"timestamp": itemMap['time'],
"msgID": itemMap['ID'],
"readCount": readReceiptInfo['readCount'],
"unreadCount": readReceiptInfo['unreadCount'],
"groupID": isGroup ? itemMap['to'] : '',
};
}).toList();
return CommonUtils.returnSuccess<List<V2TimMessageReceipt>>(formatedList);
}
return CommonUtils.returnSuccess<List<V2TimMessageReceipt>>([]);
} catch (error) {
return CommonUtils.returnErrorForValueCb(error.toString());
}
}