downloadMergerMessage method
Implementation
Future<V2TimValueCallback<List<V2TimMessage>>> downloadMergerMessage({
required String msgID,
}) async {
try {
dynamic mergerMsg = mergerMsgList.firstWhere((element) => jsToMap(element)['ID'] == msgID, orElse: () => null);
if (mergerMsg == null) {
return CommonUtils.returnErrorForValueCb("未找到合并消息");
}
final parsedMessage = jsToMap(mergerMsg);
final payload = jsToMap(parsedMessage['payload']);
if ((payload['downloadKey'] as String).isEmpty) {
final listResult = await _getDownLoadMergerList(payload);
return CommonUtils.returnSuccess<List<V2TimMessage>>(listResult);
}
final res = await promiseToFuture(timeweb!.downloadMergerMessage(mergerMsg));
final messagePayLoad = jsToMap(res)['payload'];
final listResult = await _getDownLoadMergerList(jsToMap(messagePayLoad));
return CommonUtils.returnSuccess<List<V2TimMessage>>(listResult);
} catch (error) {
return CommonUtils.returnErrorForValueCb(error.toString());
}
}