From 518abf032ccb9bb45d197927be2a5faca4167d29 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:36:34 +0600 Subject: [PATCH] Remove legacy broken source and history backup --- .../eu/kanade/tachiyomi/data/backup/models/Backup.kt | 2 +- .../tachiyomi/data/backup/models/BackupHistory.kt | 12 ------------ .../tachiyomi/data/backup/models/BackupManga.kt | 2 +- .../tachiyomi/data/backup/models/BackupSource.kt | 8 -------- .../tachiyomi/data/backup/restore/BackupRestorer.kt | 2 +- .../data/backup/restore/restorers/MangaRestorer.kt | 2 +- 6 files changed, 4 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/Backup.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/Backup.kt index f026b30ff..e7f35ddf2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/Backup.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/Backup.kt @@ -7,7 +7,7 @@ import kotlinx.serialization.protobuf.ProtoNumber data class Backup( @ProtoNumber(1) val backupManga: List, @ProtoNumber(2) var backupCategories: List = emptyList(), - @ProtoNumber(100) var backupBrokenSources: List = emptyList(), + // @ProtoNumber(100) var backupBrokenSources, legacy source model with non-compliant proto number, @ProtoNumber(101) var backupSources: List = emptyList(), @ProtoNumber(104) var backupPreferences: List = emptyList(), @ProtoNumber(105) var backupSourcePreferences: List = emptyList(), diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupHistory.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupHistory.kt index 1108a376e..b5a6c616a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupHistory.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupHistory.kt @@ -18,15 +18,3 @@ data class BackupHistory( ) } } - -@Deprecated("Replaced with BackupHistory. This is retained for legacy reasons.") -@Serializable -data class BrokenBackupHistory( - @ProtoNumber(0) var url: String, - @ProtoNumber(1) var lastRead: Long, - @ProtoNumber(2) var readDuration: Long = 0, -) { - fun toBackupHistory(): BackupHistory { - return BackupHistory(url, lastRead, readDuration) - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt index 7b7498398..3bfc1ffcc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt @@ -32,7 +32,7 @@ data class BackupManga( // Bump by 100 for values that are not saved/implemented in 1.x but are used in 0.x @ProtoNumber(100) var favorite: Boolean = true, @ProtoNumber(101) var chapterFlags: Int = 0, - @ProtoNumber(102) var brokenHistory: List = emptyList(), + // @ProtoNumber(102) var brokenHistory, legacy history model with non-compliant proto number @ProtoNumber(103) var viewer_flags: Int? = null, @ProtoNumber(104) var history: List = emptyList(), @ProtoNumber(105) var updateStrategy: UpdateStrategy = UpdateStrategy.ALWAYS_UPDATE, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupSource.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupSource.kt index bfd2c93bf..92ee2dca9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupSource.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupSource.kt @@ -8,11 +8,3 @@ data class BackupSource( @ProtoNumber(1) var name: String = "", @ProtoNumber(2) var sourceId: Long, ) - -@Serializable -data class BrokenBackupSource( - @ProtoNumber(0) var name: String = "", - @ProtoNumber(1) var sourceId: Long, -) { - fun toBackupSource() = BackupSource(name, sourceId) -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestorer.kt index fec340fa3..43d7c3718 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/BackupRestorer.kt @@ -67,7 +67,7 @@ class BackupRestorer( val backup = BackupDecoder(context).decode(uri) // Store source mapping for error messages - val backupMaps = backup.backupSources + backup.backupBrokenSources.map { it.toBackupSource() } + val backupMaps = backup.backupSources sourceMapping = backupMaps.associate { it.sourceId to it.name } if (options.libraryEntries) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt index 38d15bad1..213fc4bf7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt @@ -71,7 +71,7 @@ class MangaRestorer( chapters = backupManga.chapters, categories = backupManga.categories, backupCategories = backupCategories, - history = backupManga.history + backupManga.brokenHistory.map { it.toBackupHistory() }, + history = backupManga.history, tracks = backupManga.tracking, excludedScanlators = backupManga.excludedScanlators, )