mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-29 11:15:51 +00:00
Download body for synchronized, expanded messages
This commit is contained in:
parent
7234c33818
commit
6b6798d4e1
1 changed files with 30 additions and 0 deletions
|
@ -4837,6 +4837,36 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
if (!Objects.equals(prev.uid, next.uid)) {
|
||||
same = false;
|
||||
log("uid changed", next.id);
|
||||
|
||||
// Download body when needed
|
||||
if (!next.content &&
|
||||
prev.uid == null && next.uid != null && // once only
|
||||
properties.getValue("expanded", next.id)) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", next.id);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
long id = args.getLong("id");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null || message.content)
|
||||
return null;
|
||||
|
||||
EntityOperation.queue(context, message, EntityOperation.BODY);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, args, "message:body");
|
||||
}
|
||||
}
|
||||
if (!Objects.equals(prev.msgid, next.msgid)) {
|
||||
// debug info
|
||||
|
|
Loading…
Reference in a new issue