Fix crashing when creating a backup
This commit is contained in:
parent
f03711e2f7
commit
7e380582a6
@ -4,6 +4,7 @@ import android.content.Context
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
import eu.kanade.data.exh.savedSearchMapper
|
import eu.kanade.data.exh.savedSearchMapper
|
||||||
|
import eu.kanade.tachiyomi.Database
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.backup.AbstractBackupManager
|
import eu.kanade.tachiyomi.data.backup.AbstractBackupManager
|
||||||
import eu.kanade.tachiyomi.data.backup.BackupConst.BACKUP_CATEGORY
|
import eu.kanade.tachiyomi.data.backup.BackupConst.BACKUP_CATEGORY
|
||||||
@ -44,12 +45,13 @@ import exh.source.MERGED_SOURCE_ID
|
|||||||
import exh.source.getMainSource
|
import exh.source.getMainSource
|
||||||
import exh.util.executeOnIO
|
import exh.util.executeOnIO
|
||||||
import exh.util.nullIfBlank
|
import exh.util.nullIfBlank
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import kotlinx.serialization.protobuf.ProtoBuf
|
import kotlinx.serialization.protobuf.ProtoBuf
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
import okio.buffer
|
import okio.buffer
|
||||||
import okio.gzip
|
import okio.gzip
|
||||||
import okio.sink
|
import okio.sink
|
||||||
|
import uy.kohesive.injekt.Injekt
|
||||||
|
import uy.kohesive.injekt.api.get
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
@ -168,15 +170,14 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
|||||||
* @return list of [BackupSavedSearch] to be backed up
|
* @return list of [BackupSavedSearch] to be backed up
|
||||||
*/
|
*/
|
||||||
private fun backupSavedSearches(): List<BackupSavedSearch> {
|
private fun backupSavedSearches(): List<BackupSavedSearch> {
|
||||||
return runBlocking {
|
// TODO: Database handler please
|
||||||
databaseHandler.awaitList { saved_searchQueries.selectAll(savedSearchMapper) }.map {
|
return Injekt.get<Database>().saved_searchQueries.selectAll(savedSearchMapper).executeAsList().map {
|
||||||
BackupSavedSearch(
|
BackupSavedSearch(
|
||||||
it.name,
|
it.name,
|
||||||
it.query.orEmpty(),
|
it.query.orEmpty(),
|
||||||
it.filtersJson ?: "[]",
|
it.filtersJson ?: "[]",
|
||||||
it.source,
|
it.source,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// SY <--
|
// SY <--
|
||||||
|
Loading…
x
Reference in New Issue
Block a user