Move DB transaction blocks to only the DB portions of restore logic
(cherry picked from commit 63f3180dff643355a000ff4071105a12139d18b0) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt
This commit is contained in:
parent
d9d969406e
commit
a0462fb480
@ -253,14 +253,13 @@ class BackupRestoreService : Service() {
|
||||
private fun restoreCategories(categoriesJson: JsonElement) {
|
||||
db.inTransaction {
|
||||
backupManager.restoreCategories(categoriesJson.asJsonArray)
|
||||
}
|
||||
|
||||
restoreProgress += 1
|
||||
showRestoreProgress(restoreProgress, restoreAmount, getString(R.string.categories))
|
||||
}
|
||||
}
|
||||
|
||||
private fun restoreManga(mangaJson: JsonObject) {
|
||||
db.inTransaction {
|
||||
var manga = backupManager.parser.fromJson<MangaImpl>(mangaJson.get(MANGA))
|
||||
val chapters = backupManager.parser.fromJson<List<ChapterImpl>>(
|
||||
mangaJson.get(CHAPTERS)
|
||||
@ -292,7 +291,6 @@ class BackupRestoreService : Service() {
|
||||
restoreProgress += 1
|
||||
showRestoreProgress(restoreProgress, restoreAmount, manga.title)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a manga restore observable
|
||||
@ -314,6 +312,7 @@ class BackupRestoreService : Service() {
|
||||
val source = backupManager.sourceManager.getOrStub(manga.source)
|
||||
val dbManga = backupManager.getMangaFromDatabase(manga)
|
||||
|
||||
db.inTransaction {
|
||||
if (dbManga == null) {
|
||||
// Manga not in database
|
||||
restoreMangaFetch(source, manga, chapters, categories, history, tracks)
|
||||
@ -324,6 +323,7 @@ class BackupRestoreService : Service() {
|
||||
restoreMangaNoFetch(source, manga, chapters, categories, history, tracks)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [Observable] that fetches manga information
|
||||
|
Loading…
x
Reference in New Issue
Block a user