mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Add support to MessageDetailsActivity for viewed reciepts.
This commit is contained in:
@@ -24,6 +24,7 @@ final class MessageDetails {
|
||||
private final Collection<RecipientDeliveryStatus> delivered;
|
||||
private final Collection<RecipientDeliveryStatus> read;
|
||||
private final Collection<RecipientDeliveryStatus> notSent;
|
||||
private final Collection<RecipientDeliveryStatus> viewed;
|
||||
|
||||
MessageDetails(@NonNull ConversationMessage conversationMessage, @NonNull List<RecipientDeliveryStatus> recipients) {
|
||||
this.conversationMessage = conversationMessage;
|
||||
@@ -33,6 +34,7 @@ final class MessageDetails {
|
||||
delivered = new TreeSet<>(RECIPIENT_COMPARATOR);
|
||||
read = new TreeSet<>(RECIPIENT_COMPARATOR);
|
||||
notSent = new TreeSet<>(RECIPIENT_COMPARATOR);
|
||||
viewed = new TreeSet<>(RECIPIENT_COMPARATOR);
|
||||
|
||||
if (conversationMessage.getMessageRecord().isOutgoing()) {
|
||||
for (RecipientDeliveryStatus status : recipients) {
|
||||
@@ -52,6 +54,8 @@ final class MessageDetails {
|
||||
case READ:
|
||||
read.add(status);
|
||||
break;
|
||||
case VIEWED:
|
||||
viewed.add(status);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -82,4 +86,8 @@ final class MessageDetails {
|
||||
@NonNull Collection<RecipientDeliveryStatus> getNotSent() {
|
||||
return notSent;
|
||||
}
|
||||
|
||||
@NonNull Collection<RecipientDeliveryStatus> getViewed() {
|
||||
return viewed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ public final class MessageDetailsActivity extends PassphraseRequiredActivity {
|
||||
|
||||
if (details.getConversationMessage().getMessageRecord().isOutgoing()) {
|
||||
addRecipients(list, RecipientHeader.NOT_SENT, details.getNotSent());
|
||||
addRecipients(list, RecipientHeader.VIEWED, details.getViewed());
|
||||
addRecipients(list, RecipientHeader.READ, details.getRead());
|
||||
addRecipients(list, RecipientHeader.DELIVERED, details.getDelivered());
|
||||
addRecipients(list, RecipientHeader.SENT_TO, details.getSent());
|
||||
|
||||
@@ -113,10 +113,11 @@ final class MessageDetailsRepository {
|
||||
}
|
||||
|
||||
private @NonNull RecipientDeliveryStatus.Status getStatusFor(MessageRecord messageRecord) {
|
||||
if (messageRecord.isRemoteRead()) return RecipientDeliveryStatus.Status.READ;
|
||||
if (messageRecord.isDelivered()) return RecipientDeliveryStatus.Status.DELIVERED;
|
||||
if (messageRecord.isSent()) return RecipientDeliveryStatus.Status.SENT;
|
||||
if (messageRecord.isPending()) return RecipientDeliveryStatus.Status.PENDING;
|
||||
if (messageRecord.isRemoteViewed()) return RecipientDeliveryStatus.Status.VIEWED;
|
||||
if (messageRecord.isRemoteRead()) return RecipientDeliveryStatus.Status.READ;
|
||||
if (messageRecord.isDelivered()) return RecipientDeliveryStatus.Status.DELIVERED;
|
||||
if (messageRecord.isSent()) return RecipientDeliveryStatus.Status.SENT;
|
||||
if (messageRecord.isPending()) return RecipientDeliveryStatus.Status.PENDING;
|
||||
|
||||
return RecipientDeliveryStatus.Status.UNKNOWN;
|
||||
}
|
||||
@@ -128,6 +129,7 @@ final class MessageDetailsRepository {
|
||||
else if (groupStatus == GroupReceiptDatabase.STATUS_UNDELIVERED && !pending) return RecipientDeliveryStatus.Status.SENT;
|
||||
else if (groupStatus == GroupReceiptDatabase.STATUS_UNDELIVERED) return RecipientDeliveryStatus.Status.PENDING;
|
||||
else if (groupStatus == GroupReceiptDatabase.STATUS_UNKNOWN) return RecipientDeliveryStatus.Status.UNKNOWN;
|
||||
else if (groupStatus == GroupReceiptDatabase.STATUS_VIEWED) return RecipientDeliveryStatus.Status.VIEWED;
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
final class RecipientDeliveryStatus {
|
||||
|
||||
enum Status {
|
||||
UNKNOWN, PENDING, SENT, DELIVERED, READ
|
||||
UNKNOWN, PENDING, SENT, DELIVERED, READ, VIEWED
|
||||
}
|
||||
|
||||
private final MessageRecord messageRecord;
|
||||
|
||||
@@ -10,7 +10,8 @@ enum RecipientHeader {
|
||||
SENT_FROM(R.string.message_details_recipient_header__sent_from),
|
||||
DELIVERED(R.string.message_details_recipient_header__delivered_to),
|
||||
READ(R.string.message_details_recipient_header__read_by),
|
||||
NOT_SENT(R.string.message_details_recipient_header__not_sent);
|
||||
NOT_SENT(R.string.message_details_recipient_header__not_sent),
|
||||
VIEWED(R.string.message_details_recipient_header__viewed);
|
||||
|
||||
private final int headerText;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user