Page MenuHomePhabricator

[lib] introduce resetting Outbound P2P Messages to `SQLiteAPI`
ClosedPublic

Authored by kamil on Aug 8 2024, 5:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 6:27 PM
Unknown Object (File)
Fri, Nov 22, 2:37 PM
Unknown Object (File)
Wed, Nov 20, 3:11 AM
Unknown Object (File)
Wed, Nov 20, 3:10 AM
Unknown Object (File)
Wed, Nov 20, 3:09 AM
Unknown Object (File)
Wed, Nov 20, 2:44 AM
Unknown Object (File)
Fri, Nov 8, 12:13 PM
Unknown Object (File)
Sun, Nov 3, 5:47 AM
Subscribers

Details

Summary

This diff introduces a shared interface on SQLiteAPI so the JS code in lib can use this API on both platforms.

Depends on D13030

Test Plan

Tested in D13032

Additionally, run this code:

const deviceID = 'deviceID';

await processDBStoreOperations({
  outboundP2PMessages: [
    {
      messageID: 'reset-1',
      deviceID,
      userID: 'user-1',
      timestamp: '1',
      plaintext: 'decrypted-1',
      ciphertext: 'encrypted-1',
      status: 'encrypted',
      supportsAutoRetry: true,
    },
    {
      messageID: 'reset-2',
      deviceID,
      userID: 'user-1',
      timestamp: '1',
      plaintext: 'decrypted-1',
      ciphertext: 'encrypted-1',
      status: 'sent',
      supportsAutoRetry: false,
    },
    {
      messageID: 'reset-3',
      deviceID,
      userID: 'user-1',
      timestamp: '3',
      plaintext: 'decrypted-1',
      ciphertext: 'encrypted-1',
      status: 'encrypted',
      supportsAutoRetry: false,
    },
  ],
});

const before = await sqliteAPI.getAllOutboundP2PMessages();
console.log(before.filter(msg => msg.deviceID === deviceID));
const ids =
  await sqliteAPI.resetOutboundP2PMessagesForDevice(deviceID);
console.log(ids);
const after = await sqliteAPI.getAllOutboundP2PMessages();
console.log(after.filter(msg => msg.deviceID === deviceID));

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable