mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
@@ -176,6 +176,5 @@ public abstract class SignalServiceAttachment {
|
||||
* @param progress The amount that has been transmitted/received in bytes thus far
|
||||
*/
|
||||
public void onAttachmentProgress(long total, long progress);
|
||||
boolean shouldCancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1445,7 +1445,7 @@ public class PushServiceSocket {
|
||||
}
|
||||
}
|
||||
|
||||
private void downloadFromCdn(File destination, int cdnNumber, String path, long maxSizeBytes, ProgressListener listener)
|
||||
private void downloadFromCdn(File destination, int cdnNumber, String path, long maxSizeBytes, ProgressListener listener)
|
||||
throws IOException, MissingConfigurationException
|
||||
{
|
||||
try (FileOutputStream outputStream = new FileOutputStream(destination, true)) {
|
||||
@@ -1502,9 +1502,6 @@ public class PushServiceSocket {
|
||||
|
||||
if (listener != null) {
|
||||
listener.onAttachmentProgress(body.contentLength() + offset, totalRead);
|
||||
if (listener.shouldCancel()) {
|
||||
call.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (response.code() == 416) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.whispersystems.signalservice.internal.push.http;
|
||||
import org.junit.Test;
|
||||
import org.whispersystems.signalservice.api.crypto.AttachmentCipherOutputStream;
|
||||
import org.whispersystems.signalservice.api.crypto.AttachmentCipherStreamUtil;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.internal.util.Util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -71,15 +70,6 @@ public class DigestingRequestBodyTest {
|
||||
}
|
||||
|
||||
private DigestingRequestBody getBody(long contentStart) {
|
||||
return new DigestingRequestBody(new ByteArrayInputStream(input), outputStreamFactory, "application/octet", CONTENT_LENGTH, new SignalServiceAttachment.ProgressListener() {
|
||||
@Override
|
||||
public void onAttachmentProgress(long total, long progress) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override public boolean shouldCancel() {
|
||||
return false;
|
||||
}
|
||||
}, () -> false, contentStart);
|
||||
return new DigestingRequestBody(new ByteArrayInputStream(input), outputStreamFactory, "application/octet", CONTENT_LENGTH, (a, b) -> {}, () -> false, contentStart);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user