Make sure pending operations will be executed

This commit is contained in:
M66B 2018-10-17 10:11:24 +00:00
parent fd54430cd9
commit c3eb1c3127
1 changed files with 10 additions and 0 deletions

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);