mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-26 14:27:20 +00:00
Refactor "parts" to contain MMS/PDU madness to MMS code paths.
Closes #4248 // FREEBIE
This commit is contained in:
@@ -41,16 +41,6 @@ public class PduBody {
|
||||
mPartMapByFileName = new HashMap<String, PduPart>();
|
||||
}
|
||||
|
||||
public boolean containsPushInProgress() {
|
||||
for (int i=0;i<getPartsNum();i++) {
|
||||
if (getPart(i).isInProgress()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void putPartToMaps(PduPart part) {
|
||||
// Put part to mPartMapByContentId.
|
||||
byte[] contentId = part.getContentId();
|
||||
|
||||
@@ -17,22 +17,11 @@
|
||||
|
||||
package ws.com.google.android.mms.pdu;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.PartDatabase;
|
||||
import org.thoughtcrime.securesms.mms.MediaConstraints;
|
||||
import org.thoughtcrime.securesms.util.BitmapDecodingException;
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ws.com.google.android.mms.ContentType;
|
||||
|
||||
/**
|
||||
* The pdu part.
|
||||
*/
|
||||
@@ -132,49 +121,11 @@ public class PduPart {
|
||||
|
||||
private static final String TAG = "PduPart";
|
||||
|
||||
private long rowId = -1;
|
||||
private long uniqueId = -1;
|
||||
private long mmsId = -1;
|
||||
private boolean isEncrypted;
|
||||
private int transferProgress;
|
||||
private long dataSize;
|
||||
private Bitmap thumbnail;
|
||||
|
||||
/**
|
||||
* Empty Constructor.
|
||||
*/
|
||||
public PduPart() {
|
||||
mPartHeader = new HashMap<Integer, Object>();
|
||||
setUniqueId(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void setEncrypted(boolean isEncrypted) {
|
||||
this.isEncrypted = isEncrypted;
|
||||
}
|
||||
|
||||
public boolean getEncrypted() {
|
||||
return isEncrypted;
|
||||
}
|
||||
|
||||
public void setDataSize(long dataSize) {
|
||||
this.dataSize = dataSize;
|
||||
}
|
||||
|
||||
public long getDataSize() {
|
||||
return this.dataSize;
|
||||
}
|
||||
|
||||
public boolean isInProgress() {
|
||||
return transferProgress != PartDatabase.TRANSFER_PROGRESS_DONE &&
|
||||
transferProgress != PartDatabase.TRANSFER_PROGRESS_FAILED;
|
||||
}
|
||||
|
||||
public void setTransferProgress(int transferProgress) {
|
||||
this.transferProgress = transferProgress;
|
||||
}
|
||||
|
||||
public int getTransferProgress() {
|
||||
return transferProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,46 +398,5 @@ public class PduPart {
|
||||
return new String(location);
|
||||
}
|
||||
}
|
||||
|
||||
public PartDatabase.PartId getPartId() {
|
||||
return new PartDatabase.PartId(rowId, uniqueId);
|
||||
}
|
||||
|
||||
public void setPartId(PartDatabase.PartId partId) {
|
||||
this.rowId = partId.getRowId();
|
||||
this.uniqueId = partId.getUniqueId();
|
||||
}
|
||||
|
||||
public long getRowId() {
|
||||
return rowId;
|
||||
}
|
||||
|
||||
public void setRowId(long rowId) {
|
||||
this.rowId = rowId;
|
||||
}
|
||||
|
||||
public Bitmap getThumbnail() {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
public void setThumbnail(Bitmap thumbnail) {
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
|
||||
public long getUniqueId() {
|
||||
return uniqueId;
|
||||
}
|
||||
|
||||
public void setUniqueId(long uniqueId) {
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
|
||||
public long getMmsId() {
|
||||
return mmsId;
|
||||
}
|
||||
|
||||
public void setMmsId(long mmsId) {
|
||||
this.mmsId = mmsId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ import ws.com.google.android.mms.InvalidHeaderValueException;
|
||||
|
||||
public class SendReq extends MultimediaMessagePdu {
|
||||
private static final String TAG = "SendReq";
|
||||
private long databaseMessageId;
|
||||
private long messageBox;
|
||||
private long timestamp;
|
||||
|
||||
public SendReq() {
|
||||
super();
|
||||
@@ -91,26 +88,6 @@ public class SendReq extends MultimediaMessagePdu {
|
||||
super(headers, body);
|
||||
}
|
||||
|
||||
public SendReq(PduHeaders headers, PduBody body, long messageId, long messageBox, long timestamp)
|
||||
{
|
||||
super(headers, body);
|
||||
this.databaseMessageId = messageId;
|
||||
this.messageBox = messageBox;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public long getDatabaseMessageBox() {
|
||||
return this.messageBox;
|
||||
}
|
||||
|
||||
public long getDatabaseMessageId() {
|
||||
return databaseMessageId;
|
||||
}
|
||||
|
||||
public long getSentTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Bcc value.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user