mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Implement viewedReceipt
commitcd29144e81
Merge:14532be
f884175
Author: AsamK <asamk@gmx.de> Date: Sat Oct 30 12:46:59 2021 +0200 Merge branch 'master' into dbus_sendviewed commit14532befde
Author: John Freed <okgithub@johnfreed.com> Date: Thu Oct 7 08:24:00 2021 +0200 update deliveryReceipt to conform commita9a6edaf3f
Author: John Freed <okgithub@johnfreed.com> Date: Thu Oct 7 07:40:20 2021 +0200 implement viewedReceipt for Dbus and Json -- note that this changes the JsonReceiptMessage structure update documentation Closes #764
This commit is contained in:
parent
f884175748
commit
cb70209c60
4 changed files with 27 additions and 3 deletions
|
@ -278,6 +278,19 @@ public class DbusSignalImpl implements Signal {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendViewedReceipt(
|
||||
final String recipient, final List<Long> messageIds
|
||||
) throws Error.Failure, Error.UntrustedIdentity {
|
||||
try {
|
||||
m.sendViewedReceipt(getSingleRecipientIdentifier(recipient, m.getSelfNumber()), messageIds);
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure(e.getMessage());
|
||||
} catch (UntrustedIdentityException e) {
|
||||
throw new Error.UntrustedIdentity(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendContacts() {
|
||||
try {
|
||||
|
|
|
@ -4,17 +4,18 @@ import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage
|
|||
|
||||
import java.util.List;
|
||||
|
||||
record JsonReceiptMessage(long when, boolean isDelivery, boolean isRead, List<Long> timestamps) {
|
||||
record JsonReceiptMessage(long when, boolean isDelivery, boolean isRead, boolean isViewed, List<Long> timestamps) {
|
||||
|
||||
static JsonReceiptMessage from(SignalServiceReceiptMessage receiptMessage) {
|
||||
final var when = receiptMessage.getWhen();
|
||||
final var isDelivery = receiptMessage.isDeliveryReceipt();
|
||||
final var isRead = receiptMessage.isReadReceipt();
|
||||
final var isViewed = receiptMessage.isViewedReceipt();
|
||||
final var timestamps = receiptMessage.getTimestamps();
|
||||
return new JsonReceiptMessage(when, isDelivery, isRead, timestamps);
|
||||
return new JsonReceiptMessage(when, isDelivery, isRead, isViewed, timestamps);
|
||||
}
|
||||
|
||||
static JsonReceiptMessage deliveryReceipt(final long when, final List<Long> timestamps) {
|
||||
return new JsonReceiptMessage(when, true, false, timestamps);
|
||||
return new JsonReceiptMessage(when, true, false, false, timestamps);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue