Page MenuHomePhabricator

D12735.diff
No OneTemporary

D12735.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
@@ -9,6 +9,7 @@
#include "entities/IntegrityThreadHash.h"
#include "entities/KeyserverInfo.h"
#include "entities/LocalMessageInfo.h"
+#include "entities/Media.h"
#include "entities/Message.h"
#include "entities/MessageStoreThread.h"
#include "entities/OlmPersistAccount.h"
@@ -40,8 +41,7 @@
virtual void removeAllDrafts() const = 0;
virtual void removeDrafts(const std::vector<std::string> &ids) const = 0;
virtual void removeAllMessages() const = 0;
- virtual std::vector<std::pair<Message, std::vector<Media>>>
- getAllMessages() const = 0;
+ virtual std::vector<MessageEntity> getAllMessages() const = 0;
virtual void removeMessages(const std::vector<std::string> &ids) const = 0;
virtual void
removeMessagesForThreads(const std::vector<std::string> &threadIDs) 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
@@ -9,6 +9,8 @@
#include "entities/IntegrityThreadHash.h"
#include "entities/KeyserverInfo.h"
#include "entities/LocalMessageInfo.h"
+#include "entities/Media.h"
+#include "entities/Message.h"
#include "entities/ThreadActivityEntry.h"
#include "entities/UserInfo.h"
@@ -57,8 +59,7 @@
void removeAllDrafts() const override;
void removeDrafts(const std::vector<std::string> &ids) const override;
void removeAllMessages() const override;
- std::vector<std::pair<Message, std::vector<Media>>>
- getAllMessages() const override;
+ std::vector<MessageEntity> getAllMessages() const override;
void removeMessages(const std::vector<std::string> &ids) const override;
void removeMessagesForThreads(
const std::vector<std::string> &threadIDs) 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
@@ -1337,8 +1337,7 @@
removeAllEntities(SQLiteQueryExecutor::getConnection(), removeAllMessagesSQL);
}
-std::vector<std::pair<Message, std::vector<Media>>>
-SQLiteQueryExecutor::getAllMessages() const {
+std::vector<MessageEntity> SQLiteQueryExecutor::getAllMessages() const {
static std::string getAllMessagesSQL =
"SELECT * "
"FROM messages "
@@ -1351,7 +1350,7 @@
"Failed to retrieve all messages.");
std::string prevMsgIdx{};
- std::vector<std::pair<Message, std::vector<Media>>> allMessages;
+ std::vector<MessageEntity> allMessages;
for (int stepResult = sqlite3_step(preparedSQL); stepResult == SQLITE_ROW;
stepResult = sqlite3_step(preparedSQL)) {
diff --git a/native/cpp/CommonCpp/DatabaseManagers/entities/Message.h b/native/cpp/CommonCpp/DatabaseManagers/entities/Message.h
--- a/native/cpp/CommonCpp/DatabaseManagers/entities/Message.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/entities/Message.h
@@ -85,4 +85,6 @@
std::vector<Media> medias;
};
+using MessageEntity = std::pair<Message, std::vector<Media>>;
+
} // namespace comm
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
@@ -1,6 +1,7 @@
#pragma once
#include "../CryptoTools/CryptoModule.h"
+#include "../DatabaseManagers/entities/Message.h"
#include "../Tools/CommMMKV.h"
#include "../Tools/CommSecureStore.h"
#include "../Tools/WorkerThread.h"
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
@@ -114,7 +114,7 @@
std::string error;
std::vector<Draft> draftsVector;
std::vector<Thread> threadsVector;
- std::vector<std::pair<Message, std::vector<Media>>> messagesVector;
+ std::vector<MessageEntity> messagesVector;
std::vector<MessageStoreThread> messageStoreThreadsVector;
std::vector<Report> reportStoreVector;
std::vector<UserInfo> userStoreVector;
@@ -158,8 +158,7 @@
}
auto draftsVectorPtr =
std::make_shared<std::vector<Draft>>(std::move(draftsVector));
- auto messagesVectorPtr = std::make_shared<
- std::vector<std::pair<Message, std::vector<Media>>>>(
+ auto messagesVectorPtr = std::make_shared<std::vector<MessageEntity>>(
std::move(messagesVector));
auto threadsVectorPtr =
std::make_shared<std::vector<Thread>>(std::move(threadsVector));
@@ -319,13 +318,13 @@
}
jsi::Array CommCoreModule::getAllMessagesSync(jsi::Runtime &rt) {
- auto messagesVector = NativeModuleUtils::runSyncOrThrowJSError<
- std::vector<std::pair<Message, std::vector<Media>>>>(rt, []() {
- return DatabaseManager::getQueryExecutor().getAllMessages();
- });
+ auto messagesVector =
+ NativeModuleUtils::runSyncOrThrowJSError<std::vector<MessageEntity>>(
+ rt, []() {
+ return DatabaseManager::getQueryExecutor().getAllMessages();
+ });
auto messagesVectorPtr =
- std::make_shared<std::vector<std::pair<Message, std::vector<Media>>>>(
- std::move(messagesVector));
+ std::make_shared<std::vector<MessageEntity>>(std::move(messagesVector));
jsi::Array jsiMessages =
this->messageStore.parseDBDataStore(rt, messagesVectorPtr);
return jsiMessages;
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.h
@@ -10,8 +10,6 @@
namespace comm {
-using MessageEntity = std::pair<Message, std::vector<Media>>;
-
class MessageStore : public BaseDataStore<DBOperationBase, MessageEntity> {
private:
static OperationType REKEY_OPERATION;

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 19, 3:22 PM (7 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2140187
Default Alt Text
D12735.diff (6 KB)

Event Timeline