Remove unused dao methods

pull/1051/head
Alex Baker 4 years ago
parent 22b2d090de
commit d550063114

@ -5,8 +5,6 @@
*/
package com.todoroo.astrid.dao
import androidx.paging.DataSource
import androidx.sqlite.db.SimpleSQLiteQuery
import com.todoroo.astrid.api.Filter
import com.todoroo.astrid.data.Task
import org.tasks.data.SubtaskInfo
@ -25,10 +23,6 @@ class TaskDaoBlocking @Inject constructor(private val dao: TaskDao) {
dao.fetch(id)
}
fun fetch(id: Long): Task? = runBlocking {
dao.fetch(id)
}
fun fetch(ids: List<Long>): List<Task> = runBlocking {
dao.fetch(ids)
}
@ -49,14 +43,6 @@ class TaskDaoBlocking @Inject constructor(private val dao: TaskDao) {
dao.getActiveTasks()
}
fun getRecurringTasks(remoteIds: List<String>): List<Task> = runBlocking {
dao.getRecurringTasks(remoteIds)
}
fun setCompletionDate(remoteId: String, completionDate: Long) = runBlocking {
dao.setCompletionDate(remoteId, completionDate)
}
fun snooze(taskIds: List<Long>, millis: Long) = runBlocking {
dao.snooze(taskIds, millis)
}
@ -99,62 +85,18 @@ class TaskDaoBlocking @Inject constructor(private val dao: TaskDao) {
}
}
fun fetchTasks(callback: (SubtaskInfo) -> List<String>, subtasks: SubtaskInfo): List<TaskContainer> = runBlocking {
dao.fetchTasks(callback, subtasks)
}
fun fetchTasks(preferences: Preferences, filter: Filter): List<TaskContainer> = runBlocking {
dao.fetchTasks(preferences, filter)
}
fun fetchTasks(query: SimpleSQLiteQuery): List<TaskContainer> = runBlocking {
dao.fetchTasks(query)
}
fun count(query: SimpleSQLiteQuery): Int = runBlocking {
dao.count(query)
}
fun getSubtaskInfo(): SubtaskInfo = runBlocking {
dao.getSubtaskInfo()
}
fun getTaskFactory(query: SimpleSQLiteQuery): DataSource.Factory<Int, TaskContainer> {
return dao.getTaskFactory(query)
}
fun touch(id: Long) = runBlocking {
dao.touch(id)
}
fun touch(ids: List<Long>) = runBlocking {
dao.touch(ids)
}
fun setParent(parent: Long, tasks: List<Long>) = runBlocking {
dao.setParent(parent, tasks)
}
fun fetchChildren(id: Long): List<Task> = runBlocking {
dao.fetchChildren(id)
}
fun getChildren(id: Long): List<Long> = runBlocking {
dao.getChildren(id)
}
fun getChildren(ids: List<Long>): List<Long> = runBlocking {
dao.getChildren(ids)
}
fun setCollapsed(id: Long, collapsed: Boolean) = runBlocking {
dao.setCollapsed(id, collapsed)
}
fun setCollapsed(preferences: Preferences, filter: Filter, collapsed: Boolean) = runBlocking {
dao.setCollapsed(preferences, filter, collapsed)
}
fun save(task: Task) = runBlocking {
dao.save(task)
}
@ -182,12 +124,4 @@ class TaskDaoBlocking @Inject constructor(private val dao: TaskDao) {
fun fetchFiltered(filter: Filter): List<Task> = runBlocking {
dao.fetchFiltered(filter)
}
fun fetchFiltered(queryTemplate: String): List<Task> = runBlocking {
dao.fetchFiltered(queryTemplate)
}
fun getLocalTasks(): List<Long> = runBlocking {
dao.getLocalTasks()
}
}

@ -4,22 +4,10 @@ import javax.inject.Inject
@Deprecated("use coroutines")
class AlarmDaoBlocking @Inject constructor(private val dao: AlarmDao) {
fun getActiveAlarms(): List<Alarm> = runBlocking {
dao.getActiveAlarms()
}
fun getActiveAlarms(taskId: Long): List<Alarm> = runBlocking {
dao.getActiveAlarms(taskId)
}
fun getAlarms(taskId: Long): List<Alarm> = runBlocking {
dao.getAlarms(taskId)
}
fun delete(alarm: Alarm) = runBlocking {
dao.delete(alarm)
}
fun insert(alarm: Alarm): Long = runBlocking {
dao.insert(alarm)
}

@ -1,6 +1,5 @@
package org.tasks.data
import android.content.Context
import androidx.lifecycle.LiveData
import com.todoroo.astrid.data.Task
import org.tasks.filters.CaldavFilters
@ -57,42 +56,14 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) {
dao.insert(task, caldavTask, addToTop)
}
internal fun findFirstTask(calendar: String, parent: Long): Long? = runBlocking {
dao.findFirstTask(calendar, parent)
}
internal fun findLastTask(calendar: String, parent: Long): Long? = runBlocking {
dao.findLastTask(calendar, parent)
}
fun insert(caldavTask: CaldavTask): Long = runBlocking {
dao.insert(caldavTask)
}
fun insert(tasks: Iterable<CaldavTask>) = runBlocking {
dao.insert(tasks)
}
fun update(caldavTask: CaldavTask) = runBlocking {
dao.update(caldavTask)
}
fun update(caldavTask: SubsetCaldav) = runBlocking {
dao.update(caldavTask)
}
internal fun update(id: Long, position: Long?, parent: String?) = runBlocking {
dao.update(id, position, parent)
}
internal fun update(id: Long, position: Long?) = runBlocking {
dao.update(id, position)
}
internal fun update(id: Long, remoteParent: String?) = runBlocking {
dao.update(id, remoteParent)
}
fun update(tasks: Iterable<CaldavTask>) = runBlocking {
dao.update(tasks)
}
@ -105,10 +76,6 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) {
dao.getDeleted(calendar)
}
fun markDeleted(tasks: List<Long>, now: Long = currentTimeMillis()) = runBlocking {
dao.markDeleted(tasks, now)
}
fun getTask(taskId: Long): CaldavTask? = runBlocking {
dao.getTask(taskId)
}
@ -129,10 +96,6 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) {
dao.getTasks(taskId)
}
fun getTasks(taskIds: List<Long>): List<CaldavTask> = runBlocking {
dao.getTasks(taskIds)
}
fun getTasks(): List<CaldavTaskContainer> = runBlocking {
dao.getTasks()
}
@ -145,10 +108,6 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) {
dao.getCalendars()
}
fun getCalendar(uuid: String): CaldavCalendar? = runBlocking {
dao.getCalendar(uuid)
}
fun getObjects(calendar: String): List<String> = runBlocking {
dao.getObjects(calendar)
}
@ -169,10 +128,6 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) {
dao.getAccountForTask(task)
}
fun getCalendars(tasks: List<Long>): List<String> = runBlocking {
dao.getCalendars(tasks)
}
fun getCaldavFilters(uuid: String, now: Long = currentTimeMillis()): List<CaldavFilters> = runBlocking {
dao.getCaldavFilters(uuid, now)
}
@ -189,10 +144,6 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) {
dao.updateParents(calendar)
}
fun move(task: TaskContainer, newParent: Long, newPosition: Long?) = runBlocking {
dao.move(task, newParent, newPosition)
}
fun shiftDown(calendar: String, parent: Long, from: Long, to: Long? = null) = runBlocking {
dao.shiftDown(calendar, parent, from, to)
}
@ -204,12 +155,4 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) {
fun setOrder(id: Long, order: Int) = runBlocking {
dao.setOrder(id, order)
}
fun setupLocalAccount(context: Context): CaldavAccount = runBlocking {
dao.setupLocalAccount(context)
}
fun getLocalList(context: Context) = runBlocking {
dao.getLocalList(context)
}
}

@ -17,7 +17,7 @@ abstract class DeletionDao {
internal abstract suspend fun deleteGoogleTasks(ids: List<Long>)
@Query("DELETE FROM tags WHERE task IN(:ids)")
abstract suspend fun deleteTags(ids: List<Long>)
internal abstract suspend fun deleteTags(ids: List<Long>)
@Query("DELETE FROM geofences WHERE task IN(:ids)")
internal abstract suspend fun deleteGeofences(ids: List<Long>)

@ -4,10 +4,6 @@ import javax.inject.Inject
@Deprecated("use coroutines")
class DeletionDaoBlocking @Inject constructor(private val dao: DeletionDao) {
fun deleteTags(ids: List<Long>) = runBlocking {
dao.deleteTags(ids)
}
fun delete(ids: List<Long>) = runBlocking {
dao.delete(ids)
}
@ -20,10 +16,6 @@ class DeletionDaoBlocking @Inject constructor(private val dao: DeletionDao) {
dao.delete(googleTaskList)
}
fun getLists(account: String): List<GoogleTaskList> = runBlocking {
dao.getLists(account)
}
fun delete(googleTaskAccount: GoogleTaskAccount): List<Long> = runBlocking {
dao.delete(googleTaskAccount)
}
@ -32,10 +24,6 @@ class DeletionDaoBlocking @Inject constructor(private val dao: DeletionDao) {
dao.delete(caldavCalendar)
}
fun getCalendars(account: String): List<CaldavCalendar> = runBlocking {
dao.getCalendars(account)
}
fun purgeDeleted() = runBlocking {
dao.purgeDeleted()
}

@ -1,7 +1,5 @@
package org.tasks.data
import com.todoroo.astrid.data.Task
import org.tasks.time.DateTimeUtils.currentTimeMillis
import javax.inject.Inject
@Deprecated("use coroutines")
@ -10,18 +8,10 @@ class GoogleTaskDaoBlocking @Inject constructor(private val dao: GoogleTaskDao)
dao.insert(task)
}
fun insert(tasks: Iterable<GoogleTask>) = runBlocking {
dao.insert(tasks)
}
fun insertAndShift(task: GoogleTask, top: Boolean) = runBlocking {
dao.insertAndShift(task, top)
}
fun move(task: SubsetGoogleTask, newParent: Long, newPosition: Long) = runBlocking {
dao.move(task, newParent, newPosition)
}
fun setCollapsed(id: Long, collapsed: Boolean) = runBlocking {
dao.setCollapsed(id, collapsed)
}
@ -34,14 +24,6 @@ class GoogleTaskDaoBlocking @Inject constructor(private val dao: GoogleTaskDao)
dao.update(googleTask)
}
fun update(id: Long, parent: Long, order: Long) = runBlocking {
dao.update(id, parent, order)
}
fun markDeleted(task: Long, now: Long = currentTimeMillis()) = runBlocking {
dao.markDeleted(task, now)
}
fun delete(deleted: GoogleTask) = runBlocking {
dao.delete(deleted)
}
@ -58,26 +40,10 @@ class GoogleTaskDaoBlocking @Inject constructor(private val dao: GoogleTaskDao)
dao.getAllByTaskId(taskId)
}
fun getLists(tasks: List<Long>): List<String> = runBlocking {
dao.getLists(tasks)
}
fun getChildren(ids: List<Long>): List<Long> = runBlocking {
dao.getChildren(ids)
}
fun getChildTasks(taskId: Long): List<Task> = runBlocking {
dao.getChildTasks(taskId)
}
fun getChildren(id: Long): List<GoogleTask> = runBlocking {
dao.getChildren(id)
}
fun getBottom(listId: String, parent: Long): Long = runBlocking {
dao.getBottom(listId, parent)
}
fun getPrevious(listId: String, parent: Long, order: Long): String? = runBlocking {
dao.getPrevious(listId, parent, order)
}
@ -90,18 +56,10 @@ class GoogleTaskDaoBlocking @Inject constructor(private val dao: GoogleTaskDao)
dao.getTask(remoteId)
}
fun getByLocalOrder(listId: String): List<GoogleTask> = runBlocking {
dao.getByLocalOrder(listId)
}
fun updateParents() = runBlocking {
dao.updateParents()
}
fun updateParents(listId: String) = runBlocking {
dao.updateParents(listId)
}
fun updatePosition(id: String, parent: String?, position: String) = runBlocking {
dao.updatePosition(id, parent, position)
}
@ -109,8 +67,4 @@ class GoogleTaskDaoBlocking @Inject constructor(private val dao: GoogleTaskDao)
fun reposition(listId: String) = runBlocking {
dao.reposition(listId)
}
fun validateSorting(listId: String) = runBlocking {
dao.validateSorting(listId)
}
}

@ -7,10 +7,6 @@ import javax.inject.Inject
@Deprecated("use coroutines")
class GoogleTaskListDaoBlocking @Inject constructor(private val dao: GoogleTaskListDao) {
fun accountCount(): Int = runBlocking {
dao.accountCount()
}
fun getAccounts(): List<GoogleTaskAccount> = runBlocking {
dao.getAccounts()
}

@ -1,8 +1,6 @@
package org.tasks.data
import androidx.lifecycle.LiveData
import org.tasks.filters.LocationFilters
import org.tasks.time.DateTimeUtils.currentTimeMillis
import javax.inject.Inject
@Deprecated("use coroutines")
@ -99,10 +97,6 @@ class LocationDaoBlocking @Inject constructor(private val dao: LocationDao) {
dao.findPlace(latitude, longitude)
}
fun getPlaceFilters(now: Long = currentTimeMillis()): List<LocationFilters> = runBlocking {
dao.getPlaceFilters(now)
}
fun resetOrders() = runBlocking {
dao.resetOrders()
}

@ -15,7 +15,7 @@ abstract class TagDao {
abstract suspend fun insert(tags: Iterable<Tag>)
@Query("DELETE FROM tags WHERE task = :taskId AND tag_uid in (:tagUids)")
abstract suspend fun deleteTags(taskId: Long, tagUids: List<String>)
internal abstract suspend fun deleteTags(taskId: Long, tagUids: List<String>)
@Query("SELECT * FROM tags WHERE tag_uid = :tagUid")
abstract suspend fun getByTagUid(tagUid: String): List<Tag>

@ -17,10 +17,6 @@ class TagDaoBlocking @Inject constructor(private val dao: TagDao) {
dao.insert(tags)
}
fun deleteTags(taskId: Long, tagUids: List<String>) = runBlocking {
dao.deleteTags(taskId, tagUids)
}
fun getByTagUid(tagUid: String): List<Tag> = runBlocking {
dao.getByTagUid(tagUid)
}

@ -54,7 +54,7 @@ abstract class TagDataDao {
internal abstract suspend fun deleteTagData(tagData: TagData)
@Query("DELETE FROM tags WHERE tag_uid = :tagUid")
abstract suspend fun deleteTags(tagUid: String)
internal abstract suspend fun deleteTags(tagUid: String)
@Query("SELECT * FROM tags WHERE task IN (:tasks) AND tag_uid NOT IN (:tagsToKeep)")
internal abstract suspend fun tagsToDelete(tasks: List<Long>, tagsToKeep: List<String>): List<Tag>
@ -115,7 +115,7 @@ abstract class TagDataDao {
abstract suspend fun delete(tagData: List<TagData>)
@Delete
abstract suspend fun deleteTags(tags: List<Tag>)
internal abstract suspend fun deleteTags(tags: List<Tag>)
@Query("SELECT tagdata.* FROM tagdata "
+ "INNER JOIN tags ON tags.tag_uid = tagdata.remoteId "

@ -2,9 +2,6 @@ package org.tasks.data
import androidx.core.util.Pair
import androidx.lifecycle.LiveData
import com.todoroo.astrid.data.Task
import org.tasks.filters.TagFilters
import org.tasks.time.DateTimeUtils.currentTimeMillis
import javax.inject.Inject
@Deprecated("use coroutines")
@ -33,26 +30,14 @@ class TagDataDaoBlocking @Inject constructor(val dao: TagDataDao) {
dao.getByUuid(uuid)
}
fun getByUuid(uuids: Collection<String>): List<TagData> = runBlocking {
dao.getByUuid(uuids)
}
fun tagDataOrderedByName(): List<TagData> = runBlocking {
dao.tagDataOrderedByName()
}
fun deleteTags(tagUid: String) = runBlocking {
dao.deleteTags(tagUid)
}
fun getTagSelections(tasks: List<Long>): Pair<Set<String>, Set<String>> = runBlocking {
dao.getTagSelections(tasks)
}
fun applyTags(tasks: List<Task>, partiallySelected: List<TagData>, selected: List<TagData>): List<Long> = runBlocking {
dao.applyTags(tasks, partiallySelected, selected)
}
fun delete(tagData: TagData) = runBlocking {
dao.delete(tagData)
}
@ -61,10 +46,6 @@ class TagDataDaoBlocking @Inject constructor(val dao: TagDataDao) {
dao.delete(tagData)
}
fun deleteTags(tags: List<Tag>) = runBlocking {
dao.deleteTags(tags)
}
fun getTagDataForTask(id: Long): List<TagData> = runBlocking {
dao.getTagDataForTask(id)
}
@ -77,22 +58,10 @@ class TagDataDaoBlocking @Inject constructor(val dao: TagDataDao) {
dao.update(tagData)
}
fun insert(tag: TagData): Long = runBlocking {
dao.insert(tag)
}
fun insert(tags: Iterable<Tag>) = runBlocking {
dao.insert(tags)
}
fun createNew(tag: TagData) = runBlocking {
dao.createNew(tag)
}
fun getTagFilters(now: Long = currentTimeMillis()): List<TagFilters> = runBlocking {
dao.getTagFilters(now)
}
fun resetOrders() = runBlocking {
dao.resetOrders()
}

@ -27,8 +27,4 @@ class TaskAttachmentDaoBlocking @Inject constructor(private val dao: TaskAttachm
fun update(attachment: TaskAttachment) = runBlocking {
dao.update(attachment)
}
fun createNew(attachment: TaskAttachment) = runBlocking {
dao.createNew(attachment)
}
}

@ -12,15 +12,7 @@ class TaskListMetadataDaoBlocking @Inject constructor(private val dao: TaskListM
dao.getAll()
}
fun update(taskListMetadata: TaskListMetadata) = runBlocking {
dao.update(taskListMetadata)
}
fun insert(taskListMetadata: TaskListMetadata): Long = runBlocking {
dao.insert(taskListMetadata)
}
fun createNew(taskListMetadata: TaskListMetadata) = runBlocking {
dao.createNew(taskListMetadata)
}
}
Loading…
Cancel
Save