enable back delivery Receipt and read receipt message

pull/1259/head
Audric Ackermann 5 years ago
parent f4af41e07f
commit a17edd0ce9
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -2099,31 +2099,26 @@
window.log.info(`Sending ${read.length} read receipts`);
// Because syncReadMessages sends to our other devices, and sendReadReceipts goes
// to a contact, we need accessKeys for both.
const { sendOptions } = ConversationController.prepareForSend(
this.ourNumber,
{ syncMessage: true }
);
await textsecure.messaging.syncReadMessages(read, sendOptions);
// FIXME AUDRIC
// if (storage.get('read-receipt-setting')) {
// await Promise.all(
// _.map(_.groupBy(read, 'sender'), async (receipts, sender) => {
// const timestamps = _.map(receipts, 'timestamp');
// const receiptMessage = new libsession.Messages.Outgoing.ReadReceiptMessage(
// {
// timestamp: Date.now(),
// timestamps,
// }
// );
// const device = new libsession.Types.PubKey(sender);
// await libsession
// .getMessageQueue()
// .sendUsingMultiDevice(device, receiptMessage);
// })
// );
// }
await textsecure.messaging.syncReadMessages(read);
if (storage.get('read-receipt-setting')) {
await Promise.all(
_.map(_.groupBy(read, 'sender'), async (receipts, sender) => {
const timestamps = _.map(receipts, 'timestamp');
const receiptMessage = new libsession.Messages.Outgoing.ReadReceiptMessage(
{
timestamp: Date.now(),
timestamps,
}
);
const device = new libsession.Types.PubKey(sender);
await libsession
.getMessageQueue()
.sendUsingMultiDevice(device, receiptMessage);
})
);
}
}
},

@ -14,6 +14,8 @@ import { handleUnpairRequest } from './multidevice';
import { downloadAttachment } from './attachments';
import _ from 'lodash';
import { StringUtils } from '../session/utils';
import { DeliveryReceiptMessage } from '../session/messages/outgoing';
import { getMessageQueue } from '../session';
export async function updateProfile(
conversation: any,
@ -528,13 +530,12 @@ function createMessage(
}
function sendDeliveryReceipt(source: string, timestamp: any) {
// FIXME audric
// const receiptMessage = new DeliveryReceiptMessage({
// timestamp: Date.now(),
// timestamps: [timestamp],
// });
// const device = new PubKey(source);
// await getMessageQueue().sendUsingMultiDevice(device, receiptMessage);
const receiptMessage = new DeliveryReceiptMessage({
timestamp: Date.now(),
timestamps: [timestamp],
});
const device = new PubKey(source);
void getMessageQueue().sendUsingMultiDevice(device, receiptMessage);
}
interface MessageEvent {

Loading…
Cancel
Save