Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3512928
D12253.id40796.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D12253.id40796.diff
View Options
diff --git a/lib/reducers/message-reducer.test.js b/lib/reducers/message-reducer.test.js
--- a/lib/reducers/message-reducer.test.js
+++ b/lib/reducers/message-reducer.test.js
@@ -298,6 +298,7 @@
auxUserInfos: {},
threadActivityStore: {},
entries: {},
+ messageStoreLocalMessageInfos: {},
},
},
{
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
@@ -11,8 +11,10 @@
import type { ThreadHashes } from './integrity-types.js';
import type { KeyserverInfos } from './keyserver-types.js';
import type {
+ MessageStoreLocalMessageInfos,
ClientDBMessageInfo,
ClientDBThreadMessageInfo,
+ ClientDBLocalMessageInfo,
} from './message-types.js';
import type { ClientReportCreationRequest } from './report-types.js';
import type { OutboundP2PMessage } from './sqlite-types.js';
@@ -119,6 +121,7 @@
+auxUserInfos: $ReadOnlyArray<ClientDBAuxUserInfo>,
+threadActivityEntries: $ReadOnlyArray<ClientDBThreadActivityEntry>,
+entries: $ReadOnlyArray<ClientDBEntryInfo>,
+ +messageStoreLocalMessageInfos: $ReadOnlyArray<ClientDBLocalMessageInfo>,
};
export type ClientStore = {
@@ -136,4 +139,5 @@
+auxUserInfos: ?AuxUserInfos,
+threadActivityStore: ?ThreadActivityStore,
+entries: ?RawEntryInfos,
+ +messageStoreLocalMessageInfos: ?MessageStoreLocalMessageInfos,
};
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
@@ -125,6 +125,7 @@
std::vector<AuxUserInfo> auxUserStoreVector;
std::vector<ThreadActivityEntry> threadActivityStoreVector;
std::vector<EntryInfo> entryStoreVector;
+ std::vector<LocalMessageInfo> messageStoreLocalMessageInfosVector;
try {
draftsVector = DatabaseManager::getQueryExecutor().getAllDrafts();
messagesVector =
@@ -149,6 +150,9 @@
.getAllThreadActivityEntries();
entryStoreVector =
DatabaseManager::getQueryExecutor().getAllEntries();
+ messageStoreLocalMessageInfosVector =
+ DatabaseManager::getQueryExecutor()
+ .getAllMessageStoreLocalMessageInfos();
} catch (std::system_error &e) {
error = e.what();
}
@@ -186,6 +190,9 @@
std::move(threadActivityStoreVector));
auto entryStoreVectorPtr = std::make_shared<std::vector<EntryInfo>>(
std::move(entryStoreVector));
+ auto messageStoreLocalMessageInfosVectorPtr =
+ std::make_shared<std::vector<LocalMessageInfo>>(
+ std::move(messageStoreLocalMessageInfosVector));
this->jsInvoker_->invokeAsync([&innerRt,
draftsVectorPtr,
messagesVectorPtr,
@@ -200,6 +207,7 @@
auxUserStoreVectorPtr,
threadActivityStoreVectorPtr,
entryStoreVectorPtr,
+ messageStoreLocalMessageInfosVectorPtr,
error,
promise,
draftStore = this->draftStore,
@@ -249,6 +257,9 @@
innerRt, threadActivityStoreVectorPtr);
jsi::Array jsiEntryStore =
entryStore.parseDBDataStore(innerRt, entryStoreVectorPtr);
+ jsi::Array jsiMessageStoreLocalMessageInfos =
+ messageStore.parseDBMessageStoreLocalMessageInfos(
+ innerRt, messageStoreLocalMessageInfosVectorPtr);
auto jsiClientDBStore = jsi::Object(innerRt);
jsiClientDBStore.setProperty(innerRt, "messages", jsiMessages);
@@ -271,6 +282,10 @@
jsiClientDBStore.setProperty(
innerRt, "threadActivityEntries", jsiThreadActivityStore);
jsiClientDBStore.setProperty(innerRt, "entries", jsiEntryStore);
+ jsiClientDBStore.setProperty(
+ innerRt,
+ "messageStoreLocalMessageInfos",
+ jsiMessageStoreLocalMessageInfos);
promise->resolve(std::move(jsiClientDBStore));
});
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/MessageStore.cpp
@@ -162,4 +162,23 @@
return jsiThreads;
}
+jsi::Array MessageStore::parseDBMessageStoreLocalMessageInfos(
+ jsi::Runtime &rt,
+ std::shared_ptr<std::vector<LocalMessageInfo>> localMessageInfosVectorPtr)
+ const {
+ size_t numLocalMessageInfos = localMessageInfosVectorPtr->size();
+ jsi::Array jsiLocalMessageInfos = jsi::Array(rt, numLocalMessageInfos);
+ size_t writeIdx = 0;
+
+ for (const LocalMessageInfo &localMessageInfo : *localMessageInfosVectorPtr) {
+ jsi::Object jsiLocalMessageInfo = jsi::Object(rt);
+ jsiLocalMessageInfo.setProperty(rt, "id", localMessageInfo.id);
+ jsiLocalMessageInfo.setProperty(
+ rt, "localMessageInfo", localMessageInfo.local_message_info);
+
+ jsiLocalMessageInfos.setValueAtIndex(rt, writeIdx++, jsiLocalMessageInfo);
+ }
+ return jsiLocalMessageInfos;
+}
+
} // namespace comm
diff --git a/web/shared-worker/utils/store.js b/web/shared-worker/utils/store.js
--- a/web/shared-worker/utils/store.js
+++ b/web/shared-worker/utils/store.js
@@ -39,6 +39,7 @@
auxUserInfos: null,
threadActivityStore: null,
entries: null,
+ messageStoreLocalMessageInfos: null,
};
const data = await sharedWorker.schedule({
type: workerRequestMessageTypes.GET_CLIENT_STORE,
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
@@ -592,6 +592,8 @@
auxUserInfos: sqliteQueryExecutor.getAllAuxUserInfos(),
threadActivityEntries: sqliteQueryExecutor.getAllThreadActivityEntries(),
entries: sqliteQueryExecutor.getAllEntries(),
+ messageStoreLocalMessageInfos:
+ sqliteQueryExecutor.getAllMessageStoreLocalMessageInfos(),
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 9:02 PM (18 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692651
Default Alt Text
D12253.id40796.diff (6 KB)
Attached To
Mode
D12253: [sqlite] implement logic to get message store logic from SQLite
Attached
Detach File
Event Timeline
Log In to Comment