fix: fix not restoring categories etc.

This commit is contained in:
KaiserBh 2023-07-07 15:51:05 +10:00 committed by Aria Moradi
parent 75b9871e55
commit 877bf721e3

View File

@ -65,8 +65,6 @@ class SyncManager(
*/ */
suspend fun syncData() { suspend fun syncData() {
val databaseManga = getAllMangaFromDB() val databaseManga = getAllMangaFromDB()
logcat(LogPriority.DEBUG) { "Mangas to sync: $databaseManga" }
val backup = Backup( val backup = Backup(
backupManager.backupMangas(databaseManga, BACKUP_ALL), backupManager.backupMangas(databaseManga, BACKUP_ALL),
backupManager.backupCategories(BACKUP_ALL), backupManager.backupCategories(BACKUP_ALL),
@ -115,7 +113,12 @@ class SyncManager(
if (remoteBackup != null) { if (remoteBackup != null) {
val (filteredFavorites, nonFavorites) = filterFavoritesAndNonFavorites(remoteBackup) val (filteredFavorites, nonFavorites) = filterFavoritesAndNonFavorites(remoteBackup)
updateNonFavorites(nonFavorites) updateNonFavorites(nonFavorites)
SyncHolder.backup = backup.copy(backupManga = filteredFavorites) SyncHolder.backup = backup.copy(
backupManga = filteredFavorites,
backupCategories = remoteBackup.backupCategories,
backupSources = remoteBackup.backupSources,
backupBrokenSources = remoteBackup.backupBrokenSources,
)
BackupRestoreJob.start(context, "".toUri(), true) BackupRestoreJob.start(context, "".toUri(), true)
syncPreferences.syncLastSync().set(Instant.now()) syncPreferences.syncLastSync().set(Instant.now())
} }