mirror of https://github.com/M66B/FairEmail.git
Sync on scheduled enable
This commit is contained in:
parent
b43534d50e
commit
7ea5bfa9c5
|
@ -210,6 +210,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
state.setNetworkState(current.networkState);
|
state.setNetworkState(current.networkState);
|
||||||
|
|
||||||
boolean reload = false;
|
boolean reload = false;
|
||||||
|
boolean sync = current.command.getBoolean("sync", false);
|
||||||
switch (current.command.getString("name")) {
|
switch (current.command.getString("name")) {
|
||||||
case "reload":
|
case "reload":
|
||||||
reload = true;
|
reload = true;
|
||||||
|
@ -230,6 +231,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
" reload=" + reload +
|
" reload=" + reload +
|
||||||
" stop=" + prev.canRun() +
|
" stop=" + prev.canRun() +
|
||||||
" start=" + current.canRun() +
|
" start=" + current.canRun() +
|
||||||
|
" sync=" + current.accountState.isEnabled(current.enabled) + "/" + sync +
|
||||||
" changed=" + !prev.accountState.equals(current.accountState) +
|
" changed=" + !prev.accountState.equals(current.accountState) +
|
||||||
" enabled=" + current.accountState.synchronize +
|
" enabled=" + current.accountState.synchronize +
|
||||||
" state=" + current.accountState.state +
|
" state=" + current.accountState.state +
|
||||||
|
@ -237,7 +239,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
if (prev.canRun())
|
if (prev.canRun())
|
||||||
stop(prev);
|
stop(prev);
|
||||||
if (current.canRun())
|
if (current.canRun())
|
||||||
start(current, current.accountState.isEnabled(current.enabled));
|
start(current, current.accountState.isEnabled(current.enabled) || sync);
|
||||||
if (current.accountState.tbd != null)
|
if (current.accountState.tbd != null)
|
||||||
delete(current);
|
delete(current);
|
||||||
}
|
}
|
||||||
|
@ -620,6 +622,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
||||||
Bundle command = new Bundle();
|
Bundle command = new Bundle();
|
||||||
schedule(this);
|
schedule(this);
|
||||||
command.putString("name", "eval");
|
command.putString("name", "eval");
|
||||||
|
command.putBoolean("sync", true);
|
||||||
liveAccountNetworkState.post(command);
|
liveAccountNetworkState.post(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue