|
|
@ -7,11 +7,19 @@ import android.arch.persistence.room.Dao;
|
|
|
|
import android.arch.persistence.room.Delete;
|
|
|
|
import android.arch.persistence.room.Delete;
|
|
|
|
import android.arch.persistence.room.Query;
|
|
|
|
import android.arch.persistence.room.Query;
|
|
|
|
import android.arch.persistence.room.Transaction;
|
|
|
|
import android.arch.persistence.room.Transaction;
|
|
|
|
|
|
|
|
import com.todoroo.astrid.dao.Database;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
@Dao
|
|
|
|
@Dao
|
|
|
|
public abstract class DeletionDao {
|
|
|
|
public abstract class DeletionDao {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Database database;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DeletionDao(Database database) {
|
|
|
|
|
|
|
|
this.database = database;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Query("SELECT _id FROM tasks WHERE deleted > 0")
|
|
|
|
@Query("SELECT _id FROM tasks WHERE deleted > 0")
|
|
|
|
public abstract List<Long> getDeleted();
|
|
|
|
public abstract List<Long> getDeleted();
|
|
|
|
|
|
|
|
|
|
|
@ -43,6 +51,7 @@ public abstract class DeletionDao {
|
|
|
|
deleteCaldavTasks(partition);
|
|
|
|
deleteCaldavTasks(partition);
|
|
|
|
deleteTasks(partition);
|
|
|
|
deleteTasks(partition);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
database.onDatabaseUpdated();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Query("UPDATE tasks SET modified = :timestamp, deleted = :timestamp WHERE _id IN(:ids)")
|
|
|
|
@Query("UPDATE tasks SET modified = :timestamp, deleted = :timestamp WHERE _id IN(:ids)")
|
|
|
@ -53,6 +62,7 @@ public abstract class DeletionDao {
|
|
|
|
for (List<Long> partition : partition(ids, 997)) {
|
|
|
|
for (List<Long> partition : partition(ids, 997)) {
|
|
|
|
markDeleted(now, partition);
|
|
|
|
markDeleted(now, partition);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
database.onDatabaseUpdated();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Query("SELECT task FROM google_tasks WHERE deleted = 0 AND list_id = :listId")
|
|
|
|
@Query("SELECT task FROM google_tasks WHERE deleted = 0 AND list_id = :listId")
|
|
|
|