900 lines
46 KiB
C++
900 lines
46 KiB
C++
#include "MessageManager.h"
|
|
#include <libopenimsdk.h>
|
|
#include "../NimResult.h"
|
|
#include "../ZegoDataUtils.h"
|
|
#include "ConstDefine.h"
|
|
#include "Listen.h"
|
|
|
|
MessageManagerService::MessageManagerService() {
|
|
m_serviceName = "messageManager";
|
|
}
|
|
|
|
void MessageManagerService::onMethodCalled(
|
|
const std::string& method,
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (method == "setAdvancedMsgListener") {
|
|
setAdvancedMsgListener(arguments, result);
|
|
} else if (method == "sendMessage") {
|
|
sendMessage(arguments, result);
|
|
} else if (method == "revokeMessage") {
|
|
revokeMessage(arguments, result);
|
|
} else if (method == "editMessage") {
|
|
editMessage(arguments, result);
|
|
} else if (method == "deleteMessageFromLocalStorage") {
|
|
deleteMessageFromLocalStorage(arguments, result);
|
|
} else if (method == "deleteMessageFromLocalAndSvr") {
|
|
deleteMessageFromLocalAndSvr(arguments, result);
|
|
} else if (method == "deleteAllMsgFromLocal") {
|
|
deleteAllMsgFromLocal(arguments, result);
|
|
} else if (method == "deleteAllMsgFromLocalAndSvr") {
|
|
deleteAllMsgFromLocalAndSvr(arguments, result);
|
|
} else if (method == "insertSingleMessageToLocalStorage") {
|
|
insertSingleMessageToLocalStorage(arguments, result);
|
|
} else if (method == "insertGroupMessageToLocalStorage") {
|
|
insertGroupMessageToLocalStorage(arguments, result);
|
|
} else if (method == "markMessagesAsReadByMsgID") {
|
|
markMessagesAsReadByMsgID(arguments, result);
|
|
} else if (method == "typingStatusUpdate") {
|
|
typingStatusUpdate(arguments, result);
|
|
} else if (method == "createTextMessage") {
|
|
createTextMessage(arguments, result);
|
|
} else if (method == "createTextAtMessage") {
|
|
createTextAtMessage(arguments, result);
|
|
} else if (method == "createImageMessage") {
|
|
createImageMessage(arguments, result);
|
|
} else if (method == "createImageMessageFromFullPath") {
|
|
createImageMessageFromFullPath(arguments, result);
|
|
} else if (method == "createSoundMessage") {
|
|
createSoundMessage(arguments, result);
|
|
} else if (method == "createSoundMessageFromFullPath") {
|
|
createSoundMessageFromFullPath(arguments, result);
|
|
} else if (method == "createVideoMessage") {
|
|
createVideoMessage(arguments, result);
|
|
} else if (method == "createVideoMessageFromFullPath") {
|
|
createVideoMessageFromFullPath(arguments, result);
|
|
} else if (method == "createFileMessage") {
|
|
createFileMessage(arguments, result);
|
|
} else if (method == "createFileMessageFromFullPath") {
|
|
createFileMessageFromFullPath(arguments, result);
|
|
} else if (method == "createMergerMessage") {
|
|
createMergerMessage(arguments, result);
|
|
} else if (method == "createForwardMessage") {
|
|
createForwardMessage(arguments, result);
|
|
} else if (method == "createLocationMessage") {
|
|
createLocationMessage(arguments, result);
|
|
} else if (method == "createCustomMessage") {
|
|
createCustomMessage(arguments, result);
|
|
} else if (method == "createQuoteMessage") {
|
|
createQuoteMessage(arguments, result);
|
|
} else if (method == "createCardMessage") {
|
|
createCardMessage(arguments, result);
|
|
} else if (method == "createFaceMessage") {
|
|
createFaceMessage(arguments, result);
|
|
} else if (method == "createAdvancedTextMessage") {
|
|
createAdvancedTextMessage(arguments, result);
|
|
} else if (method == "createAdvancedQuoteMessage") {
|
|
createAdvancedQuoteMessage(arguments, result);
|
|
} else if (method == "searchLocalMessages") {
|
|
searchLocalMessages(arguments, result);
|
|
} else if (method == "clearConversationAndDeleteAllMsg") {
|
|
clearConversationAndDeleteAllMsg(arguments, result);
|
|
} else if (method == "getAdvancedHistoryMessageList") {
|
|
getAdvancedHistoryMessageList(arguments, result);
|
|
} else if (method == "getAdvancedHistoryMessageListReverse") {
|
|
getAdvancedHistoryMessageListReverse(arguments, result);
|
|
} else if (method == "findMessageList") {
|
|
findMessageList(arguments, result);
|
|
} else if (method == "setMessageLocalEx") {
|
|
setMessageLocalEx(arguments, result);
|
|
} else if (method == "setAppBadge") {
|
|
setAppBadge(arguments, result);
|
|
} else if (method == "sendMessageNotOss") {
|
|
sendMessageNotOss(arguments, result);
|
|
} else if (method == "createImageMessageByURL") {
|
|
createImageMessageByURL(arguments, result);
|
|
} else if (method == "createSoundMessageByURL") {
|
|
createSoundMessageByURL(arguments, result);
|
|
} else if (method == "createVideoMessageByURL") {
|
|
createVideoMessageByURL(arguments, result);
|
|
} else if (method == "createFileMessageByURL") {
|
|
createFileMessageByURL(arguments, result);
|
|
} else if (method == "fetchSurroundingMessages") {
|
|
fetchSurroundingMessages(arguments, result);
|
|
} else if (method == "setCustomBusinessListener") {
|
|
setCustomBusinessListener(arguments, result);
|
|
} else {
|
|
result->NotImplemented();
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::setAdvancedMsgListener(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto id = zego_value_get_string(arguments->at(flutter::EncodableValue("id")));
|
|
set_advanced_msg_listener(NewAdvancedMsgListenCallBack(id));
|
|
result->Success(flutter::EncodableValue());
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::sendMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto message = value_2_json(arguments->at(flutter::EncodableValue("message")));
|
|
auto userID = zego_value_get_string(arguments->at(flutter::EncodableValue("userID")));
|
|
auto groupID = zego_value_get_string(arguments->at(flutter::EncodableValue("groupID")));
|
|
auto channelID = zego_value_get_string(arguments->at(flutter::EncodableValue("channelID")));
|
|
auto offlinePushInfo = value_2_json(arguments->at(flutter::EncodableValue("offlinePushInfo")));
|
|
auto isOnlineOnly = zego_value_get_bool(arguments->at(flutter::EncodableValue("isOnlineOnly")));
|
|
auto json = EncodableValueToJson(arguments->at(flutter::EncodableValue("message")));
|
|
auto clientMsgID = json["clientMsgID"].get<std::string>();
|
|
|
|
|
|
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* message_cs = const_cast<char*>(message.c_str());
|
|
char* userID_cs = const_cast<char*>(userID.c_str());
|
|
char* groupID_cs = const_cast<char*>(groupID.c_str());
|
|
char* channelID_cs = const_cast<char*>(channelID.c_str());
|
|
char* offlinePushInfo_cs = const_cast<char*>(offlinePushInfo.c_str());
|
|
|
|
send_message(NewMsgSendCallBack(result,clientMsgID), operationID_cs, message_cs, userID_cs, groupID_cs, channelID_cs, offlinePushInfo_cs, isOnlineOnly);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::revokeMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto conversationID = zego_value_get_string(arguments->at(flutter::EncodableValue("conversationID")));
|
|
auto clientMsgID = zego_value_get_string(arguments->at(flutter::EncodableValue("clientMsgID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* conversationID_cs = const_cast<char*>(conversationID.c_str());
|
|
char* clientMsgID_cs = const_cast<char*>(clientMsgID.c_str());
|
|
|
|
revoke_message(NewBaseCallBack(result), operationID_cs, conversationID_cs, clientMsgID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::editMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto conversationID = zego_value_get_string(arguments->at(flutter::EncodableValue("conversationID")));
|
|
auto clientMsgID = zego_value_get_string(arguments->at(flutter::EncodableValue("clientMsgID")));
|
|
auto message = value_2_json(arguments->at(flutter::EncodableValue("message")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* conversationID_cs = const_cast<char*>(conversationID.c_str());
|
|
char* clientMsgID_cs = const_cast<char*>(clientMsgID.c_str());
|
|
char* message_cs = const_cast<char*>(message.c_str());
|
|
|
|
edit_message(NewBaseCallBack(result), operationID_cs, conversationID_cs, clientMsgID_cs, message_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::deleteMessageFromLocalStorage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto conversationID = zego_value_get_string(arguments->at(flutter::EncodableValue("conversationID")));
|
|
auto clientMsgID = zego_value_get_string(arguments->at(flutter::EncodableValue("clientMsgID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* conversationID_cs = const_cast<char*>(conversationID.c_str());
|
|
char* clientMsgID_cs = const_cast<char*>(clientMsgID.c_str());
|
|
|
|
delete_message_from_local_storage(NewBaseCallBack(result), operationID_cs, conversationID_cs, clientMsgID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::deleteMessageFromLocalAndSvr(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto conversationID = zego_value_get_string(arguments->at(flutter::EncodableValue("conversationID")));
|
|
auto clientMsgID = zego_value_get_string(arguments->at(flutter::EncodableValue("clientMsgID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* conversationID_cs = const_cast<char*>(conversationID.c_str());
|
|
char* clientMsgID_cs = const_cast<char*>(clientMsgID.c_str());
|
|
|
|
delete_message(NewBaseCallBack(result), operationID_cs, conversationID_cs, clientMsgID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::deleteAllMsgFromLocal(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
|
|
delete_all_msg_from_local(NewBaseCallBack(result), operationID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::deleteAllMsgFromLocalAndSvr(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
|
|
delete_all_msg_from_local_and_svr(NewBaseCallBack(result), operationID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::insertSingleMessageToLocalStorage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto message = value_2_json(arguments->at(flutter::EncodableValue("message")));
|
|
auto receiverID = zego_value_get_string(arguments->at(flutter::EncodableValue("receiverID")));
|
|
auto senderID = zego_value_get_string(arguments->at(flutter::EncodableValue("senderID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* message_cs = const_cast<char*>(message.c_str());
|
|
char* receiverID_cs = const_cast<char*>(receiverID.c_str());
|
|
char* senderID_cs = const_cast<char*>(senderID.c_str());
|
|
|
|
insert_single_message_to_local_storage(NewBaseCallBack(result), operationID_cs, message_cs, receiverID_cs, senderID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::insertGroupMessageToLocalStorage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto message = value_2_json(arguments->at(flutter::EncodableValue("message")));
|
|
auto groupID = zego_value_get_string(arguments->at(flutter::EncodableValue("groupID")));
|
|
auto channelID = zego_value_get_string(arguments->at(flutter::EncodableValue("channelID")));
|
|
auto senderID = zego_value_get_string(arguments->at(flutter::EncodableValue("senderID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* message_cs = const_cast<char*>(message.c_str());
|
|
char* groupID_cs = const_cast<char*>(groupID.c_str());
|
|
char* channelID_cs = const_cast<char*>(channelID.c_str());
|
|
char* senderID_cs = const_cast<char*>(senderID.c_str());
|
|
|
|
insert_group_message_to_local_storage(NewBaseCallBack(result), operationID_cs, message_cs, groupID_cs, channelID_cs, senderID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::markMessagesAsReadByMsgID(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto conversationID = zego_value_get_string(arguments->at(flutter::EncodableValue("conversationID")));
|
|
auto messageIDList = value_2_json(arguments->at(flutter::EncodableValue("messageIDList")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* conversationID_cs = const_cast<char*>(conversationID.c_str());
|
|
char* messageIDList_cs = const_cast<char*>(messageIDList.c_str());
|
|
|
|
mark_messages_as_read_by_msg_id(NewBaseCallBack(result), operationID_cs, conversationID_cs, messageIDList_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::typingStatusUpdate(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto userID = zego_value_get_string(arguments->at(flutter::EncodableValue("userID")));
|
|
auto msgTip = zego_value_get_string(arguments->at(flutter::EncodableValue("msgTip")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* userID_cs = const_cast<char*>(userID.c_str());
|
|
char* msgTip_cs = const_cast<char*>(msgTip.c_str());
|
|
|
|
typing_status_update(NewBaseCallBack(result), operationID_cs, userID_cs, msgTip_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createTextMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto text = zego_value_get_string(arguments->at(flutter::EncodableValue("text")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* text_cs = const_cast<char*>(text.c_str());
|
|
|
|
std::string message = create_text_message(operationID_cs, text_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createTextAtMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto text = zego_value_get_string(arguments->at(flutter::EncodableValue("text")));
|
|
auto atUserIDList = value_2_json(arguments->at(flutter::EncodableValue("atUserIDList")));
|
|
auto atUserInfoList = value_2_json(arguments->at(flutter::EncodableValue("atUserInfoList")));
|
|
auto quoteMessage = value_2_json(arguments->at(flutter::EncodableValue("quoteMessage")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* text_cs = const_cast<char*>(text.c_str());
|
|
char* atUserIDList_cs = const_cast<char*>(atUserIDList.c_str());
|
|
char* atUserInfoList_cs = const_cast<char*>(atUserInfoList.c_str());
|
|
char* quoteMessage_cs = const_cast<char*>(quoteMessage.c_str());
|
|
|
|
std::string message = create_text_at_message(operationID_cs, text_cs, atUserIDList_cs, atUserInfoList_cs, quoteMessage_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createImageMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto imagePath = zego_value_get_string(arguments->at(flutter::EncodableValue("imagePath")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* imagePath_cs = const_cast<char*>(imagePath.c_str());
|
|
|
|
std::string message = create_image_message(operationID_cs, imagePath_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createImageMessageFromFullPath(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto imagePath = zego_value_get_string(arguments->at(flutter::EncodableValue("imagePath")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* imagePath_cs = const_cast<char*>(imagePath.c_str());
|
|
|
|
std::string message = create_image_message_from_full_path(operationID_cs, imagePath_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createSoundMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto soundPath = zego_value_get_string(arguments->at(flutter::EncodableValue("soundPath")));
|
|
auto duration = zego_value_get_int(arguments->at(flutter::EncodableValue("duration")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* soundPath_cs = const_cast<char*>(soundPath.c_str());
|
|
|
|
std::string message = create_sound_message(operationID_cs, soundPath_cs, duration);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createSoundMessageFromFullPath(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto soundPath = zego_value_get_string(arguments->at(flutter::EncodableValue("soundPath")));
|
|
auto duration = zego_value_get_int(arguments->at(flutter::EncodableValue("duration")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* soundPath_cs = const_cast<char*>(soundPath.c_str());
|
|
|
|
std::string message = create_sound_message_from_full_path(operationID_cs, soundPath_cs, duration);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createVideoMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto videoPath = zego_value_get_string(arguments->at(flutter::EncodableValue("videoPath")));
|
|
auto videoType = zego_value_get_string(arguments->at(flutter::EncodableValue("videoType")));
|
|
auto duration = zego_value_get_int(arguments->at(flutter::EncodableValue("duration")));
|
|
auto snapshotPath = zego_value_get_string(arguments->at(flutter::EncodableValue("snapshotPath")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* videoPath_cs = const_cast<char*>(videoPath.c_str());
|
|
char* videoType_cs = const_cast<char*>(videoType.c_str());
|
|
char* snapshotPath_cs = const_cast<char*>(snapshotPath.c_str());
|
|
|
|
std::string message = create_video_message(operationID_cs, videoPath_cs, videoType_cs, duration, snapshotPath_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createVideoMessageFromFullPath(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto videoPath = zego_value_get_string(arguments->at(flutter::EncodableValue("videoPath")));
|
|
auto videoType = zego_value_get_string(arguments->at(flutter::EncodableValue("videoType")));
|
|
auto duration = zego_value_get_int(arguments->at(flutter::EncodableValue("duration")));
|
|
auto snapshotPath = zego_value_get_string(arguments->at(flutter::EncodableValue("snapshotPath")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* videoPath_cs = const_cast<char*>(videoPath.c_str());
|
|
char* videoType_cs = const_cast<char*>(videoType.c_str());
|
|
char* snapshotPath_cs = const_cast<char*>(snapshotPath.c_str());
|
|
|
|
std::string message = create_video_message_from_full_path(operationID_cs, videoPath_cs, videoType_cs, duration, snapshotPath_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createFileMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto filePath = zego_value_get_string(arguments->at(flutter::EncodableValue("filePath")));
|
|
auto fileName = zego_value_get_string(arguments->at(flutter::EncodableValue("fileName")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* filePath_cs = const_cast<char*>(filePath.c_str());
|
|
char* fileName_cs = const_cast<char*>(fileName.c_str());
|
|
|
|
std::string message = create_file_message(operationID_cs, filePath_cs, fileName_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createFileMessageFromFullPath(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto filePath = zego_value_get_string(arguments->at(flutter::EncodableValue("filePath")));
|
|
auto fileName = zego_value_get_string(arguments->at(flutter::EncodableValue("fileName")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* filePath_cs = const_cast<char*>(filePath.c_str());
|
|
char* fileName_cs = const_cast<char*>(fileName.c_str());
|
|
|
|
std::string message = create_file_message_from_full_path(operationID_cs, filePath_cs, fileName_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createMergerMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto messageList = value_2_json(arguments->at(flutter::EncodableValue("messageList")));
|
|
auto title = zego_value_get_string(arguments->at(flutter::EncodableValue("title")));
|
|
auto summaryList = value_2_json(arguments->at(flutter::EncodableValue("summaryList")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* messageList_cs = const_cast<char*>(messageList.c_str());
|
|
char* title_cs = const_cast<char*>(title.c_str());
|
|
char* summaryList_cs = const_cast<char*>(summaryList.c_str());
|
|
|
|
std::string message = create_merger_message(operationID_cs, messageList_cs, title_cs, summaryList_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createForwardMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto message = value_2_json(arguments->at(flutter::EncodableValue("message")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* message_cs = const_cast<char*>(message.c_str());
|
|
|
|
std::string resultMessage = create_forward_message(operationID_cs, message_cs);
|
|
result->Success(flutter::EncodableValue(resultMessage));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createLocationMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto description = zego_value_get_string(arguments->at(flutter::EncodableValue("description")));
|
|
auto longitude = zego_value_get_double(arguments->at(flutter::EncodableValue("longitude")));
|
|
auto latitude = zego_value_get_double(arguments->at(flutter::EncodableValue("latitude")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* description_cs = const_cast<char*>(description.c_str());
|
|
|
|
|
|
std::string message = create_location_message(operationID_cs, description_cs, longitude, latitude);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createCustomMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto data = zego_value_get_string(arguments->at(flutter::EncodableValue("data")));
|
|
auto extension = zego_value_get_string(arguments->at(flutter::EncodableValue("extension")));
|
|
auto description = zego_value_get_string(arguments->at(flutter::EncodableValue("description")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* data_cs = const_cast<char*>(data.c_str());
|
|
char* extension_cs = const_cast<char*>(extension.c_str());
|
|
char* description_cs = const_cast<char*>(description.c_str());
|
|
|
|
std::string message = create_custom_message(operationID_cs, data_cs, extension_cs, description_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createQuoteMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto quoteText = zego_value_get_string(arguments->at(flutter::EncodableValue("quoteText")));
|
|
auto quoteMessage = value_2_json(arguments->at(flutter::EncodableValue("quoteMessage")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* quoteText_cs = const_cast<char*>(quoteText.c_str());
|
|
char* quoteMessage_cs = const_cast<char*>(quoteMessage.c_str());
|
|
|
|
std::string message = create_quote_message(operationID_cs, quoteText_cs, quoteMessage_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createCardMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto cardMessage = value_2_json(arguments->at(flutter::EncodableValue("cardMessage")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* cardMessage_cs = const_cast<char*>(cardMessage.c_str());
|
|
|
|
std::string message = create_card_message(operationID_cs, cardMessage_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createFaceMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto index = zego_value_get_int(arguments->at(flutter::EncodableValue("index")));
|
|
auto data = zego_value_get_string(arguments->at(flutter::EncodableValue("data")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* data_cs = const_cast<char*>(data.c_str());
|
|
|
|
std::string message = create_face_message(operationID_cs, index, data_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createAdvancedTextMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto text = zego_value_get_string(arguments->at(flutter::EncodableValue("text")));
|
|
auto richMessageInfoList = value_2_json(arguments->at(flutter::EncodableValue("richMessageInfoList")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* text_cs = const_cast<char*>(text.c_str());
|
|
char* richMessageInfoList_cs = const_cast<char*>(richMessageInfoList.c_str());
|
|
|
|
std::string message = create_advanced_text_message(operationID_cs, text_cs, richMessageInfoList_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createAdvancedQuoteMessage(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto quoteText = zego_value_get_string(arguments->at(flutter::EncodableValue("quoteText")));
|
|
auto quoteMessage = value_2_json(arguments->at(flutter::EncodableValue("quoteMessage")));
|
|
auto richMessageInfoList = value_2_json(arguments->at(flutter::EncodableValue("richMessageInfoList")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* quoteText_cs = const_cast<char*>(quoteText.c_str());
|
|
char* quoteMessage_cs = const_cast<char*>(quoteMessage.c_str());
|
|
char* richMessageInfoList_cs = const_cast<char*>(richMessageInfoList.c_str());
|
|
|
|
std::string message = create_advanced_quote_message(operationID_cs, quoteText_cs, quoteMessage_cs, richMessageInfoList_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::searchLocalMessages(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto filter = value_2_json(arguments->at(flutter::EncodableValue("filter")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* filter_cs = const_cast<char*>(filter.c_str());
|
|
|
|
search_local_messages(NewBaseCallBack(result), operationID_cs, filter_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::clearConversationAndDeleteAllMsg(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto conversationID = zego_value_get_string(arguments->at(flutter::EncodableValue("conversationID")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* conversationID_cs = const_cast<char*>(conversationID.c_str());
|
|
|
|
clear_conversation_and_delete_all_msg(NewBaseCallBack(result), operationID_cs, conversationID_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::getAdvancedHistoryMessageList(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto params = map_2_json(*arguments);
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* params_cs = const_cast<char*>(params.c_str());
|
|
|
|
get_advanced_history_message_list(NewBaseCallBack(result), operationID_cs, params_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::getAdvancedHistoryMessageListReverse(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto params = map_2_json(*arguments);
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* params_cs = const_cast<char*>(params.c_str());
|
|
|
|
get_advanced_history_message_list_reverse(NewBaseCallBack(result), operationID_cs, params_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::findMessageList(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto searchParams = value_2_json(arguments->at(flutter::EncodableValue("searchParams")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* searchParams_cs = const_cast<char*>(searchParams.c_str());
|
|
|
|
find_message_list(NewBaseCallBack(result), operationID_cs, searchParams_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::setMessageLocalEx(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto conversationID = zego_value_get_string(arguments->at(flutter::EncodableValue("conversationID")));
|
|
auto clientMsgID = zego_value_get_string(arguments->at(flutter::EncodableValue("clientMsgID")));
|
|
auto localEx = zego_value_get_string(arguments->at(flutter::EncodableValue("localEx")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* conversationID_cs = const_cast<char*>(conversationID.c_str());
|
|
char* clientMsgID_cs = const_cast<char*>(clientMsgID.c_str());
|
|
char* localEx_cs = const_cast<char*>(localEx.c_str());
|
|
|
|
set_message_local_ex(NewBaseCallBack(result), operationID_cs, conversationID_cs, clientMsgID_cs, localEx_cs);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::setAppBadge(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto count = zego_value_get_int(arguments->at(flutter::EncodableValue("count")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
|
|
set_app_Badge(NewBaseCallBack(result), operationID_cs, count);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::sendMessageNotOss(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto message = value_2_json(arguments->at(flutter::EncodableValue("message")));
|
|
auto userID = zego_value_get_string(arguments->at(flutter::EncodableValue("userID")));
|
|
auto groupID = zego_value_get_string(arguments->at(flutter::EncodableValue("groupID")));
|
|
auto channelId = zego_value_get_string(arguments->at(flutter::EncodableValue("channelId")));
|
|
auto offlinePushInfo = value_2_json(arguments->at(flutter::EncodableValue("offlinePushInfo")));
|
|
auto isOnlineOnly = zego_value_get_bool(arguments->at(flutter::EncodableValue("isOnlineOnly")));
|
|
|
|
auto json = EncodableValueToJson(arguments->at(flutter::EncodableValue("message")));
|
|
auto clientMsgID = json["clientMsgID"].get<std::string>();
|
|
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* message_cs = const_cast<char*>(message.c_str());
|
|
char* userID_cs = const_cast<char*>(userID.c_str());
|
|
char* groupID_cs = const_cast<char*>(groupID.c_str());
|
|
char* channelId_cs = const_cast<char*>(channelId.c_str());
|
|
char* offlinePushInfo_cs = const_cast<char*>(offlinePushInfo.c_str());
|
|
|
|
send_message_not_oss(NewMsgSendCallBack(result,clientMsgID), operationID_cs, message_cs, userID_cs, groupID_cs, channelId_cs, offlinePushInfo_cs, isOnlineOnly);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createImageMessageByURL(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto sourcePath = zego_value_get_string(arguments->at(flutter::EncodableValue("sourcePath")));
|
|
auto sourcePicture = value_2_json(arguments->at(flutter::EncodableValue("sourcePicture")));
|
|
auto bigPicture = value_2_json(arguments->at(flutter::EncodableValue("bigPicture")));
|
|
auto snapshotPicture = value_2_json(arguments->at(flutter::EncodableValue("snapshotPicture")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* sourcePath_cs = const_cast<char*>(sourcePath.c_str());
|
|
char* sourcePicture_cs = const_cast<char*>(sourcePicture.c_str());
|
|
char* bigPicture_cs = const_cast<char*>(bigPicture.c_str());
|
|
char* snapshotPicture_cs = const_cast<char*>(snapshotPicture.c_str());
|
|
|
|
std::string message = create_image_message_by_url(operationID_cs, sourcePath_cs, sourcePicture_cs, bigPicture_cs, snapshotPicture_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createSoundMessageByURL(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto soundElem = value_2_json(arguments->at(flutter::EncodableValue("soundElem")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* soundElem_cs = const_cast<char*>(soundElem.c_str());
|
|
|
|
std::string message = create_sound_message_by_url(operationID_cs, soundElem_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createVideoMessageByURL(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto videoElem = value_2_json(arguments->at(flutter::EncodableValue("videoElem")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* videoElem_cs = const_cast<char*>(videoElem.c_str());
|
|
|
|
std::string message = create_video_message_by_url(operationID_cs, videoElem_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::createFileMessageByURL(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto fileElem = value_2_json(arguments->at(flutter::EncodableValue("fileElem")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* fileElem_cs = const_cast<char*>(fileElem.c_str());
|
|
|
|
std::string message = create_file_message_by_url(operationID_cs, fileElem_cs);
|
|
result->Success(flutter::EncodableValue(message));
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::fetchSurroundingMessages(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID")));
|
|
auto message = value_2_json(arguments->at(flutter::EncodableValue("message")));
|
|
auto before = zego_value_get_int(arguments->at(flutter::EncodableValue("before")));
|
|
auto after = zego_value_get_int(arguments->at(flutter::EncodableValue("after")));
|
|
char* operationID_cs = const_cast<char*>(operationID.c_str());
|
|
char* message_cs = const_cast<char*>(message.c_str());
|
|
|
|
fetch_surrounding_messages(NewBaseCallBack(result), operationID_cs, message_cs, before, after);
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
}
|
|
|
|
void MessageManagerService::setCustomBusinessListener(
|
|
const flutter::EncodableMap* arguments,
|
|
std::shared_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
if (arguments) {
|
|
set_custom_business_listener(NewCustomBusinessListenCallBack());
|
|
result->Success(flutter::EncodableValue());
|
|
} else {
|
|
result->Error("INVALID_ARGUMENT", "Arguments cannot be null");
|
|
}
|
|
} |