Page MenuHomePhabricator

D4793.id16324.diff
No OneTemporary

D4793.id16324.diff

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
@@ -58,6 +58,8 @@
virtual void storeOlmPersistData(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 clearSensitiveData() 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
@@ -58,6 +58,8 @@
void storeOlmPersistData(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 clearSensitiveData() 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
@@ -835,6 +835,21 @@
SQLiteQueryExecutor::getStorage().remove<Metadata>("notify_token");
}
+void SQLiteQueryExecutor::setCurrentUserID(std::string userID) const {
+ Metadata entry{
+ "current_user_id",
+ userID,
+ };
+ SQLiteQueryExecutor::getStorage().replace(entry);
+}
+
+std::string SQLiteQueryExecutor::getCurrentUserID() const {
+ std::unique_ptr<Metadata> currentUserID =
+ SQLiteQueryExecutor::getStorage().get_pointer<Metadata>(
+ "current_user_id");
+ return (currentUserID == nullptr) ? "" : currentUserID->data;
+}
+
void SQLiteQueryExecutor::clearSensitiveData() const {
if (file_exists(SQLiteQueryExecutor::sqliteFilePath) &&
std::remove(SQLiteQueryExecutor::sqliteFilePath.c_str())) {

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 8:01 AM (11 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700577
Default Alt Text
D4793.id16324.diff (2 KB)

Event Timeline