mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
chore(db): Remove StorIO related stuff
This commit is contained in:
parent
844a83b4e1
commit
a940722f2b
5 changed files with 1 additions and 31 deletions
|
@ -212,10 +212,6 @@ dependencies {
|
||||||
// Database
|
// Database
|
||||||
implementation(libs.sqlite.android)
|
implementation(libs.sqlite.android)
|
||||||
implementation(libs.bundles.sqlite)
|
implementation(libs.bundles.sqlite)
|
||||||
//noinspection UseTomlInstead
|
|
||||||
implementation("com.github.inorichi.storio:storio-common:8be19de@aar")
|
|
||||||
//noinspection UseTomlInstead
|
|
||||||
implementation("com.github.inorichi.storio:storio-sqlite:8be19de@aar")
|
|
||||||
|
|
||||||
// Model View Presenter
|
// Model View Presenter
|
||||||
implementation(libs.conductor)
|
implementation(libs.conductor)
|
||||||
|
|
|
@ -12,14 +12,12 @@ class CategoriesBackupRestorer(
|
||||||
) {
|
) {
|
||||||
suspend fun restoreCategories(backupCategories: List<BackupCategory>, onComplete: () -> Unit) {
|
suspend fun restoreCategories(backupCategories: List<BackupCategory>, onComplete: () -> Unit) {
|
||||||
// Get categories from file and from db
|
// Get categories from file and from db
|
||||||
// Do it outside of transaction because StorIO might hang because we're using SQLDelight
|
|
||||||
val dbCategories = getCategories.await()
|
|
||||||
handler.await(true) {
|
handler.await(true) {
|
||||||
// Iterate over them
|
// Iterate over them
|
||||||
backupCategories.map { it.getCategoryImpl() }.forEach { category ->
|
backupCategories.map { it.getCategoryImpl() }.forEach { category ->
|
||||||
// Used to know if the category is already in the db
|
// Used to know if the category is already in the db
|
||||||
var found = false
|
var found = false
|
||||||
for (dbCategory in dbCategories) {
|
for (dbCategory in getCategories.await()) {
|
||||||
// If the category is already in the db, assign the id to the file's category
|
// If the category is already in the db, assign the id to the file's category
|
||||||
// and do nothing
|
// and do nothing
|
||||||
if (category.name == dbCategory.name) {
|
if (category.name == dbCategory.name) {
|
||||||
|
|
|
@ -3,12 +3,6 @@ FIXME: Delete `search_metadata` from sqldelight migration
|
||||||
|
|
||||||
package eu.kanade.tachiyomi.data.database.queries
|
package eu.kanade.tachiyomi.data.database.queries
|
||||||
|
|
||||||
import com.pushtorefresh.storio.sqlite.queries.DeleteQuery
|
|
||||||
import com.pushtorefresh.storio.sqlite.queries.Query
|
|
||||||
import eu.kanade.tachiyomi.data.database.DbProvider
|
|
||||||
import eu.kanade.tachiyomi.data.database.models.SearchMetadata
|
|
||||||
import eu.kanade.tachiyomi.data.database.tables.SearchMetadataTable
|
|
||||||
|
|
||||||
interface SearchMetadataQueries : DbProvider {
|
interface SearchMetadataQueries : DbProvider {
|
||||||
|
|
||||||
fun getSearchMetadataForManga(mangaId: Long) = db.get()
|
fun getSearchMetadataForManga(mangaId: Long) = db.get()
|
||||||
|
|
|
@ -133,7 +133,6 @@ class MigrationProcessAdapter(
|
||||||
sourceFinished()
|
sourceFinished()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Migrate to SQLDelight, on halt: in StorIO transaction
|
|
||||||
private suspend fun migrateMangaInternal(
|
private suspend fun migrateMangaInternal(
|
||||||
prevSource: Source?,
|
prevSource: Source?,
|
||||||
source: Source,
|
source: Source,
|
||||||
|
@ -158,7 +157,6 @@ class MigrationProcessAdapter(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
// FIXME: Migrate to SQLDelight, on halt: in StorIO transaction
|
|
||||||
suspend fun migrateMangaInternal(
|
suspend fun migrateMangaInternal(
|
||||||
flags: Int,
|
flags: Int,
|
||||||
enhancedServices: List<EnhancedTrackService>,
|
enhancedServices: List<EnhancedTrackService>,
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package eu.kanade.tachiyomi.util.system
|
|
||||||
|
|
||||||
import com.pushtorefresh.storio.sqlite.operations.get.PreparedGetListOfObjects
|
|
||||||
import com.pushtorefresh.storio.sqlite.operations.get.PreparedGetObject
|
|
||||||
import com.pushtorefresh.storio.sqlite.operations.put.PreparedPutCollectionOfObjects
|
|
||||||
import com.pushtorefresh.storio.sqlite.operations.put.PreparedPutObject
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
suspend fun <T> PreparedGetListOfObjects<T>.executeOnIO(): List<T> = withContext(Dispatchers.IO) { executeAsBlocking() }
|
|
||||||
|
|
||||||
suspend fun <T> PreparedGetObject<T>.executeOnIO(): T? = withContext(Dispatchers.IO) { executeAsBlocking() }
|
|
||||||
|
|
||||||
suspend fun <T> PreparedPutObject<T>.executeOnIO() = withContext(Dispatchers.IO) { executeAsBlocking() }
|
|
||||||
|
|
||||||
suspend fun <T> PreparedPutCollectionOfObjects<T>.executeOnIO() = withContext(Dispatchers.IO) { executeAsBlocking() }
|
|
Loading…
Add table
Add a link
Reference in a new issue