recordDeliveries method
Records that a list of messages were successfully delivered to a peer.
Call this after a successful sync cycle. On the next sync with the same peer, these messages will be excluded from getMessagesForSync.
Implementation
Future<void> recordDeliveries({
required List<String> messageIds,
required String peerNodeId,
}) async {
final now = DateTime.now().millisecondsSinceEpoch;
for (final msgId in messageIds) {
await into(messageDeliveries).insertOnConflictUpdate(
MessageDeliveriesCompanion.insert(
messageId: msgId,
peerNodeId: peerNodeId,
deliveredAt: now,
),
);
}
}