kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix issue where forwarded link previews weren't marked uploaded.
rodzic
93d99287eb
commit
105c8c9745
|
@ -141,7 +141,7 @@ public final class MmsSendJob extends SendJob {
|
|||
final MmsSendResult result = getSendResult(sendConf, pdu);
|
||||
|
||||
database.markAsSent(messageId, false);
|
||||
markAttachmentsUploaded(messageId, message.getAttachments());
|
||||
markAttachmentsUploaded(messageId, message);
|
||||
|
||||
Log.i(TAG, "Sent message: " + messageId);
|
||||
} catch (UndeliverableMessageException | IOException e) {
|
||||
|
|
|
@ -232,7 +232,7 @@ public final class PushGroupSendJob extends PushSendJob {
|
|||
if (existingNetworkFailures.isEmpty() && networkFailures.isEmpty() && identityMismatches.isEmpty() && existingIdentityMismatches.isEmpty()) {
|
||||
database.markAsSent(messageId, true);
|
||||
|
||||
markAttachmentsUploaded(messageId, message.getAttachments());
|
||||
markAttachmentsUploaded(messageId, message);
|
||||
|
||||
if (message.getExpiresIn() > 0 && !message.isExpirationUpdate()) {
|
||||
database.markExpireStarted(messageId);
|
||||
|
|
|
@ -129,7 +129,7 @@ public class PushMediaSendJob extends PushSendJob {
|
|||
boolean unidentified = deliver(message);
|
||||
|
||||
database.markAsSent(messageId, true);
|
||||
markAttachmentsUploaded(messageId, message.getAttachments());
|
||||
markAttachmentsUploaded(messageId, message);
|
||||
database.markUnidentified(messageId, unidentified);
|
||||
|
||||
if (recipient.isSelf()) {
|
||||
|
|
|
@ -2,15 +2,23 @@ package org.thoughtcrime.securesms.jobs;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.TextSecureExpiredException;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.contactshare.Contact;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.linkpreview.LinkPreview;
|
||||
import org.thoughtcrime.securesms.mms.OutgoingMediaMessage;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class SendJob extends BaseJob {
|
||||
|
@ -37,7 +45,17 @@ public abstract class SendJob extends BaseJob {
|
|||
|
||||
protected abstract void onSend() throws Exception;
|
||||
|
||||
protected void markAttachmentsUploaded(long messageId, @NonNull List<Attachment> attachments) {
|
||||
protected void markAttachmentsUploaded(long messageId, @NonNull OutgoingMediaMessage message) {
|
||||
List<Attachment> attachments = new LinkedList<>();
|
||||
|
||||
attachments.addAll(message.getAttachments());
|
||||
attachments.addAll(Stream.of(message.getLinkPreviews()).map(lp -> lp.getThumbnail().orNull()).withoutNulls().toList());
|
||||
attachments.addAll(Stream.of(message.getSharedContacts()).map(Contact::getAvatarAttachment).withoutNulls().toList());
|
||||
|
||||
if (message.getOutgoingQuote() != null) {
|
||||
attachments.addAll(message.getOutgoingQuote().getAttachments());
|
||||
}
|
||||
|
||||
AttachmentDatabase database = DatabaseFactory.getAttachmentDatabase(context);
|
||||
|
||||
for (Attachment attachment : attachments) {
|
||||
|
|
Ładowanie…
Reference in New Issue