diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs.h index d92de3732..6f18337db 100644 --- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs.h +++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs.h @@ -1,97 +1,101 @@ #pragma once #include "MessageSpecs/ChangeRoleMessageSpec.h" #include "MessageSpecs/ChangeSettingsMessageSpec.h" #include "MessageSpecs/CreateEntryMessageSpec.h" #include "MessageSpecs/CreateSidebarMessageSpec.h" #include "MessageSpecs/CreateSubThreadMessageSpec.h" #include "MessageSpecs/CreateThreadMessageSpec.h" #include "MessageSpecs/DeleteEntryMessageSpec.h" #include "MessageSpecs/EditEntryMessageSpec.h" +#include "MessageSpecs/EditMessageSpec.h" #include "MessageSpecs/MessageSpec.h" #include "MessageSpecs/MultimediaMessageSpec.h" #include "MessageSpecs/ReactionMessageSpec.h" #include "MessageSpecs/RestoreEntryMessageSpec.h" #include "MessageSpecs/SidebarSourceMessageSpec.h" #include "MessageSpecs/TextMessageSpec.h" #include "MessageSpecs/UnsupportedMessageSpec.h" #include "MessageSpecs/UpdateRelationshipMessageSpec.h" #include namespace comm { enum class MessageType { TEXT, CREATE_THREAD, ADD_MEMBERS, CREATE_SUB_THREAD, CHANGE_SETTINGS, REMOVE_MEMBERS, CHANGE_ROLE, LEAVE_THREAD, JOIN_THREAD, CREATE_ENTRY, EDIT_ENTRY, DELETE_ENTRY, RESTORE_ENTRY, UNSUPPORTED, IMAGES, MULTIMEDIA, UPDATE_RELATIONSHIP, SIDEBAR_SOURCE, CREATE_SIDEBAR, REACTION, + EDIT_MESSAGE, }; const std::map> messageSpecsHolder = []() { std::map> message_specs_initializer; message_specs_initializer.insert( {MessageType::TEXT, std::make_unique()}); message_specs_initializer.insert( {MessageType::CREATE_THREAD, std::make_unique()}); message_specs_initializer.insert( {MessageType::CREATE_SUB_THREAD, std::make_unique()}); message_specs_initializer.insert( {MessageType::CHANGE_SETTINGS, std::make_unique()}); message_specs_initializer.insert( {MessageType::CHANGE_ROLE, std::make_unique()}); message_specs_initializer.insert( {MessageType::CREATE_ENTRY, std::make_unique()}); message_specs_initializer.insert( {MessageType::EDIT_ENTRY, std::make_unique()}); message_specs_initializer.insert( {MessageType::DELETE_ENTRY, std::make_unique()}); message_specs_initializer.insert( {MessageType::RESTORE_ENTRY, std::make_unique()}); message_specs_initializer.insert( {MessageType::UNSUPPORTED, std::make_unique()}); message_specs_initializer.insert( {MessageType::IMAGES, std::make_unique()}); message_specs_initializer.insert( {MessageType::MULTIMEDIA, std::make_unique()}); message_specs_initializer.insert( {MessageType::UPDATE_RELATIONSHIP, std::make_unique()}); message_specs_initializer.insert( {MessageType::CREATE_SIDEBAR, std::make_unique()}); message_specs_initializer.insert( {MessageType::REACTION, std::make_unique()}); message_specs_initializer.insert( {MessageType::SIDEBAR_SOURCE, std::make_unique()}); + message_specs_initializer.insert( + {MessageType::EDIT_MESSAGE, std::make_unique()}); return message_specs_initializer; }(); } // namespace comm diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs/EditMessageSpec.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs/EditMessageSpec.h new file mode 100644 index 000000000..6aafe322a --- /dev/null +++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs/EditMessageSpec.h @@ -0,0 +1,15 @@ +#pragma once + +#include "MessageSpec.h" + +namespace comm { +class EditMessageSpec : public MessageSpec { + virtual std::unique_ptr + messageContentForClientDB(const folly::dynamic &rawMessageInfo) override { + folly::dynamic textData = folly::dynamic::object( + "targetMessageID", + rawMessageInfo["targetMessageID"])("text", rawMessageInfo["text"]); + return std::make_unique(folly::toJson(textData)); + } +}; +} // namespace comm