Improve UI send latency

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2017-04-22 16:29:26 -07:00
parent 4d889a45e2
commit cb670d6783
30 changed files with 459 additions and 94 deletions

View File

@@ -28,18 +28,22 @@ public abstract class Attachment {
@Nullable
private final byte[] digest;
@Nullable
private final String fastPreflightId;
public Attachment(@NonNull String contentType, int transferState, long size, @Nullable String fileName,
@Nullable String location, @Nullable String key, @Nullable String relay,
@Nullable byte[] digest)
@Nullable byte[] digest, @Nullable String fastPreflightId)
{
this.contentType = contentType;
this.transferState = transferState;
this.size = size;
this.fileName = fileName;
this.location = location;
this.key = key;
this.relay = relay;
this.digest = digest;
this.contentType = contentType;
this.transferState = transferState;
this.size = size;
this.fileName = fileName;
this.location = location;
this.key = key;
this.relay = relay;
this.digest = digest;
this.fastPreflightId = fastPreflightId;
}
@Nullable
@@ -90,4 +94,9 @@ public abstract class Attachment {
public byte[] getDigest() {
return digest;
}
@Nullable
public String getFastPreflightId() {
return fastPreflightId;
}
}

View File

@@ -16,9 +16,9 @@ public class DatabaseAttachment extends Attachment {
boolean hasData, boolean hasThumbnail,
String contentType, int transferProgress, long size,
String fileName, String location, String key, String relay,
byte[] digest)
byte[] digest, String fastPreflightId)
{
super(contentType, transferProgress, size, fileName, location, key, relay, digest);
super(contentType, transferProgress, size, fileName, location, key, relay, digest, fastPreflightId);
this.attachmentId = attachmentId;
this.hasData = hasData;
this.hasThumbnail = hasThumbnail;

View File

@@ -10,7 +10,7 @@ import org.thoughtcrime.securesms.database.MmsDatabase;
public class MmsNotificationAttachment extends Attachment {
public MmsNotificationAttachment(int status, long size) {
super("application/mms", getTransferStateFromStatus(status), size, null, null, null, null, null);
super("application/mms", getTransferStateFromStatus(status), size, null, null, null, null, null, null);
}
@Nullable

View File

@@ -20,7 +20,7 @@ public class PointerAttachment extends Attachment {
@NonNull String key, @NonNull String relay,
@Nullable byte[] digest)
{
super(contentType, transferState, size, fileName, location, key, relay, digest);
super(contentType, transferState, size, fileName, location, key, relay, digest, null);
}
@Nullable

View File

@@ -12,14 +12,14 @@ public class UriAttachment extends Attachment {
public UriAttachment(@NonNull Uri uri, @NonNull String contentType, int transferState, long size,
@Nullable String fileName)
{
this(uri, uri, contentType, transferState, size, fileName);
this(uri, uri, contentType, transferState, size, fileName, null);
}
public UriAttachment(@NonNull Uri dataUri, @Nullable Uri thumbnailUri,
@NonNull String contentType, int transferState, long size,
@Nullable String fileName)
@Nullable String fileName, @Nullable String fastPreflightId)
{
super(contentType, transferState, size, fileName, null, null, null, null);
super(contentType, transferState, size, fileName, null, null, null, null, fastPreflightId);
this.dataUri = dataUri;
this.thumbnailUri = thumbnailUri;
}