Page MenuHomePhabricator

D13900.diff
No OneTemporary

D13900.diff

diff --git a/lib/types/sqlite-types.js b/lib/types/sqlite-types.js
--- a/lib/types/sqlite-types.js
+++ b/lib/types/sqlite-types.js
@@ -42,6 +42,9 @@
export type SQLiteAPI = {
// read operations
+getAllInboundP2PMessages: () => Promise<Array<InboundP2PMessage>>,
+ +getInboundP2PMessagesByID: (
+ ids: $ReadOnlyArray<string>,
+ ) => Promise<Array<InboundP2PMessage>>,
+getAllOutboundP2PMessages: () => Promise<Array<OutboundP2PMessage>>,
+getRelatedMessages: (
messageID: string,
diff --git a/lib/utils/__mocks__/config.js b/lib/utils/__mocks__/config.js
--- a/lib/utils/__mocks__/config.js
+++ b/lib/utils/__mocks__/config.js
@@ -35,6 +35,7 @@
},
sqliteAPI: {
getAllInboundP2PMessages: jest.fn(),
+ getInboundP2PMessagesByID: jest.fn(),
removeInboundP2PMessages: jest.fn(),
processDBStoreOperations: jest.fn(),
getAllOutboundP2PMessages: jest.fn(),
diff --git a/native/database/sqlite-api.js b/native/database/sqlite-api.js
--- a/native/database/sqlite-api.js
+++ b/native/database/sqlite-api.js
@@ -12,6 +12,7 @@
const sqliteAPI: SQLiteAPI = {
// read operations
getAllInboundP2PMessages: commCoreModule.getAllInboundP2PMessages,
+ getInboundP2PMessagesByID: commCoreModule.getInboundP2PMessagesByID,
getAllOutboundP2PMessages: commCoreModule.getAllOutboundP2PMessages,
getRelatedMessages: commCoreModule.getRelatedMessages,
getOutboundP2PMessagesByID: commCoreModule.getOutboundP2PMessagesByID,
diff --git a/web/database/sqlite-api.js b/web/database/sqlite-api.js
--- a/web/database/sqlite-api.js
+++ b/web/database/sqlite-api.js
@@ -26,6 +26,20 @@
return messages ? [...messages] : [];
},
+ async getInboundP2PMessagesByID(
+ ids: $ReadOnlyArray<string>,
+ ): Promise<Array<InboundP2PMessage>> {
+ const sharedWorker = await getCommSharedWorker();
+
+ const data = await sharedWorker.schedule({
+ type: workerRequestMessageTypes.GET_INBOUND_P2P_MESSAGES_BY_ID,
+ messageIDs: ids,
+ });
+ const messages: ?$ReadOnlyArray<InboundP2PMessage> =
+ data?.inboundP2PMessages;
+ return messages ? [...messages] : [];
+ },
+
async getAllOutboundP2PMessages(): Promise<OutboundP2PMessage[]> {
const sharedWorker = await getCommSharedWorker();

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 4:33 AM (18 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2495320
Default Alt Text
D13900.diff (2 KB)

Event Timeline