Hide found messages on move

pull/194/merge
M66B 3 years ago
parent eee054fa7a
commit 7263a603f3

@ -378,7 +378,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
if (!matched)
continue;
found += db.message().setMessageFound(id);
found += db.message().setMessageFound(id, true);
Log.i("Boundary matched=" + id + " found=" + found);
}
db.setTransactionSuccessful();
@ -456,7 +456,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
}
if (matched) {
found += db.message().setMessageFound(match.id);
found += db.message().setMessageFound(match.id, true);
Log.i("Boundary matched=" + match.id + " found=" + found);
}
}
@ -686,7 +686,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
found++; // browsed
}
if (message != null && criteria != null)
found += db.message().setMessageFound(message.id);
found += db.message().setMessageFound(message.id, true);
Log.i("Boundary matched=" + (message == null ? null : message.id) + " found=" + found);
} catch (MessageRemovedException | MessageRemovedIOException ex) {
Log.w(browsable.name + " boundary server", ex);

@ -826,8 +826,8 @@ public interface DaoMessage {
" OR (:folder IS NULL AND :type IS NULL AND unified)))")
int ignoreAll(Long account, Long folder, String type);
@Query("UPDATE message SET ui_found = 1 WHERE id = :id AND NOT (ui_found IS 1)")
int setMessageFound(long id);
@Query("UPDATE message SET ui_found = :found WHERE id = :id AND NOT (ui_found IS :found)")
int setMessageFound(long id, boolean found);
@Query("UPDATE message SET ui_found = 0 WHERE NOT (ui_found IS 0)")
int resetSearch();

@ -238,6 +238,9 @@ public class EntityOperation {
}
}
if (message.ui_found)
db.message().setMessageFound(message.id, false);
if (source.account.equals(target.account)) {
EntityAccount account = db.account().getAccount(message.account);
if ((account != null && !account.isGmail()) ||
@ -294,7 +297,8 @@ public class EntityOperation {
boolean _flagged = message.flagged;
boolean _ui_seen = message.ui_seen;
boolean _ui_flagged = message.ui_flagged;
Boolean _ui_hide = message.ui_hide;
boolean _ui_hide = message.ui_hide;
boolean _ui_found = message.ui_found;
boolean _ui_browsed = message.ui_browsed;
Long ui_busy = message.ui_busy;
Integer _color = message.color;
@ -322,6 +326,7 @@ public class EntityOperation {
message.color = null;
}
message.ui_hide = false;
message.ui_found = false;
message.ui_browsed = false;
message.ui_busy = null;
message.error = null;
@ -347,6 +352,7 @@ public class EntityOperation {
message.ui_seen = _ui_seen;
message.ui_flagged = _ui_flagged;
message.ui_hide = _ui_hide;
message.ui_found = _ui_found;
message.ui_browsed = _ui_browsed;
message.ui_busy = ui_busy;
message.color = _color;

@ -6196,6 +6196,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
for (MessageTarget target : result) {
db.message().setMessageUiBusy(target.id, busy);
db.message().setMessageUiHide(target.id, true);
db.message().setMessageFound(target.id, false);
// Prevent new message notification on undo
db.message().setMessageUiIgnored(target.id, true);
db.message().setMessageLastAttempt(target.id, now);
@ -6274,6 +6275,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Log.i("Move undo id=" + target.id);
db.message().setMessageUiBusy(target.id, null);
db.message().setMessageUiHide(target.id, false);
db.message().setMessageFound(target.id, target.found);
db.message().setMessageLastAttempt(target.id, new Date().getTime());
}
@ -8947,6 +8949,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
public static class MessageTarget implements Parcelable {
long id;
boolean found;
Account sourceAccount;
Folder sourceFolder;
Account targetAccount;
@ -8958,6 +8961,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
EntityAccount sourceAccount, EntityFolder sourceFolder,
EntityAccount targetAccount, EntityFolder targetFolder) {
this.id = message.id;
this.found = message.ui_found;
this.sourceAccount = new Account(sourceAccount);
this.sourceFolder = new Folder(context, sourceFolder);
this.targetAccount = new Account(targetAccount);
@ -8980,6 +8984,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
protected MessageTarget(Parcel in) {
id = in.readLong();
found = (in.readInt() != 0);
sourceAccount = (Account) in.readSerializable();
sourceFolder = (Folder) in.readSerializable();
targetAccount = (Account) in.readSerializable();
@ -8991,6 +8996,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(id);
dest.writeInt(found ? 1 : 0);
dest.writeSerializable(sourceAccount);
dest.writeSerializable(sourceFolder);
dest.writeSerializable(targetAccount);

Loading…
Cancel
Save