|
|
@ -17,6 +17,7 @@ import javax.inject.Inject;
|
|
|
|
import org.tasks.LocalBroadcastManager;
|
|
|
|
import org.tasks.LocalBroadcastManager;
|
|
|
|
import org.tasks.data.CaldavAccount;
|
|
|
|
import org.tasks.data.CaldavAccount;
|
|
|
|
import org.tasks.data.CaldavCalendar;
|
|
|
|
import org.tasks.data.CaldavCalendar;
|
|
|
|
|
|
|
|
import org.tasks.data.CaldavDao;
|
|
|
|
import org.tasks.data.DeletionDao;
|
|
|
|
import org.tasks.data.DeletionDao;
|
|
|
|
import org.tasks.data.GoogleTaskAccount;
|
|
|
|
import org.tasks.data.GoogleTaskAccount;
|
|
|
|
import org.tasks.data.GoogleTaskDao;
|
|
|
|
import org.tasks.data.GoogleTaskDao;
|
|
|
@ -29,6 +30,7 @@ public class TaskDeleter {
|
|
|
|
private final TaskDao taskDao;
|
|
|
|
private final TaskDao taskDao;
|
|
|
|
private final LocalBroadcastManager localBroadcastManager;
|
|
|
|
private final LocalBroadcastManager localBroadcastManager;
|
|
|
|
private final GoogleTaskDao googleTaskDao;
|
|
|
|
private final GoogleTaskDao googleTaskDao;
|
|
|
|
|
|
|
|
private final CaldavDao caldavDao;
|
|
|
|
private final DeletionDao deletionDao;
|
|
|
|
private final DeletionDao deletionDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
@Inject
|
|
|
@ -37,12 +39,14 @@ public class TaskDeleter {
|
|
|
|
WorkManager workManager,
|
|
|
|
WorkManager workManager,
|
|
|
|
TaskDao taskDao,
|
|
|
|
TaskDao taskDao,
|
|
|
|
LocalBroadcastManager localBroadcastManager,
|
|
|
|
LocalBroadcastManager localBroadcastManager,
|
|
|
|
GoogleTaskDao googleTaskDao) {
|
|
|
|
GoogleTaskDao googleTaskDao,
|
|
|
|
|
|
|
|
CaldavDao caldavDao) {
|
|
|
|
this.deletionDao = deletionDao;
|
|
|
|
this.deletionDao = deletionDao;
|
|
|
|
this.workManager = workManager;
|
|
|
|
this.workManager = workManager;
|
|
|
|
this.taskDao = taskDao;
|
|
|
|
this.taskDao = taskDao;
|
|
|
|
this.localBroadcastManager = localBroadcastManager;
|
|
|
|
this.localBroadcastManager = localBroadcastManager;
|
|
|
|
this.googleTaskDao = googleTaskDao;
|
|
|
|
this.googleTaskDao = googleTaskDao;
|
|
|
|
|
|
|
|
this.caldavDao = caldavDao;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int purgeDeleted() {
|
|
|
|
public int purgeDeleted() {
|
|
|
@ -58,6 +62,7 @@ public class TaskDeleter {
|
|
|
|
public List<Task> markDeleted(List<Long> taskIds) {
|
|
|
|
public List<Task> markDeleted(List<Long> taskIds) {
|
|
|
|
Set<Long> ids = new HashSet<>(taskIds);
|
|
|
|
Set<Long> ids = new HashSet<>(taskIds);
|
|
|
|
batch(taskIds, i -> ids.addAll(googleTaskDao.getChildren(i)));
|
|
|
|
batch(taskIds, i -> ids.addAll(googleTaskDao.getChildren(i)));
|
|
|
|
|
|
|
|
batch(taskIds, i -> ids.addAll(caldavDao.getChildren(i)));
|
|
|
|
deletionDao.markDeleted(ids);
|
|
|
|
deletionDao.markDeleted(ids);
|
|
|
|
workManager.cleanup(taskIds);
|
|
|
|
workManager.cleanup(taskIds);
|
|
|
|
workManager.sync(false);
|
|
|
|
workManager.sync(false);
|
|
|
|