mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
Always process send operations on connectivity changes
This commit is contained in:
@@ -229,10 +229,10 @@ public class ServiceSend extends ServiceBase {
|
||||
};
|
||||
|
||||
private void checkConnectivity() {
|
||||
boolean suitable = ConnectionHelper.getNetworkState(ServiceSend.this).isSuitable();
|
||||
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);
|
||||
@@ -240,15 +240,15 @@ public class ServiceSend extends ServiceBase {
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
if (suitable)
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
processOperations();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (suitable)
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
processOperations();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void processOperations() {
|
||||
@@ -376,6 +376,10 @@ public class ServiceSend extends ServiceBase {
|
||||
if (!message.content)
|
||||
throw new IllegalArgumentException("Message body missing");
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
if (cm.isActiveNetworkMetered())
|
||||
throw new IOException("Metered");
|
||||
|
||||
// Create message
|
||||
Properties props = MessageHelper.getSessionProperties();
|
||||
Session isession = Session.getInstance(props, null);
|
||||
|
||||
Reference in New Issue
Block a user