Simplified boot

This commit is contained in:
M66B 2019-12-12 17:20:30 +01:00
parent bf33e78248
commit 1667bd3e12
2 changed files with 13 additions and 14 deletions

View File

@ -516,7 +516,7 @@ public class ServiceSend extends ServiceBase {
try {
DB db = DB.getInstance(context);
EntityFolder outbox = db.folder().getOutbox();
if (outbox != null && db.operation().getOperations(outbox.id).size() > 0)
if (outbox != null)
start(context);
} catch (Throwable ex) {
Log.e(ex);

View File

@ -1435,6 +1435,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
try {
DB db = DB.getInstance(context);
// Reset accounts
for (EntityAccount account : db.account().getAccounts())
db.account().setAccountState(account.id, null);
// reset folders
for (EntityFolder folder : db.folder().getFolders()) {
db.folder().setFolderState(folder.id, null);
db.folder().setFolderSyncState(folder.id, null);
}
// Restore notifications
db.message().clearNotifyingMessages();
@ -1445,19 +1455,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
// Restore schedule
schedule(context);
// Conditionally init service
int accounts = db.account().getSynchronizingAccounts().size();
if (accounts > 0)
eval(context, "boot");
else {
for (EntityAccount account : db.account().getAccounts())
db.account().setAccountState(account.id, null);
for (EntityFolder folder : db.folder().getFolders()) {
db.folder().setFolderState(folder.id, null);
db.folder().setFolderSyncState(folder.id, null);
}
}
// Init service
eval(context, "boot");
} catch (Throwable ex) {
Log.e(ex);
}