mirror of https://github.com/M66B/FairEmail.git
Fixed FTS / unmetered accounts only
This commit is contained in:
parent
20a1211518
commit
8aaf4c9102
|
@ -273,6 +273,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
int accounts = 0;
|
||||
int operations = 0;
|
||||
boolean event = false;
|
||||
boolean runFts = true;
|
||||
boolean runService = false;
|
||||
for (TupleAccountNetworkState current : accountNetworkStates) {
|
||||
Log.d("### evaluating " + current);
|
||||
|
@ -292,6 +293,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
}
|
||||
if (current.accountState.synchronize)
|
||||
operations += current.accountState.operations;
|
||||
if (current.accountState.operations > 0 && current.canConnect())
|
||||
runFts = false;
|
||||
|
||||
long account = current.command.getLong("account", -1);
|
||||
if (account > 0 && !current.accountState.id.equals(account))
|
||||
|
@ -410,7 +413,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
if (lastAccounts != accounts || lastOperations != operations) {
|
||||
lastAccounts = accounts;
|
||||
lastOperations = operations;
|
||||
if (operations == 0) {
|
||||
if (runFts) {
|
||||
fts = true;
|
||||
WorkerFts.init(ServiceSynchronize.this, false);
|
||||
} else if (fts) {
|
||||
|
|
|
@ -61,9 +61,13 @@ public class TupleAccountNetworkState {
|
|||
this.enabled = false;
|
||||
}
|
||||
|
||||
public boolean canRun() {
|
||||
public boolean canConnect() {
|
||||
boolean unmetered = jconditions.optBoolean("unmetered");
|
||||
if (unmetered && !this.networkState.isUnmetered())
|
||||
return (!unmetered || this.networkState.isUnmetered());
|
||||
}
|
||||
|
||||
public boolean canRun() {
|
||||
if (!canConnect())
|
||||
return false;
|
||||
|
||||
return (this.networkState.isSuitable() && this.accountState.shouldRun(enabled));
|
||||
|
|
Loading…
Reference in New Issue