Update signal-service

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-03-09 15:04:16 -08:00
parent c7c411b3f3
commit cbba8c0d76
5 changed files with 11 additions and 9 deletions

View File

@@ -39,8 +39,9 @@ import javax.inject.Inject;
import ws.com.google.android.mms.MmsException;
public class AttachmentDownloadJob extends MasterSecretJob implements InjectableType {
private static final long serialVersionUID = 1L;
private static final String TAG = AttachmentDownloadJob.class.getSimpleName();
private static final long serialVersionUID = 1L;
private static final int MAX_ATTACHMENT_SIZE = 150 * 1024 * 1024;
private static final String TAG = AttachmentDownloadJob.class.getSimpleName();
@Inject transient SignalServiceMessageReceiver messageReceiver;
@@ -112,7 +113,7 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable
attachmentFile = createTempFile();
SignalServiceAttachmentPointer pointer = createAttachmentPointer(masterSecret, attachment);
InputStream stream = messageReceiver.retrieveAttachment(pointer, attachmentFile, new ProgressListener() {
InputStream stream = messageReceiver.retrieveAttachment(pointer, attachmentFile, MAX_ATTACHMENT_SIZE, new ProgressListener() {
@Override
public void onAttachmentProgress(long total, long progress) {
EventBus.getDefault().postSticky(new PartProgressEvent(attachment, total, progress));

View File

@@ -30,6 +30,7 @@ import javax.inject.Inject;
public class AvatarDownloadJob extends MasterSecretJob implements InjectableType {
private static final int MAX_AVATAR_SIZE = 20 * 1024 * 1024;
private static final long serialVersionUID = 1L;
private static final String TAG = AvatarDownloadJob.class.getSimpleName();
@@ -77,7 +78,7 @@ public class AvatarDownloadJob extends MasterSecretJob implements InjectableType
attachment.deleteOnExit();
SignalServiceAttachmentPointer pointer = new SignalServiceAttachmentPointer(avatarId, contentType, key, relay, digest);
InputStream inputStream = receiver.retrieveAttachment(pointer, attachment);
InputStream inputStream = receiver.retrieveAttachment(pointer, attachment, MAX_AVATAR_SIZE);
Bitmap avatar = BitmapUtil.createScaledBitmap(context, new AttachmentModel(attachment, key), 500, 500);
database.updateAvatar(groupId, avatar);