mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 21:57:19 +00:00
Unhide on sync when no pending operations
This commit is contained in:
parent
d2961dbf75
commit
1e0d4d68e3
3 changed files with 11 additions and 6 deletions
|
@ -59,6 +59,11 @@ public interface DaoOperation {
|
|||
" AND (:name IS NULL OR operation.name = :name)")
|
||||
int getOperationCount(long folder, String name);
|
||||
|
||||
@Query("SELECT COUNT(id) FROM operation" +
|
||||
" WHERE folder = :folder" +
|
||||
" AND message = :message")
|
||||
int getOperationCount(long folder, long message);
|
||||
|
||||
@Query("UPDATE operation SET error = :error WHERE id = :id")
|
||||
int setOperationError(long id, String error);
|
||||
|
||||
|
|
|
@ -982,7 +982,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
db.beginTransaction();
|
||||
message = synchronizeMessage(
|
||||
ServiceSynchronize.this,
|
||||
folder, ifolder, (IMAPMessage) imessage, false, false);
|
||||
folder, ifolder, (IMAPMessage) imessage, false);
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
@ -1069,7 +1069,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
db.beginTransaction();
|
||||
message = synchronizeMessage(
|
||||
ServiceSynchronize.this,
|
||||
folder, ifolder, (IMAPMessage) e.getMessage(), false, false);
|
||||
folder, ifolder, (IMAPMessage) e.getMessage(), false);
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
|
@ -2136,7 +2136,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
EntityMessage message = synchronizeMessage(
|
||||
this,
|
||||
folder, ifolder, (IMAPMessage) isub[j],
|
||||
false, true);
|
||||
false);
|
||||
ids[from + j] = message.id;
|
||||
db.setTransactionSuccessful();
|
||||
} catch (MessageRemovedException ex) {
|
||||
|
@ -2219,7 +2219,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
static EntityMessage synchronizeMessage(
|
||||
Context context,
|
||||
EntityFolder folder, IMAPFolder ifolder, IMAPMessage imessage,
|
||||
boolean browsed, boolean full) throws MessagingException, IOException {
|
||||
boolean browsed) throws MessagingException, IOException {
|
||||
long uid = ifolder.getUID(imessage);
|
||||
|
||||
if (imessage.isExpunged()) {
|
||||
|
@ -2412,7 +2412,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
" keywords=" + TextUtils.join(" ", keywords));
|
||||
}
|
||||
|
||||
if (message.ui_hide && full) {
|
||||
if (message.ui_hide && db.operation().getOperationCount(folder.id, message.id) == 0) {
|
||||
update = true;
|
||||
message.ui_hide = false;
|
||||
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " unhide");
|
||||
|
|
|
@ -220,7 +220,7 @@ public class ViewModelBrowse extends ViewModel {
|
|||
if (message == null) {
|
||||
message = ServiceSynchronize.synchronizeMessage(
|
||||
state.context,
|
||||
folder, state.ifolder, (IMAPMessage) isub[j], true, false);
|
||||
folder, state.ifolder, (IMAPMessage) isub[j], true);
|
||||
count++;
|
||||
}
|
||||
db.message().setMessageFound(message.account, message.thread);
|
||||
|
|
Loading…
Reference in a new issue