Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3184439
D13900.id45724.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13900.id45724.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 10:49 AM (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2451239
Default Alt Text
D13900.id45724.diff (2 KB)
Attached To
Mode
D13900: [lib] Implement getInboundP2PMessagesByID in SQLiteAPI
Attached
Detach File
Event Timeline
Log In to Comment