mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 19:34:15 +01:00
Moved exists/reply to sync service
This commit is contained in:
@@ -78,7 +78,6 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
|
||||
private static final int CONNECTIVITY_DELAY = 5000; // milliseconds
|
||||
|
||||
static final int PI_SEND = 1;
|
||||
static final int PI_EXISTS = 2;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -198,20 +197,6 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
|
||||
Log.i("Send intent=" + intent);
|
||||
Log.logExtras(intent);
|
||||
|
||||
if (intent == null)
|
||||
return START_STICKY;
|
||||
|
||||
String action = intent.getAction();
|
||||
if (action == null)
|
||||
return START_STICKY;
|
||||
|
||||
String[] parts = action.split(":");
|
||||
switch (parts[0]) {
|
||||
case "exists":
|
||||
onExists(intent);
|
||||
break;
|
||||
}
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@@ -763,38 +748,6 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
|
||||
ServiceSynchronize.eval(this, "sent");
|
||||
}
|
||||
|
||||
private void onExists(Intent intent) {
|
||||
String action = intent.getAction();
|
||||
long id = Long.parseLong(action.split(":")[1]);
|
||||
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
DB db = DB.getInstance(ServiceSend.this);
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
// Message could have been deleted in the meantime
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
return;
|
||||
|
||||
EntityOperation.queue(ServiceSend.this, message, EntityOperation.EXISTS, true);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void boot(final Context context) {
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user