mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Widget should show actual connected state
This commit is contained in:
parent
434e755dce
commit
0b4120f873
1 changed files with 8 additions and 5 deletions
|
@ -264,8 +264,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
coreStates.clear();
|
||||
liveAccountNetworkState.removeObserver(this);
|
||||
} else {
|
||||
int accounts = 0;
|
||||
int enabled = 0;
|
||||
int connected = 0;
|
||||
int accounts = 0;
|
||||
int operations = 0;
|
||||
boolean event = false;
|
||||
boolean runService = false;
|
||||
|
@ -280,6 +281,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
if (!current.accountState.isTransient(ServiceSynchronize.this)) {
|
||||
if (current.accountState.isEnabled(current.enabled))
|
||||
enabled++;
|
||||
if ("connected".equals(current.accountState.state))
|
||||
connected++;
|
||||
if ("connected".equals(current.accountState.state) || current.accountState.backoff_until != null)
|
||||
accounts++;
|
||||
}
|
||||
|
@ -387,10 +390,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
}
|
||||
}
|
||||
|
||||
boolean connected = (enabled > 0 && accounts == enabled);
|
||||
if (lastConnected != connected) {
|
||||
lastConnected = connected;
|
||||
prefs.edit().putBoolean("connected", connected).apply();
|
||||
boolean ok = (enabled > 0 && connected == enabled);
|
||||
if (lastConnected != ok) {
|
||||
lastConnected = ok;
|
||||
prefs.edit().putBoolean("connected", ok).apply();
|
||||
WidgetSync.update(ServiceSynchronize.this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue