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 @@ -1,5 +1,6 @@ // @flow +import type { ClientDBMessageInfo } from './message-types.js'; import type { StoreOperations } from './store-ops-types.js'; export const outboundP2PMessageStatuses = Object.freeze({ @@ -40,6 +41,7 @@ // read operations +getAllInboundP2PMessage: () => Promise, +getAllOutboundP2PMessage: () => Promise, + +getLatestMessageEdit: (messageID: string) => Promise, // write operations +removeInboundP2PMessages: (ids: $ReadOnlyArray) => Promise, 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 @@ getAllOutboundP2PMessage: jest.fn(), markOutboundP2PMessageAsSent: jest.fn(), removeOutboundP2PMessagesOlderThan: jest.fn(), + getLatestMessageEdit: 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 @@ -9,6 +9,7 @@ // read operations getAllInboundP2PMessage: commCoreModule.getAllInboundP2PMessage, getAllOutboundP2PMessage: commCoreModule.getAllOutboundP2PMessage, + getLatestMessageEdit: commCoreModule.getLatestMessageEdit, // write operations removeInboundP2PMessages: commCoreModule.removeInboundP2PMessages, 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 @@ -1,5 +1,6 @@ // @flow +import type { ClientDBMessageInfo } from 'lib/types/message-types.js'; import type { SQLiteAPI, InboundP2PMessage, @@ -34,6 +35,16 @@ return messages ? [...messages] : []; }, + async getLatestMessageEdit(messageID: string): Promise { + const sharedWorker = await getCommSharedWorker(); + + const data = await sharedWorker.schedule({ + type: workerRequestMessageTypes.GET_LATEST_MESSAGE_EDIT, + messageID, + }); + return data?.message; + }, + // write operations async removeInboundP2PMessages(ids: $ReadOnlyArray): Promise { const sharedWorker = await getCommSharedWorker();