mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Convert AttachmentTable and models to kotlin.
This commit is contained in:
committed by
Alex Hart
parent
888a40a5c4
commit
3554f82ea3
@@ -58,13 +58,14 @@ class PartDataSource implements DataSource {
|
||||
|
||||
final boolean hasIncrementalDigest = attachment.getIncrementalDigest() != null;
|
||||
final boolean inProgress = attachment.isInProgress();
|
||||
final String attachmentKey = attachment.getKey();
|
||||
final boolean hasData = attachment.hasData();
|
||||
final String attachmentKey = attachment.key;
|
||||
final boolean hasData = attachment.hasData;
|
||||
|
||||
if (inProgress && !hasData && hasIncrementalDigest && attachmentKey != null && FeatureFlags.instantVideoPlayback()) {
|
||||
final byte[] decode = Base64.decode(attachmentKey);
|
||||
final File transferFile = attachmentDatabase.getOrCreateTransferFile(attachment.getAttachmentId());
|
||||
final File transferFile = attachmentDatabase.getOrCreateTransferFile(attachment.attachmentId);
|
||||
try {
|
||||
this.inputStream = AttachmentCipherInputStream.createForAttachment(transferFile, attachment.getSize(), decode, attachment.getDigest(), attachment.getIncrementalDigest(), attachment.getIncrementalMacChunkSize());
|
||||
this.inputStream = AttachmentCipherInputStream.createForAttachment(transferFile, attachment.size, decode, attachment.digest, attachment.getIncrementalDigest(), attachment.incrementalMacChunkSize);
|
||||
|
||||
long skipped = 0;
|
||||
while (skipped < dataSpec.position) {
|
||||
@@ -81,8 +82,8 @@ class PartDataSource implements DataSource {
|
||||
|
||||
Log.d(TAG, "Successfully loaded completed attachment file.");
|
||||
} else {
|
||||
throw new IOException("Ineligible " + attachment.getAttachmentId().toString()
|
||||
+ "\nTransfer state: " + attachment.getTransferState()
|
||||
throw new IOException("Ineligible " + attachment.attachmentId.toString()
|
||||
+ "\nTransfer state: " + attachment.transferState
|
||||
+ "\nIncremental Digest Present: " + hasIncrementalDigest
|
||||
+ "\nAttachment Key Non-Empty: " + (attachmentKey != null && !attachmentKey.isEmpty()));
|
||||
}
|
||||
@@ -91,9 +92,9 @@ class PartDataSource implements DataSource {
|
||||
listener.onTransferStart(this, dataSpec, false);
|
||||
}
|
||||
|
||||
if (attachment.getSize() - dataSpec.position <= 0) throw new EOFException("No more data");
|
||||
if (attachment.size - dataSpec.position <= 0) throw new EOFException("No more data");
|
||||
|
||||
return attachment.getSize() - dataSpec.position;
|
||||
return attachment.size - dataSpec.position;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user