no message
This commit is contained in:
@@ -10,8 +10,15 @@
|
||||
#include <flutter/standard_method_codec.h>
|
||||
|
||||
#include "FLTConvert.h"
|
||||
|
||||
#include "common/ThreadUtil.h"
|
||||
#include "common/services/IMManager.h"
|
||||
#include "common/services/UserManager.h"
|
||||
#include "common/services/FriendManager.h"
|
||||
#include "common/services/MessageManager.h"
|
||||
#include "common/services/GroupManager.h"
|
||||
#include "common/services/ChannelManager.h"
|
||||
#include "common/services/ConversationManager.h"
|
||||
#include "common/stable.h"
|
||||
|
||||
|
||||
const std::string kFLTNimCoreService = "serviceName";
|
||||
@@ -22,7 +29,12 @@ NimCore::~NimCore() {}
|
||||
|
||||
void NimCore::regService() {
|
||||
addService(new IMManagerService());
|
||||
|
||||
addService(new UserManagerService());
|
||||
addService(new FriendshipManagerService());
|
||||
addService(new MessageManagerService());
|
||||
addService(new GroupManagerService());
|
||||
addService(new ChannelManagerService());
|
||||
addService(new ConversationManagerService());
|
||||
}
|
||||
|
||||
void NimCore::cleanService() {
|
||||
@@ -85,8 +97,9 @@ void NimCore::onMethodCall(
|
||||
void NimCore::invokeMethod(const std::string& method,
|
||||
const flutter::EncodableMap& arguments) {
|
||||
if (m_channel) {
|
||||
m_channel->InvokeMethod(
|
||||
method, std::make_unique<flutter::EncodableValue>(arguments));
|
||||
// Use ThreadUtil to ensure we're on the platform thread
|
||||
ThreadUtil::InvokeMethodOnPlatformThread(
|
||||
m_channel, method, std::make_unique<flutter::EncodableValue>(arguments));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +128,16 @@ void NimCore::invokeMethod(const std::string& eventName,
|
||||
const InvokeMehtodCallback& callback) {
|
||||
invokeCallback = callback;
|
||||
if (m_channel) {
|
||||
m_channel->InvokeMethod(
|
||||
eventName, std::make_unique<flutter::EncodableValue>(arguments),
|
||||
std::make_unique<InterResult<flutter::EncodableValue>>());
|
||||
// Create shared pointers for the data to ensure copy constructibility
|
||||
auto eventNameCopy = std::make_shared<std::string>(eventName);
|
||||
auto argsCopy = std::make_shared<flutter::EncodableMap>(arguments);
|
||||
|
||||
// Use ThreadUtil to ensure we're on the platform thread
|
||||
ThreadUtil::RunOnPlatformThread([this, eventNameCopy, argsCopy]() {
|
||||
m_channel->InvokeMethod(
|
||||
*eventNameCopy, std::make_unique<flutter::EncodableValue>(*argsCopy),
|
||||
std::make_unique<InterResult<flutter::EncodableValue>>());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user