diff --git a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt index 515df53a48..2a65241e96 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/AppModule.kt @@ -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 { - 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 {