mirror of https://github.com/tasks/tasks
Remove unused blocking dao methods
parent
479c26c416
commit
783f1bde69
@ -0,0 +1,43 @@
|
||||
package org.tasks
|
||||
|
||||
import org.tasks.time.DateTime
|
||||
import org.tasks.time.DateTimeUtils
|
||||
|
||||
class SuspendFreeze {
|
||||
|
||||
suspend fun thawAfter(run: suspend () -> Unit) {
|
||||
try {
|
||||
run.invoke()
|
||||
} finally {
|
||||
thaw()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
suspend fun freezeClock(run: suspend () -> Unit) {
|
||||
freezeAt(DateTimeUtils.currentTimeMillis()).thawAfter(run)
|
||||
}
|
||||
|
||||
suspend fun freezeAt(dateTime: DateTime, run: suspend () -> Unit) {
|
||||
freezeAt(dateTime.millis, run)
|
||||
}
|
||||
|
||||
suspend fun freezeAt(timestamp: Long, run: suspend () -> Unit) {
|
||||
freezeAt(timestamp).thawAfter(run)
|
||||
}
|
||||
|
||||
fun freezeAt(dateTime: DateTime): SuspendFreeze {
|
||||
return freezeAt(dateTime.millis)
|
||||
}
|
||||
|
||||
fun freezeAt(millis: Long): SuspendFreeze {
|
||||
DateTimeUtils.setCurrentMillisFixed(millis)
|
||||
return SuspendFreeze()
|
||||
}
|
||||
|
||||
fun thaw() {
|
||||
DateTimeUtils.setCurrentMillisSystem()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package org.tasks.data
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
@Deprecated("use coroutines")
|
||||
class DeletionDaoBlocking @Inject constructor(private val dao: DeletionDao) {
|
||||
fun delete(ids: List<Long>) = runBlocking {
|
||||
dao.delete(ids)
|
||||
}
|
||||
|
||||
fun markDeleted(ids: Iterable<Long>) = runBlocking {
|
||||
dao.markDeleted(ids)
|
||||
}
|
||||
|
||||
fun delete(googleTaskList: GoogleTaskList): List<Long> = runBlocking {
|
||||
dao.delete(googleTaskList)
|
||||
}
|
||||
|
||||
fun delete(googleTaskAccount: GoogleTaskAccount): List<Long> = runBlocking {
|
||||
dao.delete(googleTaskAccount)
|
||||
}
|
||||
|
||||
fun delete(caldavCalendar: CaldavCalendar): List<Long> = runBlocking {
|
||||
dao.delete(caldavCalendar)
|
||||
}
|
||||
|
||||
fun purgeDeleted() = runBlocking {
|
||||
dao.purgeDeleted()
|
||||
}
|
||||
|
||||
fun delete(caldavAccount: CaldavAccount): List<Long> = runBlocking {
|
||||
dao.delete(caldavAccount)
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package org.tasks.data
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
@Deprecated("use coroutines")
|
||||
class FilterDaoBlocking @Inject constructor(private val dao: FilterDao) {
|
||||
fun update(filter: Filter) = runBlocking {
|
||||
dao.update(filter)
|
||||
}
|
||||
|
||||
fun delete(id: Long) = runBlocking {
|
||||
dao.delete(id)
|
||||
}
|
||||
|
||||
fun getByName(title: String): Filter? = runBlocking {
|
||||
dao.getByName(title)
|
||||
}
|
||||
|
||||
fun insert(filter: Filter): Long = runBlocking {
|
||||
dao.insert(filter)
|
||||
}
|
||||
|
||||
fun getFilters(): List<Filter> = runBlocking {
|
||||
dao.getFilters()
|
||||
}
|
||||
|
||||
fun getAll(): List<Filter> = runBlocking {
|
||||
dao.getAll()
|
||||
}
|
||||
|
||||
fun resetOrders() = runBlocking {
|
||||
dao.resetOrders()
|
||||
}
|
||||
|
||||
fun setOrder(id: Long, order: Int) = runBlocking {
|
||||
dao.setOrder(id, order)
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package org.tasks.data
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
@Deprecated("use coroutines")
|
||||
class TaskAttachmentDaoBlocking @Inject constructor(private val dao: TaskAttachmentDao) {
|
||||
fun getAttachments(taskUuid: String): List<TaskAttachment> = runBlocking {
|
||||
dao.getAttachments(taskUuid)
|
||||
}
|
||||
|
||||
fun getAttachments(task: Long): List<TaskAttachment> = runBlocking {
|
||||
dao.getAttachments(task)
|
||||
}
|
||||
|
||||
fun getAttachments(): List<TaskAttachment> = runBlocking {
|
||||
dao.getAttachments()
|
||||
}
|
||||
|
||||
fun delete(taskAttachment: TaskAttachment) = runBlocking {
|
||||
dao.delete(taskAttachment)
|
||||
}
|
||||
|
||||
fun insert(attachment: TaskAttachment) = runBlocking {
|
||||
dao.insert(attachment)
|
||||
}
|
||||
|
||||
fun update(attachment: TaskAttachment) = runBlocking {
|
||||
dao.update(attachment)
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package org.tasks.data
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
@Deprecated("use coroutines")
|
||||
class TaskListMetadataDaoBlocking @Inject constructor(private val dao: TaskListMetadataDao) {
|
||||
fun fetchByTagOrFilter(tagUuid: String): TaskListMetadata? = runBlocking {
|
||||
dao.fetchByTagOrFilter(tagUuid)
|
||||
}
|
||||
|
||||
fun getAll(): List<TaskListMetadata> = runBlocking {
|
||||
dao.getAll()
|
||||
}
|
||||
|
||||
fun insert(taskListMetadata: TaskListMetadata): Long = runBlocking {
|
||||
dao.insert(taskListMetadata)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue