Page MenuHomePhabricator

D7450.diff
No OneTemporary

D7450.diff

diff --git a/native/android/app/CMakeLists.txt b/native/android/app/CMakeLists.txt
--- a/native/android/app/CMakeLists.txt
+++ b/native/android/app/CMakeLists.txt
@@ -118,7 +118,10 @@
"./src/cpp/jsiInstaller.cpp"
)
-set(GENERATED_NATIVE_CODE "../../cpp/CommonCpp/_generated/commJSI-generated.cpp")
+list(APPEND GENERATED_NATIVE_CODE
+ "../../cpp/CommonCpp/_generated/commJSI-generated.cpp"
+ "../../cpp/CommonCpp/_generated/utilsJSI-generated.cpp"
+)
set(RUST_NATIVE_CODE "../../native_rust_library/RustCallback.cpp")
file(GLOB CRYPTO_NATIVE_CODE "../../cpp/CommonCpp/CryptoTools/*.cpp")
file(GLOB DB_NATIVE_CODE "../../cpp/CommonCpp/DatabaseManagers/*.cpp")
diff --git a/native/codegen/src/index.js b/native/codegen/src/index.js
--- a/native/codegen/src/index.js
+++ b/native/codegen/src/index.js
@@ -7,7 +7,12 @@
import codeGen from './CodeGen.js';
('use strict');
-const schemaInPath = path.resolve('./schema/CommCoreModuleSchema.js');
const outPath = path.resolve('./cpp/CommonCpp/_generated');
-codeGen('comm', schemaInPath, ['cpp', 'h'], outPath);
+// CommCoreModule
+const coreModuleSchemaPath = path.resolve('./schema/CommCoreModuleSchema.js');
+codeGen('comm', coreModuleSchemaPath, ['cpp', 'h'], outPath);
+
+// CommUtilsModule
+const utilsModuleSchemaPath = path.resolve('./schema/CommUtilsModuleSchema.js');
+codeGen('utils', utilsModuleSchemaPath, ['cpp', 'h'], outPath);
diff --git a/native/cpp/CommonCpp/_generated/utilsJSI-generated.cpp b/native/cpp/CommonCpp/_generated/utilsJSI-generated.cpp
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/_generated/utilsJSI-generated.cpp
@@ -0,0 +1,34 @@
+/**
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ *
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
+ * once the code is regenerated.
+ *
+ * @generated by codegen project: GenerateModuleH.js
+ */
+
+#include "utilsJSI.h"
+
+namespace facebook {
+namespace react {
+
+static jsi::Value __hostFunction_CommUtilsModuleSchemaCxxSpecJSI_writeBufferToFile(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommUtilsModuleSchemaCxxSpecJSI *>(&turboModule)->writeBufferToFile(rt, args[0].asString(rt), args[1].asObject(rt));
+}
+static jsi::Value __hostFunction_CommUtilsModuleSchemaCxxSpecJSI_readBufferFromFile(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommUtilsModuleSchemaCxxSpecJSI *>(&turboModule)->readBufferFromFile(rt, args[0].asString(rt));
+}
+static jsi::Value __hostFunction_CommUtilsModuleSchemaCxxSpecJSI_base64EncodeBuffer(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommUtilsModuleSchemaCxxSpecJSI *>(&turboModule)->base64EncodeBuffer(rt, args[0].asObject(rt));
+}
+
+CommUtilsModuleSchemaCxxSpecJSI::CommUtilsModuleSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
+ : TurboModule("CommUtilsTurboModule", jsInvoker) {
+ methodMap_["writeBufferToFile"] = MethodMetadata {2, __hostFunction_CommUtilsModuleSchemaCxxSpecJSI_writeBufferToFile};
+ methodMap_["readBufferFromFile"] = MethodMetadata {1, __hostFunction_CommUtilsModuleSchemaCxxSpecJSI_readBufferFromFile};
+ methodMap_["base64EncodeBuffer"] = MethodMetadata {1, __hostFunction_CommUtilsModuleSchemaCxxSpecJSI_base64EncodeBuffer};
+}
+
+
+} // namespace react
+} // namespace facebook
diff --git a/native/cpp/CommonCpp/_generated/utilsJSI.h b/native/cpp/CommonCpp/_generated/utilsJSI.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/_generated/utilsJSI.h
@@ -0,0 +1,80 @@
+/**
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ *
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
+ * once the code is regenerated.
+ *
+ * @generated by codegen project: GenerateModuleH.js
+ */
+
+#pragma once
+
+#include <ReactCommon/TurboModule.h>
+#include <react/bridging/Bridging.h>
+
+namespace facebook {
+namespace react {
+
+class JSI_EXPORT CommUtilsModuleSchemaCxxSpecJSI : public TurboModule {
+protected:
+ CommUtilsModuleSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
+
+public:
+ virtual jsi::Value writeBufferToFile(jsi::Runtime &rt, jsi::String path, jsi::Object data) = 0;
+ virtual jsi::Value readBufferFromFile(jsi::Runtime &rt, jsi::String path) = 0;
+ virtual jsi::String base64EncodeBuffer(jsi::Runtime &rt, jsi::Object data) = 0;
+
+};
+
+template <typename T>
+class JSI_EXPORT CommUtilsModuleSchemaCxxSpec : public TurboModule {
+public:
+ jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
+ return delegate_.get(rt, propName);
+ }
+
+protected:
+ CommUtilsModuleSchemaCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
+ : TurboModule("CommUtilsTurboModule", jsInvoker),
+ delegate_(static_cast<T*>(this), jsInvoker) {}
+
+private:
+ class Delegate : public CommUtilsModuleSchemaCxxSpecJSI {
+ public:
+ Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
+ CommUtilsModuleSchemaCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
+
+ jsi::Value writeBufferToFile(jsi::Runtime &rt, jsi::String path, jsi::Object data) override {
+ static_assert(
+ bridging::getParameterCount(&T::writeBufferToFile) == 3,
+ "Expected writeBufferToFile(...) to have 3 parameters");
+
+ return bridging::callFromJs<jsi::Value>(
+ rt, &T::writeBufferToFile, jsInvoker_, instance_, std::move(path), std::move(data));
+ }
+ jsi::Value readBufferFromFile(jsi::Runtime &rt, jsi::String path) override {
+ static_assert(
+ bridging::getParameterCount(&T::readBufferFromFile) == 2,
+ "Expected readBufferFromFile(...) to have 2 parameters");
+
+ return bridging::callFromJs<jsi::Value>(
+ rt, &T::readBufferFromFile, jsInvoker_, instance_, std::move(path));
+ }
+ jsi::String base64EncodeBuffer(jsi::Runtime &rt, jsi::Object data) override {
+ static_assert(
+ bridging::getParameterCount(&T::base64EncodeBuffer) == 2,
+ "Expected base64EncodeBuffer(...) to have 2 parameters");
+
+ return bridging::callFromJs<jsi::String>(
+ rt, &T::base64EncodeBuffer, jsInvoker_, instance_, std::move(data));
+ }
+
+ private:
+ T *instance_;
+ };
+
+ Delegate delegate_;
+};
+
+} // namespace react
+} // namespace facebook
diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -37,6 +37,7 @@
7F8D602926535F2A0053CB29 /* IBMPlexSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7F8D602626535EEE0053CB29 /* IBMPlexSans-Regular.ttf */; };
7FA2DCDE293E62F500991BA4 /* CommIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7FA2DCDC293E62F500991BA4 /* CommIcons.ttf */; };
7FA2DCDF293E62F500991BA4 /* SWMansionIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7FA2DCDD293E62F500991BA4 /* SWMansionIcons.ttf */; };
+ 7FBB2A7629E94539002C6493 /* utilsJSI-generated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7FBB2A7529E94539002C6493 /* utilsJSI-generated.cpp */; };
7FE4D9F5291DFE9300667BF6 /* commJSI-generated.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7FE4D9F4291DFE9300667BF6 /* commJSI-generated.cpp */; };
8B38121629CE5742000C52E9 /* RustPromiseManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8B38121529CE5742000C52E9 /* RustPromiseManager.cpp */; };
8B652FA6295EAA5B009F8163 /* RustCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8B652FA5295EAA5B009F8163 /* RustCallback.cpp */; };
@@ -162,6 +163,8 @@
7F8D602726535EEE0053CB29 /* IBMPlexSans-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "IBMPlexSans-Bold.ttf"; path = "Resources/IBMPlexSans-Bold.ttf"; sourceTree = "<group>"; };
7FA2DCDC293E62F500991BA4 /* CommIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = CommIcons.ttf; path = ../fonts/CommIcons.ttf; sourceTree = "<group>"; };
7FA2DCDD293E62F500991BA4 /* SWMansionIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = SWMansionIcons.ttf; path = ../fonts/SWMansionIcons.ttf; sourceTree = "<group>"; };
+ 7FBB2A7529E94539002C6493 /* utilsJSI-generated.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "utilsJSI-generated.cpp"; sourceTree = "<group>"; };
+ 7FBB2A7729E94541002C6493 /* utilsJSI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utilsJSI.h; sourceTree = "<group>"; };
7FCEA2DC2444010B004017B1 /* Comm-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Comm-Bridging-Header.h"; sourceTree = "<group>"; };
7FCFD8BD1E81B8DF00629B0E /* Comm.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Comm.entitlements; path = Comm/Comm.entitlements; sourceTree = "<group>"; };
7FE4D9F3291DFE9300667BF6 /* commJSI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = commJSI.h; sourceTree = "<group>"; };
@@ -437,6 +440,8 @@
children = (
7FE4D9F4291DFE9300667BF6 /* commJSI-generated.cpp */,
7FE4D9F3291DFE9300667BF6 /* commJSI.h */,
+ 7FBB2A7529E94539002C6493 /* utilsJSI-generated.cpp */,
+ 7FBB2A7729E94541002C6493 /* utilsJSI.h */,
);
path = _generated;
sourceTree = "<group>";
@@ -985,6 +990,7 @@
71BE844A2636A944002849D2 /* CommCoreModule.cpp in Sources */,
71D4D7CC26C50B1000FCDBCD /* CommSecureStore.mm in Sources */,
8B38121629CE5742000C52E9 /* RustPromiseManager.cpp in Sources */,
+ 7FBB2A7629E94539002C6493 /* utilsJSI-generated.cpp in Sources */,
711B408425DA97F9005F8F06 /* dummy.swift in Sources */,
8E86A6D329537EBB000BBE7D /* DatabaseManager.cpp in Sources */,
CBDEC69B28ED867000C17588 /* GlobalDBSingleton.mm in Sources */,

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 1:40 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611858
Default Alt Text
D7450.diff (9 KB)

Event Timeline