1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Revert "Restored send delay"

This reverts commit ae0c2478cf.
This commit is contained in:
M66B 2020-07-29 08:41:53 +02:00
parent b331c69331
commit 23b08d943f

View file

@ -79,7 +79,6 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
private static final int PI_SEND = 1;
private static final int RETRY_MAX = 3;
private static final int CONNECTIVITY_DELAY = 5000; // milliseconds
@Override
public void onCreate() {
@ -291,29 +290,24 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
}
private void _checkConnectivity() {
final Network active = ConnectionHelper.getActiveNetwork(this);
final boolean restart = !Objects.equals(lastActive, active);
final boolean suitable = ConnectionHelper.getNetworkState(this).isSuitable();
if (restart || lastSuitable != suitable)
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
Network active = ConnectionHelper.getActiveNetwork(this);
boolean restart = !Objects.equals(lastActive, active);
if (restart) {
lastActive = active;
EntityLog.log(ServiceSend.this, "Service send active=" + active);
EntityLog.log(this, "Service send active=" + active);
if (lastSuitable) {
EntityLog.log(ServiceSend.this, "Service send restart");
EntityLog.log(this, "Service send restart");
lastSuitable = false;
owner.stop();
handling.clear();
}
}
boolean suitable = ConnectionHelper.getNetworkState(this).isSuitable();
if (lastSuitable != suitable) {
lastSuitable = suitable;
EntityLog.log(ServiceSend.this, "Service send suitable=" + suitable);
EntityLog.log(this, "Service send suitable=" + suitable);
try {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
@ -330,8 +324,6 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
}
}
}
}, CONNECTIVITY_DELAY);
}
private void processOperations(List<TupleOperationEx> ops) {
try {