Fix folder sync state / deleting operations

pull/194/merge
M66B 3 years ago
parent c2524276ad
commit b8a5b5dbf5

@ -228,7 +228,11 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
if (operation == null)
return null;
db.operation().deleteOperation(operation.id);
if (db.operation().deleteOperation(operation.id) > 0)
operation.cleanup(context, false);
if (EntityOperation.SYNC.equals(operation.name))
db.folder().setFolderSyncState(operation.folder, null);
db.folder().setFolderError(operation.folder, null);
if (operation.message != null)

@ -204,10 +204,14 @@ public class FragmentOperations extends FragmentBase {
for (EntityOperation op : ops) {
EntityLog.log(context, "Deleting operation=" + op.id + ":" + op.name + " error=" + op.error);
if (db.operation().deleteOperation(op.id) > 0) {
op.cleanup(context, false);
deleted++;
}
if (EntityOperation.SYNC.equals(op.name))
db.folder().setFolderSyncState(op.folder, null);
}
db.setTransactionSuccessful();

@ -426,6 +426,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
for (EntityFolder folder : db.folder().getFolders(accountNetworkState.accountState.id, false, false)) {
db.folder().setFolderState(folder.id, null);
if (db.operation().getOperationCount(folder.id, EntityOperation.SYNC) == 0)
db.folder().setFolderSyncState(folder.id, null);
db.folder().setFolderPollCount(folder.id, 0);
}

Loading…
Cancel
Save