From 1a879b0b05b3938824f3ec270b86af7f11dc1715 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 25 Nov 2018 17:41:43 +0100 Subject: [PATCH] Unhide on full sync only --- .../java/eu/faircode/email/ServiceSynchronize.java | 10 +++++----- .../main/java/eu/faircode/email/ViewModelBrowse.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 11484fc18a..283b78b1b1 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -887,7 +887,7 @@ public class ServiceSynchronize extends LifecycleService { long id; try { db.beginTransaction(); - id = synchronizeMessage(ServiceSynchronize.this, folder, ifolder, (IMAPMessage) imessage, false); + id = synchronizeMessage(ServiceSynchronize.this, folder, ifolder, (IMAPMessage) imessage, false, false); db.setTransactionSuccessful(); } finally { db.endTransaction(); @@ -970,7 +970,7 @@ public class ServiceSynchronize extends LifecycleService { long id; try { db.beginTransaction(); - id = synchronizeMessage(ServiceSynchronize.this, folder, ifolder, (IMAPMessage) e.getMessage(), false); + id = synchronizeMessage(ServiceSynchronize.this, folder, ifolder, (IMAPMessage) e.getMessage(), false, false); db.setTransactionSuccessful(); } finally { db.endTransaction(); @@ -1909,7 +1909,7 @@ public class ServiceSynchronize extends LifecycleService { for (int j = isub.length - 1; j >= 0; j--) try { db.beginTransaction(); - ids[from + j] = synchronizeMessage(this, folder, ifolder, (IMAPMessage) isub[j], false); + ids[from + j] = synchronizeMessage(this, folder, ifolder, (IMAPMessage) isub[j], false, true); db.setTransactionSuccessful(); Thread.sleep(20); } catch (MessageRemovedException ex) { @@ -1975,7 +1975,7 @@ public class ServiceSynchronize extends LifecycleService { } } - static Long synchronizeMessage(Context context, EntityFolder folder, IMAPFolder ifolder, IMAPMessage imessage, boolean found) throws MessagingException, IOException { + static Long synchronizeMessage(Context context, EntityFolder folder, IMAPFolder ifolder, IMAPMessage imessage, boolean found, boolean full) throws MessagingException, IOException { long uid = ifolder.getUID(imessage); if (imessage.isExpunged()) { @@ -2152,7 +2152,7 @@ public class ServiceSynchronize extends LifecycleService { " keywords=" + TextUtils.join(" ", keywords)); } - if (!update && message.ui_hide) { + if (message.ui_hide && full) { update = true; message.ui_hide = false; db.message().updateMessage(message); diff --git a/app/src/main/java/eu/faircode/email/ViewModelBrowse.java b/app/src/main/java/eu/faircode/email/ViewModelBrowse.java index 1c57748397..d624f805be 100644 --- a/app/src/main/java/eu/faircode/email/ViewModelBrowse.java +++ b/app/src/main/java/eu/faircode/email/ViewModelBrowse.java @@ -200,7 +200,7 @@ public class ViewModelBrowse extends ViewModel { EntityMessage message = db.message().getMessageByUid(state.fid, uid, state.search != null); if (message == null) { ServiceSynchronize.synchronizeMessage( - state.context, folder, state.ifolder, (IMAPMessage) isub[j], state.search != null); + state.context, folder, state.ifolder, (IMAPMessage) isub[j], state.search != null, false); count++; } } catch (MessageRemovedException ex) {