Browse Source

Make sure pending operations will be executed

main
M66B 6 years ago
parent
commit
c3eb1c3127
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 10
- 0
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -992,6 +992,15 @@ public class ServiceSynchronize extends LifecycleService {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(ServiceSynchronize.this); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(ServiceSynchronize.this);
lbm.registerReceiver(processFolder, f); lbm.registerReceiver(processFolder, f);
for (EntityFolder folder : folders.keySet())
if (db.operation().getOperationCount(folder.id) > 0) {
Intent intent = new Intent();
intent.setType("account/" + account.id);
intent.setAction(ServiceSynchronize.ACTION_PROCESS_OPERATIONS);
intent.putExtra("folder", folder.id);
lbm.sendBroadcast(intent);
}
// Keep alive alarm receiver // Keep alive alarm receiver
BroadcastReceiver alarm = new BroadcastReceiver() { BroadcastReceiver alarm = new BroadcastReceiver() {
@Override @Override
@ -1985,6 +1994,7 @@ public class ServiceSynchronize extends LifecycleService {
f.addDataType("account/outbox"); f.addDataType("account/outbox");
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(ServiceSynchronize.this); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(ServiceSynchronize.this);
lbm.registerReceiver(outboxReceiver, f); lbm.registerReceiver(outboxReceiver, f);
db.folder().setFolderState(outbox.id, "connected"); db.folder().setFolderState(outbox.id, "connected");
db.folder().setFolderError(outbox.id, null); db.folder().setFolderError(outbox.id, null);


Loading…
Cancel
Save