From 212a4b0a3d519edcaec18f236f27fcff2ff1d1aa Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 28 May 2024 23:10:04 -0500 Subject: [PATCH] Delete transaction check This was using platform sqlite --- app/src/main/java/com/todoroo/astrid/service/TaskDeleter.kt | 5 ----- .../kotlin/org/tasks/data/RoomDatabaseExtensions.kt | 2 -- 2 files changed, 7 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/service/TaskDeleter.kt b/app/src/main/java/com/todoroo/astrid/service/TaskDeleter.kt index b8faa5abd..215964029 100644 --- a/app/src/main/java/com/todoroo/astrid/service/TaskDeleter.kt +++ b/app/src/main/java/com/todoroo/astrid/service/TaskDeleter.kt @@ -4,7 +4,6 @@ import android.content.Context import dagger.hilt.android.qualifiers.ApplicationContext import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.withContext -import org.tasks.BuildConfig import org.tasks.LocalBroadcastManager import org.tasks.caldav.VtodoCache import org.tasks.data.dao.DeletionDao @@ -16,7 +15,6 @@ import org.tasks.data.db.SuspendDbUtils.chunkedMap import org.tasks.data.entity.CaldavAccount import org.tasks.data.entity.CaldavCalendar import org.tasks.data.entity.Task -import org.tasks.data.inTransaction import org.tasks.data.pictureUri import org.tasks.data.withTransaction import org.tasks.files.FileHelper @@ -88,9 +86,6 @@ class TaskDeleter @Inject constructor( } private suspend fun cleanup(tasks: List) { - if (BuildConfig.DEBUG && !database.inTransaction()) { - throw IllegalStateException() - } tasks.forEach { task -> notificationManager.cancel(task) locationDao.getGeofencesForTask(task).forEach { diff --git a/data/src/commonMain/kotlin/org/tasks/data/RoomDatabaseExtensions.kt b/data/src/commonMain/kotlin/org/tasks/data/RoomDatabaseExtensions.kt index a8d294e69..17eeecb5f 100644 --- a/data/src/commonMain/kotlin/org/tasks/data/RoomDatabaseExtensions.kt +++ b/data/src/commonMain/kotlin/org/tasks/data/RoomDatabaseExtensions.kt @@ -16,5 +16,3 @@ suspend fun RoomDatabase.withTransaction(block: suspend TransactionScope. suspend fun RoomDatabase.rawQuery(query: String, block: (SQLiteStatement) -> T): T = useReaderConnection { transactor -> transactor.usePrepared(query) { block(it) } } - -suspend fun RoomDatabase.inTransaction(): Boolean = useReaderConnection { it.inTransaction() }