mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +00:00
Attachment fixes
This commit is contained in:
parent
27bce77069
commit
a3f9cd75ea
4 changed files with 14 additions and 5 deletions
|
@ -1702,12 +1702,14 @@ class Core {
|
|||
}
|
||||
|
||||
for (EntityAttachment attachment : attachments)
|
||||
if (!attachment.available)
|
||||
if (state.getNetworkState().isUnmetered() || (attachment.size != null && attachment.size < maxSize))
|
||||
if (!attachment.available && TextUtils.isEmpty(attachment.error))
|
||||
if (state.getNetworkState().isUnmetered() ||
|
||||
(attachment.size != null && attachment.size < maxSize))
|
||||
try {
|
||||
parts.downloadAttachment(context, attachment);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
db.attachment().setError(attachment.id, Helper.formatThrowable(ex, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1419,6 +1419,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
attachment.name = (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())
|
||||
? "encrypted.asc" : "signature.asc");
|
||||
attachment.type = "application/octet-stream";
|
||||
attachment.disposition = Part.INLINE;
|
||||
attachment.encryption = (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(data.getAction())
|
||||
? EntityAttachment.PGP_MESSAGE : EntityAttachment.PGP_SIGNATURE);
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
|
@ -1779,8 +1780,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
attachment.type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
|
||||
if (attachment.type == null)
|
||||
attachment.type = "application/octet-stream";
|
||||
if (image)
|
||||
attachment.disposition = Part.INLINE;
|
||||
attachment.disposition = (image ? Part.INLINE : Part.ATTACHMENT);
|
||||
|
||||
attachment.size = (s == null ? null : Long.parseLong(s));
|
||||
attachment.progress = 0;
|
||||
|
@ -2131,6 +2131,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
attachment.sequence = 1;
|
||||
attachment.name = ics.getName();
|
||||
attachment.type = "text/calendar";
|
||||
attachment.disposition = Part.ATTACHMENT;
|
||||
attachment.size = ics.length();
|
||||
attachment.progress = null;
|
||||
attachment.available = true;
|
||||
|
|
|
@ -60,6 +60,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import javax.mail.Address;
|
||||
import javax.mail.Part;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
public class Log {
|
||||
|
@ -293,6 +294,7 @@ public class Log {
|
|||
attachment.sequence = sequence;
|
||||
attachment.name = "settings.txt";
|
||||
attachment.type = "text/plain";
|
||||
attachment.disposition = Part.ATTACHMENT;
|
||||
attachment.size = null;
|
||||
attachment.progress = 0;
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
|
@ -319,6 +321,7 @@ public class Log {
|
|||
attachment.sequence = sequence;
|
||||
attachment.name = "accounts.txt";
|
||||
attachment.type = "text/plain";
|
||||
attachment.disposition = Part.ATTACHMENT;
|
||||
attachment.size = null;
|
||||
attachment.progress = 0;
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
|
@ -364,6 +367,7 @@ public class Log {
|
|||
attachment.sequence = sequence;
|
||||
attachment.name = "network.txt";
|
||||
attachment.type = "text/plain";
|
||||
attachment.disposition = Part.ATTACHMENT;
|
||||
attachment.size = null;
|
||||
attachment.progress = 0;
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
|
@ -395,6 +399,7 @@ public class Log {
|
|||
attachment.sequence = sequence;
|
||||
attachment.name = "log.txt";
|
||||
attachment.type = "text/plain";
|
||||
attachment.disposition = Part.ATTACHMENT;
|
||||
attachment.size = null;
|
||||
attachment.progress = 0;
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
|
@ -421,6 +426,7 @@ public class Log {
|
|||
attachment.sequence = sequence;
|
||||
attachment.name = "operations.txt";
|
||||
attachment.type = "text/plain";
|
||||
attachment.disposition = Part.ATTACHMENT;
|
||||
attachment.size = null;
|
||||
attachment.progress = 0;
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
|
@ -451,6 +457,7 @@ public class Log {
|
|||
attachment.sequence = sequence;
|
||||
attachment.name = "logcat.txt";
|
||||
attachment.type = "text/plain";
|
||||
attachment.disposition = Part.ATTACHMENT;
|
||||
attachment.size = null;
|
||||
attachment.progress = 0;
|
||||
attachment.id = db.attachment().insertAttachment(attachment);
|
||||
|
|
|
@ -864,7 +864,6 @@ public class MessageHelper {
|
|||
for (int i = 0; i < remotes.size(); i++) {
|
||||
EntityAttachment remote = remotes.get(i);
|
||||
if (Objects.equals(remote.name, local.name) &&
|
||||
Objects.equals(remote.disposition, local.disposition) &&
|
||||
Objects.equals(remote.cid, local.cid)) {
|
||||
found = true;
|
||||
downloadAttachment(context, i, local);
|
||||
|
|
Loading…
Reference in a new issue