Page MenuHomePhorge

D4793.1768205583.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D4793.1768205583.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
@@ -780,6 +780,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
Mon, Jan 12, 8:13 AM (12 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5922393
Default Alt Text
D4793.1768205583.diff (2 KB)

Event Timeline