Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3379524
D11666.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D11666.diff
View Options
diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
@@ -116,8 +116,8 @@
storeOlmPersistData(int accountID, crypto::Persist persist) const = 0;
virtual void setNotifyToken(std::string token) const = 0;
virtual void clearNotifyToken() const = 0;
- virtual void setCurrentUserID(std::string userID) const = 0;
- virtual std::string getCurrentUserID() const = 0;
+ virtual void stampSQLiteDBUserID(std::string userID) const = 0;
+ virtual std::string getSQLiteStampedUserID() const = 0;
virtual void setMetadata(std::string entry_name, std::string data) const = 0;
virtual void clearMetadata(std::string entry_name) const = 0;
virtual std::string getMetadata(std::string entry_name) const = 0;
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
@@ -128,8 +128,8 @@
storeOlmPersistData(int accountID, crypto::Persist persist) const override;
void setNotifyToken(std::string token) const override;
void clearNotifyToken() const override;
- void setCurrentUserID(std::string userID) const override;
- std::string getCurrentUserID() const override;
+ void stampSQLiteDBUserID(std::string userID) const override;
+ std::string getSQLiteStampedUserID() const override;
void setMetadata(std::string entry_name, std::string data) const override;
void clearMetadata(std::string entry_name) const override;
std::string getMetadata(std::string entry_name) const override;
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -1954,11 +1954,11 @@
this->clearMetadata("notify_token");
}
-void SQLiteQueryExecutor::setCurrentUserID(std::string userID) const {
+void SQLiteQueryExecutor::stampSQLiteDBUserID(std::string userID) const {
this->setMetadata("current_user_id", userID);
}
-std::string SQLiteQueryExecutor::getCurrentUserID() const {
+std::string SQLiteQueryExecutor::getSQLiteStampedUserID() const {
return this->getMetadata("current_user_id");
}
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
@@ -149,8 +149,8 @@
setNotifyToken(jsi::Runtime &rt, jsi::String token) override;
virtual jsi::Value clearNotifyToken(jsi::Runtime &rt) override;
virtual jsi::Value
- setCurrentUserID(jsi::Runtime &rt, jsi::String userID) override;
- virtual jsi::Value getCurrentUserID(jsi::Runtime &rt) override;
+ stampSQLiteDBUserID(jsi::Runtime &rt, jsi::String userID) override;
+ virtual jsi::Value getSQLiteStampedUserID(jsi::Runtime &rt) override;
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) override;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) override;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) 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
@@ -1439,7 +1439,7 @@
};
jsi::Value
-CommCoreModule::setCurrentUserID(jsi::Runtime &rt, jsi::String userID) {
+CommCoreModule::stampSQLiteDBUserID(jsi::Runtime &rt, jsi::String userID) {
auto currentUserID{userID.utf8(rt)};
return createPromiseAsJSIValue(
rt,
@@ -1448,7 +1448,8 @@
taskType job = [this, promise, currentUserID]() {
std::string error;
try {
- DatabaseManager::getQueryExecutor().setCurrentUserID(currentUserID);
+ DatabaseManager::getQueryExecutor().stampSQLiteDBUserID(
+ currentUserID);
} catch (const std::exception &e) {
error = e.what();
}
@@ -1465,14 +1466,15 @@
});
}
-jsi::Value CommCoreModule::getCurrentUserID(jsi::Runtime &rt) {
+jsi::Value CommCoreModule::getSQLiteStampedUserID(jsi::Runtime &rt) {
return createPromiseAsJSIValue(
rt, [this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
taskType job = [this, &innerRt, promise]() {
std::string error;
std::string result;
try {
- result = DatabaseManager::getQueryExecutor().getCurrentUserID();
+ result =
+ DatabaseManager::getQueryExecutor().getSQLiteStampedUserID();
} catch (const std::exception &e) {
error = e.what();
}
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
@@ -133,11 +133,11 @@
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearNotifyToken(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->clearNotifyToken(rt);
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setCurrentUserID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->setCurrentUserID(rt, args[0].asString(rt));
+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_stampSQLiteDBUserID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->stampSQLiteDBUserID(rt, args[0].asString(rt));
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCurrentUserID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getCurrentUserID(rt);
+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getSQLiteStampedUserID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getSQLiteStampedUserID(rt);
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearSensitiveData(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->clearSensitiveData(rt);
@@ -232,8 +232,8 @@
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};
- methodMap_["getCurrentUserID"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCurrentUserID};
+ methodMap_["stampSQLiteDBUserID"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_stampSQLiteDBUserID};
+ methodMap_["getSQLiteStampedUserID"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getSQLiteStampedUserID};
methodMap_["clearSensitiveData"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearSensitiveData};
methodMap_["checkIfDatabaseNeedsDeletion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_checkIfDatabaseNeedsDeletion};
methodMap_["reportDBOperationsFailure"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_reportDBOperationsFailure};
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
@@ -59,8 +59,8 @@
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;
- virtual jsi::Value getCurrentUserID(jsi::Runtime &rt) = 0;
+ virtual jsi::Value stampSQLiteDBUserID(jsi::Runtime &rt, jsi::String userID) = 0;
+ virtual jsi::Value getSQLiteStampedUserID(jsi::Runtime &rt) = 0;
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) = 0;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) = 0;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) = 0;
@@ -410,21 +410,21 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::clearNotifyToken, jsInvoker_, instance_);
}
- jsi::Value setCurrentUserID(jsi::Runtime &rt, jsi::String userID) override {
+ jsi::Value stampSQLiteDBUserID(jsi::Runtime &rt, jsi::String userID) override {
static_assert(
- bridging::getParameterCount(&T::setCurrentUserID) == 2,
- "Expected setCurrentUserID(...) to have 2 parameters");
+ bridging::getParameterCount(&T::stampSQLiteDBUserID) == 2,
+ "Expected stampSQLiteDBUserID(...) to have 2 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::setCurrentUserID, jsInvoker_, instance_, std::move(userID));
+ rt, &T::stampSQLiteDBUserID, jsInvoker_, instance_, std::move(userID));
}
- jsi::Value getCurrentUserID(jsi::Runtime &rt) override {
+ jsi::Value getSQLiteStampedUserID(jsi::Runtime &rt) override {
static_assert(
- bridging::getParameterCount(&T::getCurrentUserID) == 1,
- "Expected getCurrentUserID(...) to have 1 parameters");
+ bridging::getParameterCount(&T::getSQLiteStampedUserID) == 1,
+ "Expected getSQLiteStampedUserID(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::getCurrentUserID, jsInvoker_, instance_);
+ rt, &T::getSQLiteStampedUserID, jsInvoker_, instance_);
}
jsi::Value clearSensitiveData(jsi::Runtime &rt) override {
static_assert(
diff --git a/native/data/sqlite-data-handler.js b/native/data/sqlite-data-handler.js
--- a/native/data/sqlite-data-handler.js
+++ b/native/data/sqlite-data-handler.js
@@ -139,12 +139,12 @@
const handleSensitiveData = React.useCallback(async () => {
try {
- const databaseCurrentUserInfoID = await commCoreModule.getCurrentUserID();
- if (shouldClearData(databaseCurrentUserInfoID, currentLoggedInUserID)) {
+ const sqliteStampedUserID = await commCoreModule.getSQLiteStampedUserID();
+ if (shouldClearData(sqliteStampedUserID, currentLoggedInUserID)) {
await callClearSensitiveData('change in logged-in user credentials');
}
if (currentLoggedInUserID) {
- await commCoreModule.setCurrentUserID(currentLoggedInUserID);
+ await commCoreModule.stampSQLiteDBUserID(currentLoggedInUserID);
}
} catch (e) {
if (isTaskCancelledError(e)) {
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -126,8 +126,8 @@
+terminate: () => void;
+setNotifyToken: (token: string) => Promise<void>;
+clearNotifyToken: () => Promise<void>;
- +setCurrentUserID: (userID: string) => Promise<void>;
- +getCurrentUserID: () => Promise<string>;
+ +stampSQLiteDBUserID: (userID: string) => Promise<void>;
+ +getSQLiteStampedUserID: () => Promise<string>;
+clearSensitiveData: () => Promise<void>;
+checkIfDatabaseNeedsDeletion: () => boolean;
+reportDBOperationsFailure: () => void;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 4:45 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594462
Default Alt Text
D11666.diff (11 KB)
Attached To
Mode
D11666: [native] Rename get/setCurrentUserID in CommCoreModule
Attached
Detach File
Event Timeline
Log In to Comment