Page MenuHomePhabricator

D11307.id38005.diff
No OneTemporary

D11307.id38005.diff

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
@@ -19,6 +19,7 @@
ClientDBCommunityStoreOperation,
CommunityStoreOperation,
} from '../ops/community-store-ops.js';
+import type { ClientDBIntegrityThreadHash } from '../ops/integrity-store-ops.js';
import type {
ClientDBKeyserverInfo,
ClientDBKeyserverStoreOperation,
@@ -70,6 +71,7 @@
+users: $ReadOnlyArray<ClientDBUserInfo>,
+keyservers: $ReadOnlyArray<ClientDBKeyserverInfo>,
+communities: $ReadOnlyArray<ClientDBCommunityInfo>,
+ +integrityThreadHashes: $ReadOnlyArray<ClientDBIntegrityThreadHash>,
};
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
@@ -119,6 +119,7 @@
std::vector<UserInfo> userStoreVector;
std::vector<KeyserverInfo> keyserverStoreVector;
std::vector<CommunityInfo> communityStoreVector;
+ std::vector<IntegrityThreadHash> integrityStoreVector;
try {
draftsVector = DatabaseManager::getQueryExecutor().getAllDrafts();
messagesVector =
@@ -133,6 +134,8 @@
DatabaseManager::getQueryExecutor().getAllKeyservers();
communityStoreVector =
DatabaseManager::getQueryExecutor().getAllCommunities();
+ integrityStoreVector = DatabaseManager::getQueryExecutor()
+ .getAllIntegrityThreadHashes();
} catch (std::system_error &e) {
error = e.what();
}
@@ -156,6 +159,9 @@
auto communityStoreVectorPtr =
std::make_shared<std::vector<CommunityInfo>>(
std::move(communityStoreVector));
+ auto integrityStoreVectorPtr =
+ std::make_shared<std::vector<IntegrityThreadHash>>(
+ std::move(integrityStoreVector));
this->jsInvoker_->invokeAsync([&innerRt,
draftsVectorPtr,
messagesVectorPtr,
@@ -165,6 +171,7 @@
userStoreVectorPtr,
keyserveStoreVectorPtr,
communityStoreVectorPtr,
+ integrityStoreVectorPtr,
error,
promise,
draftStore = this->draftStore,
@@ -173,8 +180,9 @@
reportStore = this->reportStore,
userStore = this->userStore,
keyserverStore = this->keyserverStore,
- communityStore =
- this->communityStore]() {
+ communityStore = this->communityStore,
+ integrityStore =
+ this->integrityStore]() {
if (error.size()) {
promise->reject(error);
return;
@@ -196,6 +204,8 @@
innerRt, keyserveStoreVectorPtr);
jsi::Array jsiCommunityStore = communityStore.parseDBDataStore(
innerRt, communityStoreVectorPtr);
+ jsi::Array jsiIntegrityStore = integrityStore.parseDBDataStore(
+ innerRt, integrityStoreVectorPtr);
auto jsiClientDBStore = jsi::Object(innerRt);
jsiClientDBStore.setProperty(innerRt, "messages", jsiMessages);
@@ -209,6 +219,8 @@
innerRt, "keyservers", jsiKeyserverStore);
jsiClientDBStore.setProperty(
innerRt, "communities", jsiCommunityStore);
+ jsiClientDBStore.setProperty(
+ innerRt, "integrityThreadHashes", jsiIntegrityStore);
promise->resolve(std::move(jsiClientDBStore));
});
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
@@ -22,7 +22,19 @@
jsi::Runtime &rt,
std::shared_ptr<std::vector<IntegrityThreadHash>>
integrityThreadHashesVectorPtr) const {
- jsi::Array jsiIntegrityThreadHashes = jsi::Array(rt, 0);
+ size_t numIntegrityThreadHashes = integrityThreadHashesVectorPtr->size();
+ jsi::Array jsiIntegrityThreadHashes =
+ jsi::Array(rt, numIntegrityThreadHashes);
+ size_t writeIdx = 0;
+ for (const IntegrityThreadHash &integrityThreadHash :
+ *integrityThreadHashesVectorPtr) {
+ jsi::Object jsiIntegrityThreadHash = jsi::Object(rt);
+ jsiIntegrityThreadHash.setProperty(rt, "id", integrityThreadHash.id);
+ jsiIntegrityThreadHash.setProperty(
+ rt, "threadHash", integrityThreadHash.thread_hash);
+ jsiIntegrityThreadHashes.setValueAtIndex(
+ rt, writeIdx++, jsiIntegrityThreadHash);
+ }
return jsiIntegrityThreadHashes;
}
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
@@ -258,6 +258,7 @@
users: [],
keyservers: sqliteQueryExecutor.getAllKeyservers(),
communities: sqliteQueryExecutor.getAllCommunities(),
+ integrityThreadHashes: [],
};
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 9, 4:15 AM (5 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2827071
Default Alt Text
D11307.id38005.diff (5 KB)

Event Timeline