Fix issue with creating and restoring backup

Fixes #881
This commit is contained in:
AntsyLich 2024-06-13 03:13:57 +06:00
parent 9fa22f0b37
commit f696f209c6
No known key found for this signature in database
3 changed files with 2 additions and 8 deletions

View file

@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.backup
import android.content.Context
import android.net.Uri
import eu.kanade.tachiyomi.data.backup.models.Backup
import eu.kanade.tachiyomi.data.backup.models.BackupSerializer
import kotlinx.serialization.protobuf.ProtoBuf
import okio.buffer
import okio.gzip
@ -33,7 +32,7 @@ class BackupDecoder(
source
}.use { it.readByteArray() }
parser.decodeFromByteArray(BackupSerializer, backupString)
parser.decodeFromByteArray(Backup.serializer(), backupString)
}
}
}

View file

@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.data.backup.models.Backup
import eu.kanade.tachiyomi.data.backup.models.BackupCategory
import eu.kanade.tachiyomi.data.backup.models.BackupManga
import eu.kanade.tachiyomi.data.backup.models.BackupPreference
import eu.kanade.tachiyomi.data.backup.models.BackupSerializer
import eu.kanade.tachiyomi.data.backup.models.BackupSource
import eu.kanade.tachiyomi.data.backup.models.BackupSourcePreferences
import kotlinx.serialization.protobuf.ProtoBuf
@ -84,7 +83,7 @@ class BackupCreator(
backupSourcePreferences = backupSourcePreferences(options),
)
val byteArray = parser.encodeToByteArray(BackupSerializer, backup)
val byteArray = parser.encodeToByteArray(Backup.serializer(), backup)
if (byteArray.isEmpty()) {
throw IllegalStateException(context.stringResource(MR.strings.empty_backup_error))
}

View file

@ -1,12 +1,8 @@
package eu.kanade.tachiyomi.data.backup.models
import kotlinx.serialization.Serializable
import kotlinx.serialization.Serializer
import kotlinx.serialization.protobuf.ProtoNumber
@Serializer(forClass = Backup::class)
object BackupSerializer
@Serializable
data class Backup(
@ProtoNumber(1) val backupManga: List<BackupManga>,