Remove all legacy uploads to cdn0.

This commit is contained in:
Greyson Parrelli
2024-07-17 10:31:10 -04:00
parent 29ead80e17
commit c622b7fdb1
7 changed files with 17 additions and 75 deletions

View File

@@ -307,7 +307,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob {
}
}
private Optional<SignalServiceAttachmentStream> getSystemAvatar(@Nullable Uri uri) {
private Optional<SignalServiceAttachmentStream> getSystemAvatar(@Nullable Uri uri) throws IOException {
if (uri == null) {
return Optional.empty();
}
@@ -329,6 +329,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob {
.withStream(fd.createInputStream())
.withContentType("image/*")
.withLength(fd.getLength())
.withResumableUploadSpec(AppDependencies.getSignalServiceMessageSender().getResumableUploadSpec())
.build());
} catch (IOException e) {
// Ignored
@@ -355,6 +356,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob {
.withStream(new ByteArrayInputStream(data))
.withContentType("image/*")
.withLength(data.length)
.withResumableUploadSpec(AppDependencies.getSignalServiceMessageSender().getResumableUploadSpec())
.build());
}
}

View File

@@ -93,6 +93,7 @@ public class MultiDeviceProfileKeyUpdateJob extends BaseJob {
.withStream(new ByteArrayInputStream(baos.toByteArray()))
.withContentType("application/octet-stream")
.withLength(baos.toByteArray().length)
.withResumableUploadSpec(messageSender.getResumableUploadSpec())
.build();
SignalServiceSyncMessage syncMessage = SignalServiceSyncMessage.forContacts(new ContactsMessage(attachmentStream, false));

View File

@@ -197,7 +197,9 @@ public abstract class PushSendJob extends SendJob {
return Optional.of(ProfileKeyUtil.getSelfProfileKey().serialize());
}
protected SignalServiceAttachment getAttachmentFor(Attachment attachment) {
protected SignalServiceAttachment getAttachmentFor(Contact.Avatar avatar) {
Attachment attachment = avatar.getAttachment();
try {
if (attachment.getUri() == null || attachment.size == 0) throw new IOException("Assertion failed, outgoing attachment has no data!");
InputStream is = PartAuthority.getAttachmentStream(context, attachment.getUri());
@@ -214,6 +216,7 @@ public abstract class PushSendJob extends SendJob {
.withHeight(attachment.height)
.withCaption(attachment.caption)
.withUuid(attachment.uuid)
.withResumableUploadSpec(AppDependencies.getSignalServiceMessageSender().getResumableUploadSpec())
.withListener(new SignalServiceAttachment.ProgressListener() {
@Override
public void onAttachmentProgress(long total, long progress) {
@@ -454,7 +457,7 @@ public abstract class PushSendJob extends SendJob {
if (contact.getAvatar() != null && contact.getAvatar().getAttachment() != null) {
SignalServiceAttachment attachment = getAttachmentPointerFor(contact.getAvatar().getAttachment());
if (attachment == null) {
attachment = getAttachmentFor(contact.getAvatar().getAttachment());
attachment = getAttachmentFor(contact.getAvatar());
}
avatar = SharedContact.Avatar.newBuilder().withAttachment(attachment)
.withProfileFlag(contact.getAvatar().isProfile())