Page MenuHomePhabricator

D3982.id12551.diff
No OneTemporary

D3982.id12551.diff

diff --git a/native/cpp/CommonCpp/NativeModules/MessageOperationsUtilities/MessageOperationsUtilities.cpp b/native/cpp/CommonCpp/NativeModules/MessageOperationsUtilities/MessageOperationsUtilities.cpp
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/NativeModules/MessageOperationsUtilities/MessageOperationsUtilities.cpp
@@ -0,0 +1,24 @@
+#include "MessageOperationsUtilities.h"
+#include "MessageSpecs.h"
+
+#include <folly/String.h>
+
+namespace comm {
+Media MessageOperationsUtilities::translateMediaToClientDBMediaInfo(
+ const folly::dynamic &rawMediaInfo,
+ const std::string &container,
+ const std::string &thread) {
+ std::string id = rawMediaInfo["id"].asString();
+ std::string uri = rawMediaInfo["uri"].asString();
+ std::string type = rawMediaInfo["type"].asString();
+ folly::dynamic extrasData =
+ folly::dynamic::object("dimensions", rawMediaInfo["dimensions"])(
+ "loop", (type == "video") ? rawMediaInfo["loop"] : false);
+ if (rawMediaInfo.count("localMediaSelection")) {
+ extrasData["local_media_selection"] = rawMediaInfo["localMediaSelection"];
+ }
+ std::string extras = folly::toJson(extrasData);
+ return Media{id, container, thread, uri, type, extras};
+}
+
+} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 8:38 AM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2520406
Default Alt Text
D3982.id12551.diff (1 KB)

Event Timeline