Compare commits

..

3 commits

Author SHA1 Message Date
abbe606473
revert: "refactor: Replace Requery's SQLite with AndroidX's new KMP SQLite"
Some checks are pending
Build app / Build app (push) Waiting to run
Mirror Repository / mirror (push) Waiting to run
This reverts commit f604e4e256.
2025-06-01 18:05:35 +07:00
7ac42d5545
docs: Sync changelog 2025-06-01 16:44:45 +07:00
renovate[bot]
f90e2a1425
fix(deps): Update dependency io.github.pdvrieze.xmlutil:core-android to v0.91.1 (#440)
* fix(deps): Update dependency io.github.pdvrieze.xmlutil:core-android to v0.91.1

* fix: Fix build

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ahmad Ansori Palembani <palembani@gmail.com>
2025-06-01 16:43:59 +07:00
6 changed files with 63 additions and 40 deletions

View file

@ -49,7 +49,6 @@ The format is simplified version of [Keep a Changelog](https://keepachangelog.co
- Refactor Library to store LibraryMap instead of flatten list of LibraryItem
- LibraryItem abstraction to make it easier to manage
- LibraryManga no longer extend MangaImpl
- Replace Requery's SQLite with AndroidX's new KMP SQLite
- Update dependency gradle to v8.12
- Update user agent (@Hiirbaf)
- Update serialization to v1.8.1
@ -66,7 +65,8 @@ The format is simplified version of [Keep a Changelog](https://keepachangelog.co
- Update dependency com.getkeepsafe.taptargetview:taptargetview to v1.15.0
- Update dependency androidx.window:window to v1.4.0
- Update dependency androidx.webkit:webkit to v1.13.0
- Update androidxSqlite to v2.5.1
- Update dependency androidx.sqlite:sqlite-ktx to v2.5.1
- Update dependency androidx.sqlite:sqlite to v2.5.1
- Update dependency androidx.recyclerview:recyclerview to v1.4.0
- Update dependency androidx.core:core-ktx to v1.16.0
- Update dependency androidx.compose:compose-bom to v2025.05.01
@ -84,6 +84,7 @@ The format is simplified version of [Keep a Changelog](https://keepachangelog.co
- Update dependency androidx.constraintlayout:constraintlayout to v2.2.1
- Update plugin firebase-crashlytics to v3.0.3
- Update null2264/actions digest to 363cb9c
- Update dependency io.github.pdvrieze.xmlutil:core-android to v0.91.1
## [1.9.7.2]

View file

@ -200,6 +200,7 @@ dependencies {
implementation(libs.play.services.gcm)
// Database
implementation(libs.sqlite.android)
implementation(libs.bundles.sqlite)
// Model View Presenter

View file

@ -2,19 +2,12 @@ package yokai.core.di
import android.app.Application
import androidx.core.content.ContextCompat
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.driver.bundled.SQLITE_OPEN_CREATE
import androidx.sqlite.driver.bundled.SQLITE_OPEN_READWRITE
import androidx.sqlite.db.SupportSQLiteDatabase
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.android.AndroidSqliteDriver
import co.touchlab.kermit.Logger
import com.chuckerteam.chucker.api.ChuckerCollector
import com.chuckerteam.chucker.api.ChuckerInterceptor
import com.eygraber.sqldelight.androidx.driver.AndroidxSqliteConfiguration
import com.eygraber.sqldelight.androidx.driver.AndroidxSqliteDatabaseType
import com.eygraber.sqldelight.androidx.driver.AndroidxSqliteDriver
import com.eygraber.sqldelight.androidx.driver.File
import com.eygraber.sqldelight.androidx.driver.SqliteJournalMode
import com.eygraber.sqldelight.androidx.driver.SqliteSync
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.core.storage.AndroidStorageFolderProvider
import eu.kanade.tachiyomi.data.cache.ChapterCache
@ -30,6 +23,7 @@ import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.util.chapter.ChapterFilter
import eu.kanade.tachiyomi.util.manga.MangaShortcutManager
import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory
import kotlinx.serialization.json.Json
import kotlinx.serialization.protobuf.ProtoBuf
import nl.adaptivity.xmlutil.XmlDeclMode
@ -48,23 +42,46 @@ fun appModule(app: Application) = module {
single { app }
single<SqlDriver> {
AndroidxSqliteDriver(
createConnection = { name ->
BundledSQLiteDriver().open(name, SQLITE_OPEN_READWRITE or SQLITE_OPEN_CREATE)
},
databaseType = AndroidxSqliteDatabaseType.File(app, "tachiyomi.db"),
configuration = AndroidxSqliteConfiguration().apply {
isForeignKeyConstraintsEnabled = true
journalMode = SqliteJournalMode.WAL
sync = SqliteSync.Normal
},
AndroidSqliteDriver(
schema = Database.Schema,
onCreate = {
Logger.d { "Creating new database..." }
},
onUpdate = { oldVersion, newVersion ->
if (oldVersion < newVersion) {
Logger.d { "Upgrading database from $oldVersion to $newVersion" }
context = app,
name = "tachiyomi.db",
// factory = if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// // Support database inspector in Android Studio
// FrameworkSQLiteOpenHelperFactory()
// } else {
// RequerySQLiteOpenHelperFactory()
// },
factory = RequerySQLiteOpenHelperFactory(),
callback = object : AndroidSqliteDriver.Callback(Database.Schema) {
override fun onOpen(db: SupportSQLiteDatabase) {
super.onOpen(db)
setPragma(db, "foreign_keys = ON")
setPragma(db, "journal_mode = WAL")
setPragma(db, "synchronous = NORMAL")
}
private fun setPragma(db: SupportSQLiteDatabase, pragma: String) {
val cursor = db.query("PRAGMA $pragma")
cursor.moveToFirst()
cursor.close()
}
// Not sure if this is still needed, but just in case
override fun onConfigure(db: SupportSQLiteDatabase) {
db.setForeignKeyConstraintsEnabled(true)
}
override fun onCreate(db: SupportSQLiteDatabase) {
Logger.d { "Creating new database..." }
super.onCreate(db)
}
override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) {
if (oldVersion < newVersion) {
Logger.d { "Upgrading database from $oldVersion to $newVersion" }
super.onUpgrade(db, oldVersion, newVersion)
}
}
},
)

View file

@ -28,6 +28,7 @@ multidex = { module = "androidx.multidex:multidex", version = "2.0.1" }
palette = { module = "androidx.palette:palette", version = "1.0.0" }
preference = { module = "androidx.preference:preference-ktx", version = "1.2.1" }
recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.4.0" }
sqlite = { module = "androidx.sqlite:sqlite", version = "2.5.1" }
webkit = { module = "androidx.webkit:webkit", version = "1.13.0" }
work = { module = "androidx.work:work-runtime-ktx", version = "2.10.1" }
window = { module = "androidx.window:window", version = "1.4.0" }
@ -37,7 +38,7 @@ androidx = [
"activity", "activity-compose", "annotation", "appcompat", "browser", "biometric", "cardview", "core",
"core-splashscreen", "layout-constraint", "glance-appwidget", "lifecycle-common", "lifecycle-livedata",
"lifecycle-process", "lifecycle-runtime", "lifecycle-viewmodel", "lifecycle-viewmodel-compose", "multidex",
"palette", "preference", "recyclerview", "layout-swiperefresh", "webkit", "work", "window"
"palette", "preference", "recyclerview", "sqlite", "layout-swiperefresh", "webkit", "work", "window"
]
[plugins]

View file

@ -1,7 +1,7 @@
[versions]
kotlin = "2.1.21"
serialization = "1.8.1"
xml_serialization = "0.90.3"
xml_serialization = "0.91.1"
[libraries]
gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
@ -15,7 +15,7 @@ serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-jso
serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "serialization" }
serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization" }
serialization-xml-core = { module = "io.github.pdvrieze.xmlutil:core-android", version.ref = "xml_serialization" }
serialization-xml = { module = "io.github.pdvrieze.xmlutil:serialization-android", version.ref = "xml_serialization" }
serialization-xml = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xml_serialization" }
immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version = "0.4.0" }
[bundles]

View file

@ -6,9 +6,9 @@ fast_adapter = "5.7.0"
moko = "0.24.5"
okhttp = "5.0.0-alpha.16"
shizuku = "13.1.5"
androidxSqlite = "2.5.1"
# FIXME: Stay at 2.0.2 until 2.1.1 released because dialect is borked
# REF: https://github.com/sqldelight/sqldelight/issues/5758
# FIXME: Uncomment once SQLDelight support KMP AndroidX SQLiteDriver
#sqlite = "2.5.0-alpha04"
sqlite = "2.5.1"
sqldelight = "2.0.2"
junit = "5.11.3"
kermit = "2.0.5"
@ -82,12 +82,13 @@ rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" }
rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" }
slice = { module = "com.github.mthli:Slice", version = "v1.2" }
# SQLite interface
sqlite = { module = "androidx.sqlite:sqlite", version.ref = "androidxSqlite" }
sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "androidxSqlite" }
# FIXME: Uncomment once SQLDelight support KMP AndroidX SQLiteDriver
#sqlite = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqlite" }
sqlite-ktx = { module = "androidx.sqlite:sqlite-ktx", version.ref = "sqlite" }
sqlite-android = { module = "com.github.requery:sqlite-android", version = "3.49.0" }
sqldelight-coroutines = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "sqldelight" }
sqldelight-androidx-driver = { module = "com.eygraber:sqldelight-androidx-driver", version = "0.0.12" }
sqldelight-android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
sqldelight-android-paging = { module = "app.cash.sqldelight:androidx-paging3-extensions", version.ref = "sqldelight" }
sqldelight-dialects-sql = { module = "app.cash.sqldelight:sqlite-3-38-dialect", version.ref = "sqldelight" }
@ -113,11 +114,13 @@ moko = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko"
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
[bundles]
db = [ "sqldelight-coroutines", "sqldelight-androidx-driver" ]
db-android = [ "sqldelight-android-paging" ]
db = [ "sqldelight-coroutines" ]
db-android = [ "sqldelight-android-driver", "sqldelight-android-paging" ]
coil = [ "coil3", "coil3-svg", "coil3-gif", "coil3-okhttp" ]
logging = [ "kermit" ]
sqlite = [ "sqlite", "sqlite-bundled" ]
# FIXME: Uncomment once SQLDelight support KMP AndroidX SQLiteDriver
#sqlite = [ "sqlite", "sqlite-ktx" ]
sqlite = [ "sqlite-ktx" ]
test = [ "junit-api", "kotest-assertions", "mockk" ]
test-android = [ "junit-android" ]
test-runtime = [ "junit-engine" ]