mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 06:31:52 +01:00
Use Requery to enhance SQLite (#7260)
This commit is contained in:
parent
e3f8aedd5a
commit
161c8bcf9e
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi
|
||||
|
||||
import android.app.Application
|
||||
import android.os.Build
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper
|
||||
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
|
||||
@ -24,6 +25,7 @@ import eu.kanade.tachiyomi.data.track.job.DelayedTrackingStore
|
||||
import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory
|
||||
import kotlinx.serialization.json.Json
|
||||
import uy.kohesive.injekt.api.InjektModule
|
||||
import uy.kohesive.injekt.api.InjektRegistrar
|
||||
@ -38,13 +40,18 @@ class AppModule(val app: Application) : InjektModule {
|
||||
|
||||
// This is used to allow incremental migration from Storio
|
||||
addSingletonFactory<SupportSQLiteOpenHelper> {
|
||||
FrameworkSQLiteOpenHelperFactory().create(
|
||||
SupportSQLiteOpenHelper.Configuration.builder(app)
|
||||
.callback(DbOpenCallback())
|
||||
.name(DbOpenCallback.DATABASE_NAME)
|
||||
.noBackupDirectory(false)
|
||||
.build(),
|
||||
)
|
||||
val configuration = SupportSQLiteOpenHelper.Configuration.builder(app)
|
||||
.callback(DbOpenCallback())
|
||||
.name(DbOpenCallback.DATABASE_NAME)
|
||||
.noBackupDirectory(false)
|
||||
.build()
|
||||
|
||||
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// Support database inspector in Android Studio
|
||||
FrameworkSQLiteOpenHelperFactory().create(configuration)
|
||||
} else {
|
||||
RequerySQLiteOpenHelperFactory().create(configuration)
|
||||
}
|
||||
}
|
||||
|
||||
addSingletonFactory<SqlDriver> {
|
||||
|
Loading…
Reference in New Issue
Block a user