Skip to content

Commit

Permalink
sync: Follow backup changes on commit f696f20
Browse files Browse the repository at this point in the history
  • Loading branch information
Caio99BR committed Jun 25, 2024
1 parent b1c2689 commit 268d582
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.data.backup.create.BackupOptions
import eu.kanade.tachiyomi.data.backup.models.Backup
import eu.kanade.tachiyomi.data.backup.models.BackupChapter
import eu.kanade.tachiyomi.data.backup.models.BackupManga
import eu.kanade.tachiyomi.data.backup.models.BackupSerializer
import eu.kanade.tachiyomi.data.backup.restore.BackupRestoreJob
import eu.kanade.tachiyomi.data.backup.restore.RestoreOptions
import eu.kanade.tachiyomi.data.backup.restore.restorers.MangaRestorer
Expand Down Expand Up @@ -202,7 +201,7 @@ class SyncManager(
val cacheFile = File(context.cacheDir, "tachiyomi_sync_data.proto.gz")
return try {
cacheFile.outputStream().use { output ->
output.write(ProtoBuf.encodeToByteArray(BackupSerializer, backup))
output.write(ProtoBuf.encodeToByteArray(Backup.serializer(), backup))
Uri.fromFile(cacheFile)
}
} catch (e: IOException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.sync.service
import android.content.Context
import eu.kanade.domain.sync.SyncPreferences
import eu.kanade.tachiyomi.data.backup.models.Backup
import eu.kanade.tachiyomi.data.backup.models.BackupSerializer
import eu.kanade.tachiyomi.data.sync.SyncNotifier
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.PUT
Expand Down Expand Up @@ -104,7 +103,7 @@ class SyncYomiSyncService(
}

return try {
val backup = protoBuf.decodeFromByteArray(BackupSerializer, byteArray)
val backup = ProtoBuf.decodeFromByteArray(Backup.serializer(), byteArray)
return Pair(SyncData(backup = backup), newETag)
} catch (_: SerializationException) {
logcat(LogPriority.INFO) {
Expand Down Expand Up @@ -147,7 +146,7 @@ class SyncYomiSyncService(
.writeTimeout(timeout, TimeUnit.SECONDS)
.build()

val byteArray = protoBuf.encodeToByteArray(BackupSerializer, backup)
val byteArray = ProtoBuf.encodeToByteArray(Backup.serializer(), backup)
if (byteArray.isEmpty()) {
throw IllegalStateException(context.stringResource(MR.strings.empty_backup_error))
}
Expand Down

0 comments on commit 268d582

Please sign in to comment.