From 1cc1fce3d00620f5a3c89df1cb6d27f375f3151c Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 16 Aug 2024 17:07:13 -0400 Subject: [PATCH] chore: Update message passing method in NotificationCenter --- src/app/core/message.h | 6 +++++- src/app/core/notification.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/core/message.h b/src/app/core/message.h index 78d09daf..0b477c31 100644 --- a/src/app/core/message.h +++ b/src/app/core/message.h @@ -10,6 +10,8 @@ #include #include +#include "absl/status/status.h" + namespace yaze { namespace app { namespace core { @@ -26,7 +28,7 @@ struct Message { class IMessageListener { public: virtual ~IMessageListener() = default; - virtual void OnMessageReceived(const Message& message) = 0; + virtual absl::Status OnMessageReceived(const Message& message) = 0; }; class IMessageProtocol { @@ -108,6 +110,8 @@ class Reflectable { virtual std::any GetPropertyValue(const std::string& property_name) const = 0; virtual void SetPropertyValue(const std::string& property_name, const std::any& value) = 0; + virtual std::any InvokeMethod(const std::string& method_name, + const std::vector& args) = 0; }; class ObjectFactory { diff --git a/src/app/core/notification.h b/src/app/core/notification.h index c1cf7ac1..9fbd9814 100644 --- a/src/app/core/notification.h +++ b/src/app/core/notification.h @@ -35,7 +35,7 @@ class NotificationCenter { void PostNotification(const Notification& notification) { const auto& observerList = observers[notification.type]; for (auto observer : observerList) { - observer->onMessageReceived(notification); + observer->OnMessageReceived(notification); } }