Explicitly found

pull/146/head
M66B 6 years ago
parent abfefdcb5f
commit 4d103816b9

@ -266,7 +266,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
try {
db.beginTransaction();
for (Long mid : db.message().getMessageByFolder(id)) {
for (Long mid : db.message().getMessageByFolder(id, false)) {
EntityMessage message = db.message().getMessage(mid);
db.message().setMessageUiHide(message.id, true);
EntityOperation.queue(db, message, EntityOperation.DELETE);

@ -598,6 +598,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
Bundle args = new Bundle();
args.putLong("account", message.account);
args.putString("thread", message.thread);
args.putBoolean("found", message.ui_found);
args.putBoolean("seen", seen);
new SimpleTask<Void>() {
@ -605,13 +606,14 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
protected Void onLoad(Context context, Bundle args) throws Throwable {
long account = args.getLong("account");
String thread = args.getString("thread");
boolean found = args.getBoolean("found");
boolean seen = args.getBoolean("seen");
DB db = DB.getInstance(context);
try {
db.beginTransaction();
List<EntityMessage> messages = db.message().getMessageByThread(account, thread);
List<EntityMessage> messages = db.message().getMessageByThread(account, thread, found);
for (EntityMessage message : messages) {
db.message().setMessageUiSeen(message.id, seen);
db.message().setMessageUiIgnored(message.id, true);
@ -679,8 +681,8 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
try {
db.beginTransaction();
List<EntityMessage> messages =
db.message().getMessageByThread(message.account, message.thread);
List<EntityMessage> messages = db.message().getMessageByThread(
message.account, message.thread, message.ui_found);
for (EntityMessage threaded : messages) {
db.message().setMessageUiHide(threaded.id, true);
EntityOperation.queue(db, threaded, EntityOperation.MOVE, target);

@ -151,16 +151,16 @@ public interface DaoMessage {
@Query("SELECT id" +
" FROM message" +
" WHERE folder = :folder" +
" AND NOT ui_found" +
" AND ui_found = :found" +
" ORDER BY message.received DESC, message.sent DESC")
List<Long> getMessageByFolder(long folder);
List<Long> getMessageByFolder(long folder, boolean found);
@Query("SELECT *" +
" FROM message" +
" WHERE account = :account" +
" AND thread = :thread" +
" AND NOT ui_found")
List<EntityMessage> getMessageByThread(long account, String thread);
" AND ui_found = :found")
List<EntityMessage> getMessageByThread(long account, String thread, boolean found);
@Query("SELECT message.* FROM message" +
" JOIN folder ON folder.id = message.folder" +
@ -172,8 +172,9 @@ public interface DaoMessage {
@Query("SELECT * FROM message" +
" WHERE folder = :folder" +
" AND ui_seen")
List<EntityMessage> getMessageSeen(long folder);
" AND ui_seen" +
" AND ui_found = :found")
List<EntityMessage> getMessageSeen(long folder, boolean found);
@Query("SELECT id FROM message" +
" WHERE content" +

@ -475,8 +475,8 @@ public class FragmentMessages extends FragmentEx {
result.target = target;
if (thread) {
List<EntityMessage> messages =
db.message().getMessageByThread(message.account, message.thread);
List<EntityMessage> messages = db.message().getMessageByThread(
message.account, message.thread, message.ui_found);
for (EntityMessage threaded : messages) {
if (!threaded.ui_hide && threaded.folder.equals(message.folder))
result.ids.add(threaded.id);
@ -612,8 +612,8 @@ public class FragmentMessages extends FragmentEx {
for (long id : ids) {
EntityMessage message = db.message().getMessage(id);
List<EntityMessage> messages =
db.message().getMessageByThread(message.account, message.thread);
List<EntityMessage> messages = db.message().getMessageByThread(
message.account, message.thread, message.ui_found);
for (EntityMessage threaded : messages) {
if (threaded.folder.equals(message.folder)) {
db.message().setMessageUiHide(threaded.id, true);
@ -1047,7 +1047,7 @@ public class FragmentMessages extends FragmentEx {
try {
db.beginTransaction();
for (EntityMessage message : db.message().getMessageSeen(outbox)) {
for (EntityMessage message : db.message().getMessageSeen(outbox, false)) {
EntityIdentity identity = db.identity().getIdentity(message.identity);
EntityFolder sent = db.folder().getFolderByType(identity.account, EntityFolder.SENT);
if (sent != null) {
@ -1313,6 +1313,7 @@ public class FragmentMessages extends FragmentEx {
Bundle args = new Bundle();
args.putLong("account", account);
args.putString("thread", thread);
args.putBoolean("found", found);
args.putString("folderType", folderType);
new SimpleTask<MessageTarget>() {
@ -1320,6 +1321,7 @@ public class FragmentMessages extends FragmentEx {
protected MessageTarget onLoad(Context context, Bundle args) {
long account = args.getLong("account");
String thread = args.getString("thread");
boolean found = args.getBoolean("found");
String folderType = args.getString("folderType");
MessageTarget result = new MessageTarget();
@ -1330,7 +1332,7 @@ public class FragmentMessages extends FragmentEx {
result.target = db.folder().getFolderByType(account, folderType);
List<EntityMessage> messages = db.message().getMessageByThread(account, thread);
List<EntityMessage> messages = db.message().getMessageByThread(account, thread, found);
for (EntityMessage message : messages)
if (message.uid != null && !result.target.id.equals(message.folder)) {
result.ids.add(message.id);

@ -88,7 +88,7 @@ public class ViewModelBrowse extends ViewModel {
db.beginTransaction();
if (state.messages == null)
state.messages = db.message().getMessageByFolder(state.fid);
state.messages = db.message().getMessageByFolder(state.fid, false);
int matched = 0;
for (int i = state.local; i < state.messages.size() && matched < state.pageSize; i++) {

Loading…
Cancel
Save