Page MenuHomePhabricator

D6834.diff
No OneTemporary

D6834.diff

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
@@ -49,6 +49,7 @@
initializeCryptoAccount(jsi::Runtime &rt, jsi::String userId) override;
virtual jsi::Value getUserPublicKey(jsi::Runtime &rt) override;
virtual jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) override;
+ virtual void terminate(jsi::Runtime &rt) override;
virtual double getCodeVersion(jsi::Runtime &rt) override;
virtual jsi::Value
setNotifyToken(jsi::Runtime &rt, jsi::String token) override;
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
@@ -4,6 +4,7 @@
#include "DraftStoreOperations.h"
#include "InternalModules/GlobalDBSingleton.h"
#include "MessageStoreOperations.h"
+#include "TerminateApp.h"
#include "ThreadStoreOperations.h"
#include <ReactCommon/TurboModuleUtils.h>
@@ -721,6 +722,10 @@
});
}
+void CommCoreModule::terminate(jsi::Runtime &rt) {
+ TerminateApp::terminate();
+}
+
jsi::Value
CommCoreModule::initializeCryptoAccount(jsi::Runtime &rt, jsi::String userId) {
std::string userIdStr = userId.utf8(rt);
diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
@@ -62,6 +62,10 @@
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);
}
+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_terminate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->terminate(rt);
+ return jsi::Value::undefined();
+}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setNotifyToken(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->setNotifyToken(rt, args[0].asString(rt));
}
@@ -105,6 +109,7 @@
methodMap_["getUserPublicKey"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserPublicKey};
methodMap_["getUserOneTimeKeys"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUserOneTimeKeys};
methodMap_["getCodeVersion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCodeVersion};
+ methodMap_["terminate"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_terminate};
methodMap_["setNotifyToken"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setNotifyToken};
methodMap_["clearNotifyToken"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearNotifyToken};
methodMap_["setCurrentUserID"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setCurrentUserID};
diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h
--- a/native/cpp/CommonCpp/_generated/commJSI.h
+++ b/native/cpp/CommonCpp/_generated/commJSI.h
@@ -36,6 +36,7 @@
virtual jsi::Value getUserPublicKey(jsi::Runtime &rt) = 0;
virtual jsi::Value getUserOneTimeKeys(jsi::Runtime &rt) = 0;
virtual double getCodeVersion(jsi::Runtime &rt) = 0;
+ virtual void terminate(jsi::Runtime &rt) = 0;
virtual jsi::Value setNotifyToken(jsi::Runtime &rt, jsi::String token) = 0;
virtual jsi::Value clearNotifyToken(jsi::Runtime &rt) = 0;
virtual jsi::Value setCurrentUserID(jsi::Runtime &rt, jsi::String userID) = 0;
@@ -193,6 +194,14 @@
return bridging::callFromJs<double>(
rt, &T::getCodeVersion, jsInvoker_, instance_);
}
+ void terminate(jsi::Runtime &rt) override {
+ static_assert(
+ bridging::getParameterCount(&T::terminate) == 1,
+ "Expected terminate(...) to have 1 parameters");
+
+ return bridging::callFromJs<void>(
+ rt, &T::terminate, jsInvoker_, instance_);
+ }
jsi::Value setNotifyToken(jsi::Runtime &rt, jsi::String token) override {
static_assert(
bridging::getParameterCount(&T::setNotifyToken) == 2,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -56,6 +56,7 @@
+getUserPublicKey: () => Promise<ClientPublicKeys>;
+getUserOneTimeKeys: () => Promise<string>;
+getCodeVersion: () => number;
+ +terminate: () => void;
+setNotifyToken: (token: string) => Promise<void>;
+clearNotifyToken: () => Promise<void>;
+setCurrentUserID: (userID: string) => Promise<void>;

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 2:49 PM (20 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585188
Default Alt Text
D6834.diff (4 KB)

Event Timeline