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 @@ -50,6 +50,7 @@ ClientDBSyncedMetadataEntry, ClientDBSyncedMetadataStoreOperation, } from '../ops/synced-metadata-store-ops.js'; +import type { ClientDBThreadActivityEntry } from '../ops/thread-activity-store-ops.js'; import type { ClientDBThreadStoreOperation, ThreadStoreOperation, @@ -98,6 +99,7 @@ +integrityThreadHashes: $ReadOnlyArray, +syncedMetadata: $ReadOnlyArray, +auxUserInfos: $ReadOnlyArray, + +threadActivityEntries: $ReadOnlyArray, }; 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 @@ -122,6 +122,7 @@ std::vector integrityStoreVector; std::vector syncedMetadataStoreVector; std::vector auxUserStoreVector; + std::vector threadActivityStoreVector; try { draftsVector = DatabaseManager::getQueryExecutor().getAllDrafts(); messagesVector = @@ -142,6 +143,8 @@ DatabaseManager::getQueryExecutor().getAllSyncedMetadata(); auxUserStoreVector = DatabaseManager::getQueryExecutor().getAllAuxUserInfos(); + threadActivityStoreVector = DatabaseManager::getQueryExecutor() + .getAllThreadActivityEntries(); } catch (std::system_error &e) { error = e.what(); } @@ -174,6 +177,9 @@ auto auxUserStoreVectorPtr = std::make_shared>( std::move(auxUserStoreVector)); + auto threadActivityStoreVectorPtr = + std::make_shared>( + std::move(threadActivityStoreVector)); this->jsInvoker_->invokeAsync([&innerRt, draftsVectorPtr, messagesVectorPtr, @@ -186,6 +192,7 @@ integrityStoreVectorPtr, syncedMetadataStoreVectorPtr, auxUserStoreVectorPtr, + threadActivityStoreVectorPtr, error, promise, draftStore = this->draftStore, @@ -198,7 +205,9 @@ integrityStore = this->integrityStore, syncedMetadataStore = this->syncedMetadataStore, - auxUserStore = this->auxUserStore]() { + auxUserStore = this->auxUserStore, + threadActivityStore = + this->threadActivityStore]() { if (error.size()) { promise->reject(error); return; @@ -227,6 +236,9 @@ innerRt, syncedMetadataStoreVectorPtr); jsi::Array jsiAuxUserStore = auxUserStore.parseDBDataStore(innerRt, auxUserStoreVectorPtr); + jsi::Array jsiThreadActivityStore = + threadActivityStore.parseDBDataStore( + innerRt, threadActivityStoreVectorPtr); auto jsiClientDBStore = jsi::Object(innerRt); jsiClientDBStore.setProperty(innerRt, "messages", jsiMessages); @@ -246,6 +258,8 @@ innerRt, "syncedMetadata", jsiSyncedMetadataStore); jsiClientDBStore.setProperty( innerRt, "auxUserInfos", jsiAuxUserStore); + jsiClientDBStore.setProperty( + innerRt, "threadActivityEntries", jsiThreadActivityStore); promise->resolve(std::move(jsiClientDBStore)); }); diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp --- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp +++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/ThreadActivityStore.cpp @@ -21,8 +21,22 @@ jsi::Runtime &rt, std::shared_ptr> threadActivityVectorPtr) const { - jsi::Array jsiThreadActivityEntries = jsi::Array(rt, 0); - return jsiThreadActivityEntries; + size_t numThreadActivityEntries = threadActivityVectorPtr->size(); + jsi::Array jsiThreadActivitiyEntries = + jsi::Array(rt, numThreadActivityEntries); + size_t writeIdx = 0; + for (const ThreadActivityEntry &threadActivityEntry : + *threadActivityVectorPtr) { + jsi::Object jsiThreadActivityEntry = jsi::Object(rt); + jsiThreadActivityEntry.setProperty(rt, "id", threadActivityEntry.id); + jsiThreadActivityEntry.setProperty( + rt, + "thread_activity_store_entry", + threadActivityEntry.thread_activity_store_entry); + jsiThreadActivitiyEntries.setValueAtIndex( + rt, writeIdx++, jsiThreadActivityEntry); + } + return jsiThreadActivitiyEntries; } std::vector> diff --git a/web/shared-worker/worker/process-operations.js b/web/shared-worker/worker/process-operations.js --- a/web/shared-worker/worker/process-operations.js +++ b/web/shared-worker/worker/process-operations.js @@ -500,6 +500,7 @@ integrityThreadHashes: sqliteQueryExecutor.getAllIntegrityThreadHashes(), syncedMetadata: sqliteQueryExecutor.getAllSyncedMetadata(), auxUserInfos: sqliteQueryExecutor.getAllAuxUserInfos(), + threadActivityEntries: [], }; }