mirror of https://github.com/M66B/FairEmail.git
Small improvements
This commit is contained in:
parent
90fd7b440f
commit
ef890934e2
|
@ -267,7 +267,9 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
||||||
if (message == null || message.uid == null)
|
if (message == null || message.uid == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
db.attachment().setProgress(id, 0);
|
EntityAttachment attachment = db.attachment().getAttachment(id);
|
||||||
|
if (attachment == null || attachment.progress != null || attachment.available)
|
||||||
|
return null;
|
||||||
|
|
||||||
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, id);
|
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, id);
|
||||||
|
|
||||||
|
|
|
@ -153,16 +153,21 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
|
||||||
@Override
|
@Override
|
||||||
protected Void onExecute(Context context, Bundle args) {
|
protected Void onExecute(Context context, Bundle args) {
|
||||||
long id = args.getLong("id");
|
long id = args.getLong("id");
|
||||||
long message = args.getLong("message");
|
long mid = args.getLong("message");
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
try {
|
try {
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
|
|
||||||
db.attachment().setProgress(id, 0);
|
EntityMessage message = db.message().getMessage(mid);
|
||||||
|
if (message == null || message.uid == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
EntityMessage msg = db.message().getMessage(message);
|
EntityAttachment attachment = db.attachment().getAttachment(id);
|
||||||
EntityOperation.queue(context, msg, EntityOperation.ATTACHMENT, id);
|
if (attachment == null || attachment.progress != null || attachment.available)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, id);
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -2458,19 +2458,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
new SimpleTask<Void>() {
|
new SimpleTask<Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void onExecute(Context context, Bundle args) {
|
protected Void onExecute(Context context, Bundle args) {
|
||||||
long id = args.getLong("id");
|
long mid = args.getLong("id");
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
try {
|
try {
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
|
|
||||||
EntityMessage msg = db.message().getMessage(id);
|
EntityMessage message = db.message().getMessage(mid);
|
||||||
if (msg != null)
|
if (message == null || message.uid == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
for (EntityAttachment attachment : db.attachment().getAttachments(message.id))
|
for (EntityAttachment attachment : db.attachment().getAttachments(message.id))
|
||||||
if (attachment.progress == null && !attachment.available) {
|
if (attachment.progress == null && !attachment.available)
|
||||||
db.attachment().setProgress(attachment.id, 0);
|
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id);
|
||||||
EntityOperation.queue(context, msg, EntityOperation.ATTACHMENT, attachment.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -2621,7 +2621,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
|
|
||||||
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||||
for (EntityAttachment attachment : attachments)
|
for (EntityAttachment attachment : attachments)
|
||||||
if (!attachment.available && attachment.isInline() && attachment.isImage())
|
if (attachment.isInline() && attachment.isImage() &&
|
||||||
|
attachment.progress == null && !attachment.available)
|
||||||
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id);
|
EntityOperation.queue(context, message, EntityOperation.ATTACHMENT, attachment.id);
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
|
@ -3724,12 +3725,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("thread changed id=" + next.id);
|
Log.i("thread changed id=" + next.id);
|
||||||
}
|
}
|
||||||
// receipt_request
|
if (!Objects.equals(prev.priority, next.priority)) {
|
||||||
|
same = false;
|
||||||
|
Log.i("priority changed id=" + next.id);
|
||||||
|
}
|
||||||
|
if (!Objects.equals(prev.receipt_request, next.receipt_request)) {
|
||||||
|
same = false;
|
||||||
|
Log.i("receipt_request changed id=" + next.id);
|
||||||
|
}
|
||||||
if (!MessageHelper.equal(prev.receipt_to, next.receipt_to)) {
|
if (!MessageHelper.equal(prev.receipt_to, next.receipt_to)) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("receipt_to changed id=" + next.id);
|
Log.i("receipt_to changed id=" + next.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Objects.equals(prev.dkim, next.dkim)) {
|
if (!Objects.equals(prev.dkim, next.dkim)) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("dkim changed id=" + next.id);
|
Log.i("dkim changed id=" + next.id);
|
||||||
|
@ -3806,7 +3813,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("content changed id=" + next.id);
|
Log.i("content changed id=" + next.id);
|
||||||
}
|
}
|
||||||
// plain_only
|
if (!Objects.equals(prev.plain_only, next.plain_only)) {
|
||||||
|
same = false;
|
||||||
|
Log.i("plain_only changed id=" + next.id);
|
||||||
|
}
|
||||||
if (!Objects.equals(prev.preview, next.preview)) {
|
if (!Objects.equals(prev.preview, next.preview)) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("preview changed id=" + next.id);
|
Log.i("preview changed id=" + next.id);
|
||||||
|
@ -3835,6 +3845,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("keywords changed id=" + next.id);
|
Log.i("keywords changed id=" + next.id);
|
||||||
}
|
}
|
||||||
|
// notifying
|
||||||
if (!prev.ui_seen.equals(next.ui_seen)) {
|
if (!prev.ui_seen.equals(next.ui_seen)) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("ui_seen changed id=" + next.id);
|
Log.i("ui_seen changed id=" + next.id);
|
||||||
|
@ -3880,6 +3891,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}
|
}
|
||||||
// last_attempt
|
// last_attempt
|
||||||
|
|
||||||
|
// accountPop
|
||||||
if (!Objects.equals(prev.accountName, next.accountName)) {
|
if (!Objects.equals(prev.accountName, next.accountName)) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("accountName changed id=" + next.id);
|
Log.i("accountName changed id=" + next.id);
|
||||||
|
@ -3889,6 +3901,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
Log.i("accountColor changed id=" + next.id);
|
Log.i("accountColor changed id=" + next.id);
|
||||||
}
|
}
|
||||||
// accountNotify
|
// accountNotify
|
||||||
|
// accountAutoSeen
|
||||||
if (!prev.folderName.equals(next.folderName)) {
|
if (!prev.folderName.equals(next.folderName)) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("folderName changed id=" + next.id);
|
Log.i("folderName changed id=" + next.id);
|
||||||
|
@ -3901,6 +3914,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("folderType changed id=" + next.id);
|
Log.i("folderType changed id=" + next.id);
|
||||||
}
|
}
|
||||||
|
// folderReadOnly
|
||||||
if (!Objects.equals(prev.identityName, next.identityName)) {
|
if (!Objects.equals(prev.identityName, next.identityName)) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("identityName changed id=" + next.id);
|
Log.i("identityName changed id=" + next.id);
|
||||||
|
@ -3913,6 +3927,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("identitySynchronize changed id=" + next.id);
|
Log.i("identitySynchronize changed id=" + next.id);
|
||||||
}
|
}
|
||||||
|
// senders
|
||||||
if (prev.count != next.count) {
|
if (prev.count != next.count) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("count changed id=" + next.id);
|
Log.i("count changed id=" + next.id);
|
||||||
|
@ -3925,10 +3940,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("unflagged changed id=" + next.id);
|
Log.i("unflagged changed id=" + next.id);
|
||||||
}
|
}
|
||||||
if (prev.attachments != next.attachments) {
|
|
||||||
same = false;
|
|
||||||
Log.i("attachments changed id=" + next.id);
|
|
||||||
}
|
|
||||||
if (prev.drafts != next.drafts) {
|
if (prev.drafts != next.drafts) {
|
||||||
same = false;
|
same = false;
|
||||||
Log.i("drafts changed id=" + next.id);
|
Log.i("drafts changed id=" + next.id);
|
||||||
|
|
|
@ -250,6 +250,9 @@ public class EntityOperation {
|
||||||
} else if (DELETE.equals(name))
|
} else if (DELETE.equals(name))
|
||||||
db.message().setMessageUiHide(message.id, true);
|
db.message().setMessageUiHide(message.id, true);
|
||||||
|
|
||||||
|
else if (ATTACHMENT.equals(name))
|
||||||
|
db.attachment().setProgress(jargs.getLong(0), null);
|
||||||
|
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue