Skip to content

Commit

Permalink
Fix UD indicators for sent transcripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Apr 21, 2020
1 parent 7bf090f commit a471ffa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ private long handleSynchronizeSentMediaMessage(@NonNull SentTranscriptMessage me
if (recipients.isGroup()) {
updateGroupReceiptStatus(message, messageId, recipients.requireGroupId());
} else {
database.markUnidentified(messageId, message.isUnidentified(recipients.requireServiceId()));
database.markUnidentified(messageId, isUnidentified(message, recipients));
}

database.markAsSent(messageId, true);
Expand Down Expand Up @@ -1120,7 +1120,7 @@ private long handleSynchronizeSentTextMessage(@NonNull SentTranscriptMessage mes

messageId = DatabaseFactory.getSmsDatabase(context).insertMessageOutbox(threadId, outgoingTextMessage, false, message.getTimestamp(), null);
database = DatabaseFactory.getSmsDatabase(context);
database.markUnidentified(messageId, message.isUnidentified(recipient.requireServiceId()));
database.markUnidentified(messageId, isUnidentified(message, recipient));
}

database.markAsSent(messageId, true);
Expand Down Expand Up @@ -1595,6 +1595,19 @@ private void forceStickerDownloadIfNecessary(List<DatabaseAttachment> stickerAtt
}
}

private static boolean isUnidentified(@NonNull SentTranscriptMessage message, @NonNull Recipient recipient) {
boolean unidentified = false;

if (recipient.hasE164()) {
unidentified |= message.isUnidentified(recipient.requireE164());
}
if (recipient.hasUuid()) {
unidentified |= message.isUnidentified(recipient.requireUuid());
}

return unidentified;
}

@SuppressWarnings("WeakerAccess")
private static class StorageFailedException extends Exception {
private final String sender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,17 @@ public boolean isLocalNumber() {
return Optional.fromNullable(e164).or(Optional.fromNullable(email));
}

public @NonNull UUID requireUuid() {
UUID resolved = resolving ? resolve().uuid : uuid;

if (resolved == null) {
throw new MissingAddressError();
}

return resolved;
}


public @NonNull String requireE164() {
String resolved = resolving ? resolve().e164 : e164;

Expand Down

0 comments on commit a471ffa

Please sign in to comment.