getMessageOnlineUrl static method
Future<V2TimValueCallback<V2TimMessageOnlineUrl>>
getMessageOnlineUrl(
{ - required String msgID,
})
Implementation
static Future<V2TimValueCallback<V2TimMessageOnlineUrl>> getMessageOnlineUrl({
required String msgID,
}) async {
String userDataFindMsg = Tools.generateUserData(methodName: "findMessage");
Pointer<Uint8> user_data_find_msg = Tools.string2PointerInt8(userDataFindMsg);
var msgIDListPtr = Tools.string2PointerInt8(json.encode([msgID]));
List<Map<String, dynamic>> message_c_list = [];
int res1 = desktopSDK.D_TIMMsgFindMessages(msgIDListPtr, user_data_find_msg);
if (res1 != TIMResult.TIM_SUCC) {
return V2TimValueCallback<V2TimMessageOnlineUrl>.fromJson({
"code": res1,
"desc": "find message error",
"data": Map<String, dynamic>.from({}),
});
} else {
Map<String, dynamic> msgListData = await getAsyncData(apiKey: userDataFindMsg);
List<Map<String, dynamic>> dataList = List<Map<String, dynamic>>.from(json.decode(msgListData["json_param"].isEmpty ? json.encode([]) : msgListData["json_param"]));
for (var element in dataList) {
message_c_list.add(element);
}
}
if (message_c_list.isEmpty) {
return V2TimValueCallback<V2TimMessageOnlineUrl>.fromJson({
"code": -2,
"desc": "find message error",
"data": Map<String, dynamic>.from({}),
});
}
var message = await Tools.convertMessage2Dart(message_c_list[0]);
return V2TimValueCallback<V2TimMessageOnlineUrl>.fromJson({
"code": 0,
"desc": "success",
"data": Map<String, dynamic>.from({
"imageElem": message.imageElem?.toJson(),
"soundElem": message.soundElem?.toJson(),
"videoElem": message.videoElem?.toJson(),
"fileElem": message.fileElem?.toJson(),
}),
});
}