Download body only when uid

master
M66B 4 weeks ago
parent 036c68941d
commit aa8fb48136

@ -2187,8 +2187,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
db.operation().liveOperations(message.id, EntityOperation.BODY).observe(eowner, new Observer<TupleMessageOperation>() { db.operation().liveOperations(message.id, EntityOperation.BODY).observe(eowner, new Observer<TupleMessageOperation>() {
@Override @Override
public void onChanged(TupleMessageOperation operation) { public void onChanged(TupleMessageOperation operation) {
grpDownloading.setVisibility(operation == null || operation.id == null ? View.GONE : View.VISIBLE); grpDownloading.setVisibility(operation != null &&
ibDownload.setVisibility(operation != null && operation.id == null && !operation.content ? View.VISIBLE : View.GONE); (operation.id != null || operation.uid == null) ? View.VISIBLE : View.GONE);
ibDownload.setVisibility(operation != null &&
operation.id == null && operation.uid != null && !operation.content ? View.VISIBLE : View.GONE);
} }
}); });

@ -79,7 +79,8 @@ public interface DaoOperation {
" ORDER BY " + priority + ", id") " ORDER BY " + priority + ", id")
LiveData<List<TupleOperationEx>> liveOperations(long account); LiveData<List<TupleOperationEx>> liveOperations(long account);
@Query("SELECT operation.id, message.content" + @Query("SELECT operation.id" +
", message.uid, message.content" +
" FROM message" + " FROM message" +
" LEFT JOIN operation ON operation.message = message.id AND operation.name = :name" + " LEFT JOIN operation ON operation.message = message.id AND operation.name = :name" +
" WHERE message.id = :message") " WHERE message.id = :message")

@ -21,5 +21,6 @@ package eu.faircode.email;
public class TupleMessageOperation { public class TupleMessageOperation {
public Long id; public Long id;
public Long uid;
public boolean content; public boolean content;
} }

Loading…
Cancel
Save