diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c55826180..ffa74becc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -184,6 +184,7 @@ dependencies { implementation(libs.androidx.lifecycle.runtime.compose) implementation(libs.androidx.lifecycle.viewmodel) implementation(libs.androidx.room) + implementation(libs.androidx.sqlite) implementation(libs.androidx.appcompat) implementation(libs.iconics) implementation(libs.markwon) diff --git a/app/src/androidTest/java/org/tasks/injection/TestModule.kt b/app/src/androidTest/java/org/tasks/injection/TestModule.kt index 148e3b8d9..b5b19d07d 100644 --- a/app/src/androidTest/java/org/tasks/injection/TestModule.kt +++ b/app/src/androidTest/java/org/tasks/injection/TestModule.kt @@ -2,6 +2,7 @@ package org.tasks.injection import android.content.Context import androidx.room.Room +import androidx.sqlite.driver.bundled.BundledSQLiteDriver import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -25,6 +26,7 @@ class TestModule { @Singleton fun getDatabase(@ApplicationContext context: Context): Database { return Room.inMemoryDatabaseBuilder(context, Database::class.java) + .setDriver(BundledSQLiteDriver()) .fallbackToDestructiveMigration(dropAllTables = true) .build() } diff --git a/app/src/main/java/org/tasks/injection/ProductionModule.kt b/app/src/main/java/org/tasks/injection/ProductionModule.kt index efe71de18..3e249d830 100644 --- a/app/src/main/java/org/tasks/injection/ProductionModule.kt +++ b/app/src/main/java/org/tasks/injection/ProductionModule.kt @@ -2,11 +2,16 @@ package org.tasks.injection import android.content.Context import androidx.room.Room +import androidx.room.RoomDatabase +import androidx.sqlite.SQLiteConnection +import androidx.sqlite.driver.bundled.BundledSQLiteDriver +import androidx.sqlite.execSQL import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent +import kotlinx.coroutines.Dispatchers import org.tasks.BuildConfig import org.tasks.R import org.tasks.caldav.FileStorage @@ -36,6 +41,15 @@ internal class ProductionModule { context = context, name = databaseFile.absolutePath ) + .setDriver(BundledSQLiteDriver()) + .setQueryCoroutineContext(Dispatchers.IO) + .addCallback(object : RoomDatabase.Callback() { + override fun onOpen(connection: SQLiteConnection) { + super.onOpen(connection) + + connection.execSQL("PRAGMA busy_timeout = 30000") + } + }) .addMigrations(*Migrations.migrations(context, fileStorage)) if (!BuildConfig.DEBUG || !preferences.getBoolean(R.string.p_crash_main_queries, false)) { builder.allowMainThreadQueries() diff --git a/deps_fdroid.txt b/deps_fdroid.txt index 3a0b34292..0d7d599dc 100644 --- a/deps_fdroid.txt +++ b/deps_fdroid.txt @@ -247,6 +247,7 @@ +| | | +--- androidx.annotation:annotation:1.8.1 -> 1.9.1 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) +| | | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c) ++| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c) +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c) +| | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 +| | | \--- androidx.sqlite:sqlite-framework-android:2.5.0-alpha13 @@ -254,6 +255,7 @@ +| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) +| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c) ++| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c) +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c) +| | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) +| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 -> 1.9.0 (*) @@ -1172,6 +1174,13 @@ ++--- androidx.lifecycle:lifecycle-runtime-compose:2.8.7 (*) ++--- androidx.lifecycle:lifecycle-viewmodel:2.8.7 (*) ++--- androidx.room:room-runtime:2.7.0-alpha13 (*) +++--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 ++| \--- androidx.sqlite:sqlite-bundled-android:2.5.0-alpha13 ++| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*) ++| +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) ++| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c) ++| +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c) ++| \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c) ++--- androidx.appcompat:appcompat:1.7.0 (*) ++--- com.mikepenz:iconics-core:5.5.0-b01 (*) ++--- io.noties.markwon:core:4.6.2 diff --git a/deps_googleplay.txt b/deps_googleplay.txt index 6a1ad0cd4..07fc6ff64 100644 --- a/deps_googleplay.txt +++ b/deps_googleplay.txt @@ -808,6 +808,7 @@ +| | | +--- androidx.annotation:annotation:1.8.1 -> 1.9.1 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) +| | | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c) ++| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c) +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c) +| | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 +| | | \--- androidx.sqlite:sqlite-framework-android:2.5.0-alpha13 @@ -815,6 +816,7 @@ +| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) +| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c) ++| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c) +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c) +| | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) +| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 -> 1.9.0 (*) @@ -1521,6 +1523,13 @@ ++--- androidx.lifecycle:lifecycle-runtime-compose:2.8.7 (*) ++--- androidx.lifecycle:lifecycle-viewmodel:2.8.7 (*) ++--- androidx.room:room-runtime:2.7.0-alpha13 (*) +++--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 ++| \--- androidx.sqlite:sqlite-bundled-android:2.5.0-alpha13 ++| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*) ++| +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*) ++| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c) ++| +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c) ++| \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c) ++--- androidx.appcompat:appcompat:1.7.0 (*) ++--- com.mikepenz:iconics-core:5.5.0-b01 (*) ++--- io.noties.markwon:core:4.6.2 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6122c7a14..9e31b91e9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -90,6 +90,7 @@ androidx-preference = { module = "androidx.preference:preference", version.ref = androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" } androidx-room = { module = "androidx.room:room-runtime", version.ref = "room" } androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room"} +androidx-sqlite = { module = "androidx.sqlite:sqlite-bundled", version = "2.5.0-alpha13" } androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "swiperefreshlayout" } androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" } androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" }