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>, + +getInboundP2PMessagesByID: ( + ids: $ReadOnlyArray, + ) => Promise>, +getAllOutboundP2PMessages: () => Promise>, +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, + ): Promise> { + const sharedWorker = await getCommSharedWorker(); + + const data = await sharedWorker.schedule({ + type: workerRequestMessageTypes.GET_INBOUND_P2P_MESSAGES_BY_ID, + messageIDs: ids, + }); + const messages: ?$ReadOnlyArray = + data?.inboundP2PMessages; + return messages ? [...messages] : []; + }, + async getAllOutboundP2PMessages(): Promise { const sharedWorker = await getCommSharedWorker();