From 7ea5bfa9c514957487ced342b56f478f6c74da7c Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 18 Dec 2019 09:29:38 +0100 Subject: [PATCH] Sync on scheduled enable --- app/src/main/java/eu/faircode/email/ServiceSynchronize.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 9ae6fc0837..7126080072 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -210,6 +210,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences state.setNetworkState(current.networkState); boolean reload = false; + boolean sync = current.command.getBoolean("sync", false); switch (current.command.getString("name")) { case "reload": reload = true; @@ -230,6 +231,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences " reload=" + reload + " stop=" + prev.canRun() + " start=" + current.canRun() + + " sync=" + current.accountState.isEnabled(current.enabled) + "/" + sync + " changed=" + !prev.accountState.equals(current.accountState) + " enabled=" + current.accountState.synchronize + " state=" + current.accountState.state + @@ -237,7 +239,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (prev.canRun()) stop(prev); if (current.canRun()) - start(current, current.accountState.isEnabled(current.enabled)); + start(current, current.accountState.isEnabled(current.enabled) || sync); if (current.accountState.tbd != null) delete(current); } @@ -620,6 +622,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Bundle command = new Bundle(); schedule(this); command.putString("name", "eval"); + command.putBoolean("sync", true); liveAccountNetworkState.post(command); }