From d55006311490e29283d1db99a5125ed927559657 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 7 Jul 2020 15:46:24 -0500 Subject: [PATCH] Remove unused dao methods --- .../com/todoroo/astrid/dao/TaskDaoBlocking.kt | 66 ------------------- .../java/org/tasks/data/AlarmDaoBlocking.kt | 12 ---- .../java/org/tasks/data/CaldavDaoBlocking.kt | 57 ---------------- .../main/java/org/tasks/data/DeletionDao.kt | 2 +- .../org/tasks/data/DeletionDaoBlocking.kt | 12 ---- .../org/tasks/data/GoogleTaskDaoBlocking.kt | 46 ------------- .../tasks/data/GoogleTaskListDaoBlocking.kt | 4 -- .../org/tasks/data/LocationDaoBlocking.kt | 6 -- app/src/main/java/org/tasks/data/TagDao.kt | 2 +- .../java/org/tasks/data/TagDaoBlocking.kt | 4 -- .../main/java/org/tasks/data/TagDataDao.kt | 4 +- .../java/org/tasks/data/TagDataDaoBlocking.kt | 31 --------- .../tasks/data/TaskAttachmentDaoBlocking.kt | 4 -- .../tasks/data/TaskListMetadataDaoBlocking.kt | 8 --- 14 files changed, 4 insertions(+), 254 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/dao/TaskDaoBlocking.kt b/app/src/main/java/com/todoroo/astrid/dao/TaskDaoBlocking.kt index f4d869b91..418ac69b9 100644 --- a/app/src/main/java/com/todoroo/astrid/dao/TaskDaoBlocking.kt +++ b/app/src/main/java/com/todoroo/astrid/dao/TaskDaoBlocking.kt @@ -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): List = runBlocking { dao.fetch(ids) } @@ -49,14 +43,6 @@ class TaskDaoBlocking @Inject constructor(private val dao: TaskDao) { dao.getActiveTasks() } - fun getRecurringTasks(remoteIds: List): List = runBlocking { - dao.getRecurringTasks(remoteIds) - } - - fun setCompletionDate(remoteId: String, completionDate: Long) = runBlocking { - dao.setCompletionDate(remoteId, completionDate) - } - fun snooze(taskIds: List, millis: Long) = runBlocking { dao.snooze(taskIds, millis) } @@ -99,62 +85,18 @@ class TaskDaoBlocking @Inject constructor(private val dao: TaskDao) { } } - fun fetchTasks(callback: (SubtaskInfo) -> List, subtasks: SubtaskInfo): List = runBlocking { - dao.fetchTasks(callback, subtasks) - } - fun fetchTasks(preferences: Preferences, filter: Filter): List = runBlocking { dao.fetchTasks(preferences, filter) } - fun fetchTasks(query: SimpleSQLiteQuery): List = 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 { - return dao.getTaskFactory(query) - } - - fun touch(id: Long) = runBlocking { - dao.touch(id) - } - fun touch(ids: List) = runBlocking { dao.touch(ids) } - fun setParent(parent: Long, tasks: List) = runBlocking { - dao.setParent(parent, tasks) - } - - fun fetchChildren(id: Long): List = runBlocking { - dao.fetchChildren(id) - } - - fun getChildren(id: Long): List = runBlocking { - dao.getChildren(id) - } - fun getChildren(ids: List): List = 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 = runBlocking { dao.fetchFiltered(filter) } - - fun fetchFiltered(queryTemplate: String): List = runBlocking { - dao.fetchFiltered(queryTemplate) - } - - fun getLocalTasks(): List = runBlocking { - dao.getLocalTasks() - } } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/data/AlarmDaoBlocking.kt b/app/src/main/java/org/tasks/data/AlarmDaoBlocking.kt index 5f5fe5028..95053267c 100644 --- a/app/src/main/java/org/tasks/data/AlarmDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/AlarmDaoBlocking.kt @@ -4,22 +4,10 @@ import javax.inject.Inject @Deprecated("use coroutines") class AlarmDaoBlocking @Inject constructor(private val dao: AlarmDao) { - fun getActiveAlarms(): List = runBlocking { - dao.getActiveAlarms() - } - - fun getActiveAlarms(taskId: Long): List = runBlocking { - dao.getActiveAlarms(taskId) - } - fun getAlarms(taskId: Long): List = runBlocking { dao.getAlarms(taskId) } - fun delete(alarm: Alarm) = runBlocking { - dao.delete(alarm) - } - fun insert(alarm: Alarm): Long = runBlocking { dao.insert(alarm) } diff --git a/app/src/main/java/org/tasks/data/CaldavDaoBlocking.kt b/app/src/main/java/org/tasks/data/CaldavDaoBlocking.kt index 9b8ef5a8d..d446e2b08 100644 --- a/app/src/main/java/org/tasks/data/CaldavDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/CaldavDaoBlocking.kt @@ -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) = 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) = runBlocking { dao.update(tasks) } @@ -105,10 +76,6 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) { dao.getDeleted(calendar) } - fun markDeleted(tasks: List, 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): List = runBlocking { - dao.getTasks(taskIds) - } - fun getTasks(): List = 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 = runBlocking { dao.getObjects(calendar) } @@ -169,10 +128,6 @@ class CaldavDaoBlocking @Inject constructor(private val dao: CaldavDao) { dao.getAccountForTask(task) } - fun getCalendars(tasks: List): List = runBlocking { - dao.getCalendars(tasks) - } - fun getCaldavFilters(uuid: String, now: Long = currentTimeMillis()): List = 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) - } } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/data/DeletionDao.kt b/app/src/main/java/org/tasks/data/DeletionDao.kt index 2f95e067e..1e47b50fc 100644 --- a/app/src/main/java/org/tasks/data/DeletionDao.kt +++ b/app/src/main/java/org/tasks/data/DeletionDao.kt @@ -17,7 +17,7 @@ abstract class DeletionDao { internal abstract suspend fun deleteGoogleTasks(ids: List) @Query("DELETE FROM tags WHERE task IN(:ids)") - abstract suspend fun deleteTags(ids: List) + internal abstract suspend fun deleteTags(ids: List) @Query("DELETE FROM geofences WHERE task IN(:ids)") internal abstract suspend fun deleteGeofences(ids: List) diff --git a/app/src/main/java/org/tasks/data/DeletionDaoBlocking.kt b/app/src/main/java/org/tasks/data/DeletionDaoBlocking.kt index 247a24e0f..fa7fea372 100644 --- a/app/src/main/java/org/tasks/data/DeletionDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/DeletionDaoBlocking.kt @@ -4,10 +4,6 @@ import javax.inject.Inject @Deprecated("use coroutines") class DeletionDaoBlocking @Inject constructor(private val dao: DeletionDao) { - fun deleteTags(ids: List) = runBlocking { - dao.deleteTags(ids) - } - fun delete(ids: List) = runBlocking { dao.delete(ids) } @@ -20,10 +16,6 @@ class DeletionDaoBlocking @Inject constructor(private val dao: DeletionDao) { dao.delete(googleTaskList) } - fun getLists(account: String): List = runBlocking { - dao.getLists(account) - } - fun delete(googleTaskAccount: GoogleTaskAccount): List = runBlocking { dao.delete(googleTaskAccount) } @@ -32,10 +24,6 @@ class DeletionDaoBlocking @Inject constructor(private val dao: DeletionDao) { dao.delete(caldavCalendar) } - fun getCalendars(account: String): List = runBlocking { - dao.getCalendars(account) - } - fun purgeDeleted() = runBlocking { dao.purgeDeleted() } diff --git a/app/src/main/java/org/tasks/data/GoogleTaskDaoBlocking.kt b/app/src/main/java/org/tasks/data/GoogleTaskDaoBlocking.kt index 65f8b1b59..778143d32 100644 --- a/app/src/main/java/org/tasks/data/GoogleTaskDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/GoogleTaskDaoBlocking.kt @@ -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) = 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): List = runBlocking { - dao.getLists(tasks) - } - fun getChildren(ids: List): List = runBlocking { dao.getChildren(ids) } - fun getChildTasks(taskId: Long): List = runBlocking { - dao.getChildTasks(taskId) - } - - fun getChildren(id: Long): List = 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 = 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) - } } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/data/GoogleTaskListDaoBlocking.kt b/app/src/main/java/org/tasks/data/GoogleTaskListDaoBlocking.kt index b8b1d3690..b04d1903b 100644 --- a/app/src/main/java/org/tasks/data/GoogleTaskListDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/GoogleTaskListDaoBlocking.kt @@ -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 = runBlocking { dao.getAccounts() } diff --git a/app/src/main/java/org/tasks/data/LocationDaoBlocking.kt b/app/src/main/java/org/tasks/data/LocationDaoBlocking.kt index e1dc6723d..cd75b8d93 100644 --- a/app/src/main/java/org/tasks/data/LocationDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/LocationDaoBlocking.kt @@ -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 = runBlocking { - dao.getPlaceFilters(now) - } - fun resetOrders() = runBlocking { dao.resetOrders() } diff --git a/app/src/main/java/org/tasks/data/TagDao.kt b/app/src/main/java/org/tasks/data/TagDao.kt index 8aa0f9f66..e4ce4f868 100644 --- a/app/src/main/java/org/tasks/data/TagDao.kt +++ b/app/src/main/java/org/tasks/data/TagDao.kt @@ -15,7 +15,7 @@ abstract class TagDao { abstract suspend fun insert(tags: Iterable) @Query("DELETE FROM tags WHERE task = :taskId AND tag_uid in (:tagUids)") - abstract suspend fun deleteTags(taskId: Long, tagUids: List) + internal abstract suspend fun deleteTags(taskId: Long, tagUids: List) @Query("SELECT * FROM tags WHERE tag_uid = :tagUid") abstract suspend fun getByTagUid(tagUid: String): List diff --git a/app/src/main/java/org/tasks/data/TagDaoBlocking.kt b/app/src/main/java/org/tasks/data/TagDaoBlocking.kt index 04c13fe97..35cf3a88f 100644 --- a/app/src/main/java/org/tasks/data/TagDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/TagDaoBlocking.kt @@ -17,10 +17,6 @@ class TagDaoBlocking @Inject constructor(private val dao: TagDao) { dao.insert(tags) } - fun deleteTags(taskId: Long, tagUids: List) = runBlocking { - dao.deleteTags(taskId, tagUids) - } - fun getByTagUid(tagUid: String): List = runBlocking { dao.getByTagUid(tagUid) } diff --git a/app/src/main/java/org/tasks/data/TagDataDao.kt b/app/src/main/java/org/tasks/data/TagDataDao.kt index 4001172e6..8ece20347 100644 --- a/app/src/main/java/org/tasks/data/TagDataDao.kt +++ b/app/src/main/java/org/tasks/data/TagDataDao.kt @@ -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, tagsToKeep: List): List @@ -115,7 +115,7 @@ abstract class TagDataDao { abstract suspend fun delete(tagData: List) @Delete - abstract suspend fun deleteTags(tags: List) + internal abstract suspend fun deleteTags(tags: List) @Query("SELECT tagdata.* FROM tagdata " + "INNER JOIN tags ON tags.tag_uid = tagdata.remoteId " diff --git a/app/src/main/java/org/tasks/data/TagDataDaoBlocking.kt b/app/src/main/java/org/tasks/data/TagDataDaoBlocking.kt index f31c11cab..dd532dc19 100644 --- a/app/src/main/java/org/tasks/data/TagDataDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/TagDataDaoBlocking.kt @@ -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): List = runBlocking { - dao.getByUuid(uuids) - } - fun tagDataOrderedByName(): List = runBlocking { dao.tagDataOrderedByName() } - fun deleteTags(tagUid: String) = runBlocking { - dao.deleteTags(tagUid) - } - fun getTagSelections(tasks: List): Pair, Set> = runBlocking { dao.getTagSelections(tasks) } - fun applyTags(tasks: List, partiallySelected: List, selected: List): List = 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) = runBlocking { - dao.deleteTags(tags) - } - fun getTagDataForTask(id: Long): List = 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) = runBlocking { - dao.insert(tags) - } - fun createNew(tag: TagData) = runBlocking { dao.createNew(tag) } - fun getTagFilters(now: Long = currentTimeMillis()): List = runBlocking { - dao.getTagFilters(now) - } - fun resetOrders() = runBlocking { dao.resetOrders() } diff --git a/app/src/main/java/org/tasks/data/TaskAttachmentDaoBlocking.kt b/app/src/main/java/org/tasks/data/TaskAttachmentDaoBlocking.kt index 02a4e251d..d95102ec6 100644 --- a/app/src/main/java/org/tasks/data/TaskAttachmentDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/TaskAttachmentDaoBlocking.kt @@ -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) - } } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/data/TaskListMetadataDaoBlocking.kt b/app/src/main/java/org/tasks/data/TaskListMetadataDaoBlocking.kt index c8eda708e..d774974b8 100644 --- a/app/src/main/java/org/tasks/data/TaskListMetadataDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/TaskListMetadataDaoBlocking.kt @@ -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) - } } \ No newline at end of file