Dedupe network and identity failures.

This commit is contained in:
Greyson Parrelli
2021-10-01 14:21:41 -04:00
committed by Cody Henthorne
parent e01381379c
commit a385cb0b68
19 changed files with 133 additions and 130 deletions

View File

@@ -13,8 +13,10 @@ import org.thoughtcrime.securesms.database.model.Mention;
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
import org.thoughtcrime.securesms.recipients.Recipient;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
public class OutgoingMediaMessage {
@@ -28,11 +30,11 @@ public class OutgoingMediaMessage {
private final boolean viewOnce;
private final QuoteModel outgoingQuote;
private final List<NetworkFailure> networkFailures = new LinkedList<>();
private final List<IdentityKeyMismatch> identityKeyMismatches = new LinkedList<>();
private final List<Contact> contacts = new LinkedList<>();
private final List<LinkPreview> linkPreviews = new LinkedList<>();
private final List<Mention> mentions = new LinkedList<>();
private final Set<NetworkFailure> networkFailures = new HashSet<>();
private final Set<IdentityKeyMismatch> identityKeyMismatches = new HashSet<>();
private final List<Contact> contacts = new LinkedList<>();
private final List<LinkPreview> linkPreviews = new LinkedList<>();
private final List<Mention> mentions = new LinkedList<>();
public OutgoingMediaMessage(Recipient recipient, String message,
List<Attachment> attachments, long sentTimeMillis,
@@ -42,8 +44,8 @@ public class OutgoingMediaMessage {
@NonNull List<Contact> contacts,
@NonNull List<LinkPreview> linkPreviews,
@NonNull List<Mention> mentions,
@NonNull List<NetworkFailure> networkFailures,
@NonNull List<IdentityKeyMismatch> identityKeyMismatches)
@NonNull Set<NetworkFailure> networkFailures,
@NonNull Set<IdentityKeyMismatch> identityKeyMismatches)
{
this.recipient = recipient;
this.body = message;
@@ -75,7 +77,7 @@ public class OutgoingMediaMessage {
slideDeck.asAttachments(),
sentTimeMillis, subscriptionId,
expiresIn, viewOnce, distributionType, outgoingQuote,
contacts, linkPreviews, mentions, new LinkedList<>(), new LinkedList<>());
contacts, linkPreviews, mentions, new HashSet<>(), new HashSet<>());
}
public OutgoingMediaMessage(OutgoingMediaMessage that) {
@@ -175,11 +177,11 @@ public class OutgoingMediaMessage {
return mentions;
}
public @NonNull List<NetworkFailure> getNetworkFailures() {
public @NonNull Set<NetworkFailure> getNetworkFailures() {
return networkFailures;
}
public @NonNull List<IdentityKeyMismatch> getIdentityKeyMismatches() {
public @NonNull Set<IdentityKeyMismatch> getIdentityKeyMismatches() {
return identityKeyMismatches;
}

View File

@@ -25,7 +25,7 @@ public class OutgoingSecureMediaMessage extends OutgoingMediaMessage {
@NonNull List<LinkPreview> previews,
@NonNull List<Mention> mentions)
{
super(recipient, body, attachments, sentTimeMillis, -1, expiresIn, viewOnce, distributionType, quote, contacts, previews, mentions, Collections.emptyList(), Collections.emptyList());
super(recipient, body, attachments, sentTimeMillis, -1, expiresIn, viewOnce, distributionType, quote, contacts, previews, mentions, Collections.emptySet(), Collections.emptySet());
}
public OutgoingSecureMediaMessage(OutgoingMediaMessage base) {