Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3280522
D10780.id35956.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D10780.id35956.diff
View Options
diff --git a/lib/types/store-ops-types.js b/lib/types/store-ops-types.js
--- a/lib/types/store-ops-types.js
+++ b/lib/types/store-ops-types.js
@@ -12,6 +12,7 @@
import type { ClientReportCreationRequest } from './report-types.js';
import type { ClientDBThreadInfo, ThreadStore } from './thread-types.js';
import type { UserInfos } from './user-types.js';
+import type { ClientDBKeyserverInfo } from '../ops/keyserver-store-ops.js';
import type {
ClientDBMessageStoreOperation,
MessageStoreOperation,
@@ -52,6 +53,7 @@
+messageStoreThreads: $ReadOnlyArray<ClientDBThreadMessageInfo>,
+reports: $ReadOnlyArray<ClientDBReport>,
+users: $ReadOnlyArray<ClientDBUserInfo>,
+ +keyservers: $ReadOnlyArray<ClientDBKeyserverInfo>,
};
export type ClientStore = {
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
@@ -115,6 +115,7 @@
std::vector<MessageStoreThread> messageStoreThreadsVector;
std::vector<Report> reportStoreVector;
std::vector<UserInfo> userStoreVector;
+ std::vector<KeyserverInfo> keyserverStoreVector;
try {
draftsVector = DatabaseManager::getQueryExecutor().getAllDrafts();
messagesVector =
@@ -125,6 +126,8 @@
reportStoreVector =
DatabaseManager::getQueryExecutor().getAllReports();
userStoreVector = DatabaseManager::getQueryExecutor().getAllUsers();
+ keyserverStoreVector =
+ DatabaseManager::getQueryExecutor().getAllKeyservers();
} catch (std::system_error &e) {
error = e.what();
}
@@ -142,6 +145,9 @@
std::move(reportStoreVector));
auto userStoreVectorPtr = std::make_shared<std::vector<UserInfo>>(
std::move(userStoreVector));
+ auto keyserveStoreVectorPtr =
+ std::make_shared<std::vector<KeyserverInfo>>(
+ std::move(keyserverStoreVector));
this->jsInvoker_->invokeAsync([&innerRt,
draftsVectorPtr,
messagesVectorPtr,
@@ -149,13 +155,16 @@
messageStoreThreadsVectorPtr,
reportStoreVectorPtr,
userStoreVectorPtr,
+ keyserveStoreVectorPtr,
error,
promise,
draftStore = this->draftStore,
threadStore = this->threadStore,
messageStore = this->messageStore,
reportStore = this->reportStore,
- userStore = this->userStore]() {
+ userStore = this->userStore,
+ keyserverStore =
+ this->keyserverStore]() {
if (error.size()) {
promise->reject(error);
return;
@@ -173,6 +182,8 @@
reportStore.parseDBDataStore(innerRt, reportStoreVectorPtr);
jsi::Array jsiUserStore =
userStore.parseDBDataStore(innerRt, userStoreVectorPtr);
+ jsi::Array jsiKeyserverStore = keyserverStore.parseDBDataStore(
+ innerRt, keyserveStoreVectorPtr);
auto jsiClientDBStore = jsi::Object(innerRt);
jsiClientDBStore.setProperty(innerRt, "messages", jsiMessages);
@@ -182,6 +193,8 @@
innerRt, "messageStoreThreads", jsiMessageStoreThreads);
jsiClientDBStore.setProperty(innerRt, "reports", jsiReportStore);
jsiClientDBStore.setProperty(innerRt, "users", jsiUserStore);
+ jsiClientDBStore.setProperty(
+ innerRt, "keyservers", jsiKeyserverStore);
promise->resolve(std::move(jsiClientDBStore));
});
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/KeyserverStore.cpp
@@ -17,7 +17,15 @@
jsi::Array KeyserverStore::parseDBDataStore(
jsi::Runtime &rt,
std::shared_ptr<std::vector<KeyserverInfo>> keyserversVectorPtr) const {
- jsi::Array jsiKeyservers = jsi::Array(rt, 0);
+ size_t numKeyservers = keyserversVectorPtr->size();
+ jsi::Array jsiKeyservers = jsi::Array(rt, numKeyservers);
+ size_t writeIdx = 0;
+ for (const KeyserverInfo &keyserver : *keyserversVectorPtr) {
+ jsi::Object jsiKeyserver = jsi::Object(rt);
+ jsiKeyserver.setProperty(rt, "id", keyserver.id);
+ jsiKeyserver.setProperty(rt, "keyserverInfo", keyserver.keyserver_info);
+ jsiKeyservers.setValueAtIndex(rt, writeIdx++, jsiKeyserver);
+ }
return jsiKeyservers;
}
diff --git a/web/database/worker/process-operations.js b/web/database/worker/process-operations.js
--- a/web/database/worker/process-operations.js
+++ b/web/database/worker/process-operations.js
@@ -170,6 +170,7 @@
messageStoreThreads: [],
reports: sqliteQueryExecutor.getAllReports(),
users: [],
+ keyservers: [],
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 9:11 AM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2521168
Default Alt Text
D10780.id35956.diff (5 KB)
Attached To
Mode
D10780: [SQLite] implement C++ code to get keyservers
Attached
Detach File
Event Timeline
Log In to Comment