Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3306774
D3138.id9464.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D3138.id9464.diff
View Options
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
@@ -13,6 +13,8 @@
namespace jsi = facebook::jsi;
class CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {
+ const int codeVersion{129};
+
std::unique_ptr<WorkerThread> databaseThread;
std::unique_ptr<WorkerThread> cryptoThread;
@@ -52,6 +54,7 @@
jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) override;
jsi::Object
openSocket(jsi::Runtime &rt, const jsi::String &endpoint) override;
+ double getCodeVersion(jsi::Runtime &rt) override;
public:
CommCoreModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -900,6 +900,10 @@
databaseThread(std::make_unique<WorkerThread>("database")),
cryptoThread(std::make_unique<WorkerThread>("crypto")) {
GlobalNetworkSingleton::instance.enableMultithreading();
+}
+
+double CommCoreModule::getCodeVersion(jsi::Runtime &rt) {
+ return this->codeVersion;
};
} // namespace comm
diff --git a/native/cpp/CommonCpp/_generated/NativeModules.h b/native/cpp/CommonCpp/_generated/NativeModules.h
--- a/native/cpp/CommonCpp/_generated/NativeModules.h
+++ b/native/cpp/CommonCpp/_generated/NativeModules.h
@@ -35,6 +35,7 @@
virtual jsi::Value getUserPublicKey(jsi::Runtime &rt) = 0;
virtual jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) = 0;
virtual jsi::Object openSocket(jsi::Runtime &rt, const jsi::String &endpoint) = 0;
+virtual double getCodeVersion(jsi::Runtime &rt) = 0;
};
diff --git a/native/cpp/CommonCpp/_generated/NativeModules.cpp b/native/cpp/CommonCpp/_generated/NativeModules.cpp
--- a/native/cpp/CommonCpp/_generated/NativeModules.cpp
+++ b/native/cpp/CommonCpp/_generated/NativeModules.cpp
@@ -63,6 +63,9 @@
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_openSocket(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->openSocket(rt, args[0].getString(rt));
}
+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCodeVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getCodeVersion(rt);
+}
CommCoreModuleSchemaCxxSpecJSI::CommCoreModuleSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule("CommTurboModule", jsInvoker) {
@@ -83,6 +86,7 @@
methodMap_["getUserPublicKey"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey};
methodMap_["getUserOneTimeKeys"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserOneTimeKeys};
methodMap_["openSocket"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_openSocket};
+ methodMap_["getCodeVersion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCodeVersion};
}
diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -381,7 +381,7 @@
timeout: ((__DEV__ ? 0 : undefined): number | void),
};
-const codeVersion = 129;
+const codeVersion: number = global.CommCoreModule.getCodeVersion();
// This local exists to avoid a circular dependency where redux-setup needs to
// import all the navigation and screen stuff, but some of those screens want to
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -45,6 +45,7 @@
+getUserPublicKey: () => Promise<string>;
+getUserOneTimeKeys: () => Promise<string>;
+openSocket: (endpoint: string) => Object;
+ +getCodeVersion: () => number;
}
export default (TurboModuleRegistry.getEnforcing<Spec>(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 10:24 PM (22 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540394
Default Alt Text
D3138.id9464.diff (4 KB)
Attached To
Mode
D3138: [CommCoreModule] Introduce `getCodeVersion()`
Attached
Detach File
Event Timeline
Log In to Comment