From d3421bd0c35cbd0a1a7df1fc4ff91f8610d65e59 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sat, 13 Jul 2024 01:38:43 -0500 Subject: [PATCH] Use platform sqlite library again --- app/build.gradle.kts | 1 - .../org/tasks/data/ContentProviderDaoBlocking.kt | 2 +- .../java/org/tasks/injection/ProductionModule.kt | 2 -- .../org/tasks/data/SQLiteStatementExtensions.kt | 2 +- deps_fdroid.txt | 12 ++---------- deps_googleplay.txt | 12 ++---------- gradle/libs.versions.toml | 1 - 7 files changed, 6 insertions(+), 26 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d754c67e8..698a9381c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -184,7 +184,6 @@ 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/main/java/org/tasks/data/ContentProviderDaoBlocking.kt b/app/src/main/java/org/tasks/data/ContentProviderDaoBlocking.kt index 7c51801ac..33f29ab19 100644 --- a/app/src/main/java/org/tasks/data/ContentProviderDaoBlocking.kt +++ b/app/src/main/java/org/tasks/data/ContentProviderDaoBlocking.kt @@ -43,7 +43,7 @@ class ContentProviderDaoBlocking @Inject constructor( private fun SQLiteStatement.toCursor(): Cursor { val cursor = MatrixCursor(getColumnNames().toTypedArray()) while (step()) { - cursor.addRow((0 until getColumnCount()).map { getText(it) }) + cursor.addRow((0 until getColumnCount()).map { getTextOrNull(it) }) } return cursor } diff --git a/app/src/main/java/org/tasks/injection/ProductionModule.kt b/app/src/main/java/org/tasks/injection/ProductionModule.kt index e0b78462b..be71da63f 100644 --- a/app/src/main/java/org/tasks/injection/ProductionModule.kt +++ b/app/src/main/java/org/tasks/injection/ProductionModule.kt @@ -2,7 +2,6 @@ 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 @@ -39,7 +38,6 @@ internal class ProductionModule { name = databaseFile.absolutePath ) .setQueryCoroutineContext(Dispatchers.IO) - .setDriver(BundledSQLiteDriver()) .addMigrations(*Migrations.migrations(context, fileStorage)) if (!BuildConfig.DEBUG || !preferences.getBoolean(R.string.p_crash_main_queries, false)) { builder.allowMainThreadQueries() diff --git a/data/src/commonMain/kotlin/org/tasks/data/SQLiteStatementExtensions.kt b/data/src/commonMain/kotlin/org/tasks/data/SQLiteStatementExtensions.kt index 22be21cd0..bdff328fe 100644 --- a/data/src/commonMain/kotlin/org/tasks/data/SQLiteStatementExtensions.kt +++ b/data/src/commonMain/kotlin/org/tasks/data/SQLiteStatementExtensions.kt @@ -163,7 +163,7 @@ fun SQLiteStatement.getTasks(): List { return result } -private fun SQLiteStatement.getTextOrNull(index: Int): String? = +fun SQLiteStatement.getTextOrNull(index: Int): String? = if (index == -1 || isNull(index)) null else this.getText(index) private fun SQLiteStatement.getLongOrNull(index: Int): Long? = diff --git a/deps_fdroid.txt b/deps_fdroid.txt index 9f5ec0523..0773043f9 100644 --- a/deps_fdroid.txt +++ b/deps_fdroid.txt @@ -242,15 +242,13 @@ +| | | \--- androidx.sqlite:sqlite-android:2.5.0-alpha05 +| | | +--- androidx.annotation:annotation:1.8.0 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) -+| | | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 (c) -+| | | \--- androidx.sqlite:sqlite-bundled:2.5.0-alpha05 (c) ++| | | \--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 (c) +| | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 +| | | \--- androidx.sqlite:sqlite-framework-android:2.5.0-alpha05 +| | | +--- androidx.annotation:annotation:1.8.0 (*) +| | | +--- androidx.sqlite:sqlite:2.5.0-alpha05 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) -+| | | +--- androidx.sqlite:sqlite:2.5.0-alpha05 (c) -+| | | \--- androidx.sqlite:sqlite-bundled:2.5.0-alpha05 (c) ++| | | \--- androidx.sqlite:sqlite:2.5.0-alpha05 (c) +| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) +| | +--- org.jetbrains.kotlinx:atomicfu:0.17.0 +| | | \--- org.jetbrains.kotlinx:atomicfu-jvm:0.17.0 @@ -971,12 +969,6 @@ +| \--- androidx.lifecycle:lifecycle-common-java8:2.8.3 (c) ++--- androidx.lifecycle:lifecycle-viewmodel:2.8.3 (*) ++--- androidx.room:room-runtime:2.7.0-alpha05 (*) -++--- androidx.sqlite:sqlite-bundled:2.5.0-alpha05 -+| \--- androidx.sqlite:sqlite-bundled-android:2.5.0-alpha05 -+| +--- androidx.sqlite:sqlite:2.5.0-alpha05 (*) -+| +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) -+| +--- androidx.sqlite:sqlite:2.5.0-alpha05 (c) -+| \--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 (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 c70b86110..24c8fa623 100644 --- a/deps_googleplay.txt +++ b/deps_googleplay.txt @@ -648,15 +648,13 @@ +| | | \--- androidx.sqlite:sqlite-android:2.5.0-alpha05 +| | | +--- androidx.annotation:annotation:1.8.0 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) -+| | | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 (c) -+| | | \--- androidx.sqlite:sqlite-bundled:2.5.0-alpha05 (c) ++| | | \--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 (c) +| | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 +| | | \--- androidx.sqlite:sqlite-framework-android:2.5.0-alpha05 +| | | +--- androidx.annotation:annotation:1.8.0 (*) +| | | +--- androidx.sqlite:sqlite:2.5.0-alpha05 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) -+| | | +--- androidx.sqlite:sqlite:2.5.0-alpha05 (c) -+| | | \--- androidx.sqlite:sqlite-bundled:2.5.0-alpha05 (c) ++| | | \--- androidx.sqlite:sqlite:2.5.0-alpha05 (c) +| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) +| | +--- org.jetbrains.kotlinx:atomicfu:0.17.0 +| | | \--- org.jetbrains.kotlinx:atomicfu-jvm:0.17.0 @@ -1195,12 +1193,6 @@ +| \--- androidx.lifecycle:lifecycle-common-java8:2.8.3 (c) ++--- androidx.lifecycle:lifecycle-viewmodel:2.8.3 (*) ++--- androidx.room:room-runtime:2.7.0-alpha05 (*) -++--- androidx.sqlite:sqlite-bundled:2.5.0-alpha05 -+| \--- androidx.sqlite:sqlite-bundled-android:2.5.0-alpha05 -+| +--- androidx.sqlite:sqlite:2.5.0-alpha05 (*) -+| +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 2.0.0 (*) -+| +--- androidx.sqlite:sqlite:2.5.0-alpha05 (c) -+| \--- androidx.sqlite:sqlite-framework:2.5.0-alpha05 (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 bde6160f7..41db2ada3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -85,7 +85,6 @@ 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-alpha05" } 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" }