Fix legacy backups

(cherry picked from commit ded58541f5903c109b70799683829e26018d2af6)
This commit is contained in:
Jobobby04
2021-02-07 21:54:26 -05:00
committed by arkon
parent 3566072f4a
commit 9f9f9872eb
5 changed files with 50 additions and 3 deletions
@@ -80,6 +80,13 @@ abstract class AbstractBackupManager(protected val context: Context) {
databaseHelper.updateChaptersBackup(chapters).executeAsBlocking()
}
/**
* Updates a list of chapters with known database ids
*/
protected fun updateKnownChapters(chapters: List<Chapter>) {
databaseHelper.updateKnownChaptersBackup(chapters).executeAsBlocking()
}
/**
* Return number of backups.
*
@@ -405,7 +405,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
}
val newChapters = chapters.groupBy { it.id != null }
newChapters[true]?.let { updateChapters(it) }
newChapters[true]?.let { updateKnownChapters(it) }
newChapters[false]?.let { insertChapters(it) }
}
}