Using OutboundP2PMessage's from /lib.
Depends on D12079
Differential D12080
[lib] implement Outbound P2P Messages API in `SQLiteAPI` kamil on May 16 2024, 10:18 AM. Authored by Tags None Referenced Files
Subscribers
Details Using OutboundP2PMessage's from /lib. Depends on D12079 Added some messages from C++ code: OutboundP2PMessage msg1 = { "message_001", "device_01", "user_01", "1609459200", "Hello, world!", "SGVsbG8sIHdvcmxkIQ==", "encrypted" }; OutboundP2PMessage msg2 = { "message_002", "device_01", "user_02", "1609459201", "Goodbye, world!", "R29vZGJ5ZSwgd29ybGQh", "encrypted"}; OutboundP2PMessage msg3 = { "message_003", "device_03", "user_03", "1609459202", "Hello again, world!", "SGVsbG8gYWdhaW4sIHdvcmxkIQ==", "encrypted"}; const std::vector<OutboundP2PMessage> messages = {msg1, msg2, msg3}; static std::string addMessage = "REPLACE INTO outbound_p2p_messages (" " message_id, device_id, user_id, timestamp, plaintext, ciphertext, " "status" ") " "VALUES (?, ?, ?, ?, ?, ?, ?);"; for (const OutboundP2PMessage &clientMessage : messages) { SQLiteOutboundP2PMessage message = clientMessage.toSQLiteOutboundP2PMessage(); replaceEntity<SQLiteOutboundP2PMessage>( SQLiteQueryExecutor::getConnection(), addMessage, message); } Execute this code from /lib: const m1 = await sqliteAPI.getAllOutboundP2PMessage(); console.log(m1); const msg: OutboundP2PMessage = m1[1]; await sqliteAPI.markOutboundP2PMessageAsSent(msg.messageID, msg.deviceID); const m2 = await sqliteAPI.getAllOutboundP2PMessage(); console.log(m2); await sqliteAPI.removeOutboundP2PMessagesOlderThan( msg.messageID, msg.deviceID, ); const m3 = await sqliteAPI.getAllOutboundP2PMessage(); console.log(m3); And verify results on both web and native
Diff Detail
|