From 6887d98f15b4b9a84230217800fba2d4ae5b186a Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 24 Dec 2023 22:25:22 -0500 Subject: [PATCH] Minor tracking cleanups --- .../domain/track/interactor/RefreshTracks.kt | 2 +- .../domain/track/interactor/TrackChapter.kt | 2 +- .../eu/kanade/domain/track/model/Track.kt | 4 +-- .../domain/track/service/TrackPreferences.kt | 26 +++++++------- .../more/settings/PreferenceItem.kt | 5 ++- .../presentation/reader/ChapterTransition.kt | 34 +++++++++---------- .../TrackInfoDialogHomePreviewProvider.kt | 2 +- .../track/TrackerSearchPreviewProvider.kt | 2 +- .../backup/restore/restorers/MangaRestorer.kt | 6 ++-- .../tachiyomi/data/database/models/Track.kt | 4 +-- .../data/database/models/TrackImpl.kt | 2 +- .../tachiyomi/data/track/TrackerManager.kt | 2 -- .../tachiyomi/data/track/model/TrackSearch.kt | 8 ++--- .../ui/library/LibraryScreenModel.kt | 4 +-- .../tachiyomi/ui/manga/MangaScreenModel.kt | 2 +- .../ui/manga/track/TrackInfoDialog.kt | 2 +- .../ui/reader/model/ReaderChapter.kt | 3 ++ .../tachiyomi/ui/stats/StatsScreenModel.kt | 4 +-- .../java/tachiyomi/data/track/TrackMapper.kt | 2 +- .../data/track/TrackRepositoryImpl.kt | 6 ++-- .../domain/backup/model/BackupTracking.kt | 3 +- .../domain/track/interactor/DeleteTrack.kt | 4 +-- .../tachiyomi/domain/track/model/Track.kt | 2 +- .../track/repository/TrackRepository.kt | 2 +- 24 files changed, 64 insertions(+), 69 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/track/interactor/RefreshTracks.kt b/app/src/main/java/eu/kanade/domain/track/interactor/RefreshTracks.kt index 8c8952304..457dbf87e 100644 --- a/app/src/main/java/eu/kanade/domain/track/interactor/RefreshTracks.kt +++ b/app/src/main/java/eu/kanade/domain/track/interactor/RefreshTracks.kt @@ -25,7 +25,7 @@ class RefreshTracks( suspend fun await(mangaId: Long): List> { return supervisorScope { return@supervisorScope getTracks.await(mangaId) - .map { it to trackerManager.get(it.syncId) } + .map { it to trackerManager.get(it.trackerId) } .filter { (_, service) -> service?.isLoggedIn == true } .map { (track, service) -> async { diff --git a/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt b/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt index 789a784ef..557c3be83 100644 --- a/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt +++ b/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt @@ -27,7 +27,7 @@ class TrackChapter( if (tracks.isEmpty()) return@withNonCancellableContext tracks.mapNotNull { track -> - val service = trackerManager.get(track.syncId) + val service = trackerManager.get(track.trackerId) if (service == null || !service.isLoggedIn || chapterNumber <= track.lastChapterRead) { return@mapNotNull null } diff --git a/app/src/main/java/eu/kanade/domain/track/model/Track.kt b/app/src/main/java/eu/kanade/domain/track/model/Track.kt index e9e97c5c6..e84e28ff0 100644 --- a/app/src/main/java/eu/kanade/domain/track/model/Track.kt +++ b/app/src/main/java/eu/kanade/domain/track/model/Track.kt @@ -13,7 +13,7 @@ fun Track.copyPersonalFrom(other: Track): Track { ) } -fun Track.toDbTrack(): DbTrack = DbTrack.create(syncId).also { +fun Track.toDbTrack(): DbTrack = DbTrack.create(trackerId).also { it.id = id it.manga_id = mangaId it.remote_id = remoteId @@ -33,7 +33,7 @@ fun DbTrack.toDomainTrack(idRequired: Boolean = true): Track? { return Track( id = trackId, mangaId = manga_id, - syncId = sync_id.toLong(), + trackerId = tracker_id.toLong(), remoteId = remote_id, libraryId = library_id, title = title, diff --git a/app/src/main/java/eu/kanade/domain/track/service/TrackPreferences.kt b/app/src/main/java/eu/kanade/domain/track/service/TrackPreferences.kt index c7fb47581..8ed234b90 100644 --- a/app/src/main/java/eu/kanade/domain/track/service/TrackPreferences.kt +++ b/app/src/main/java/eu/kanade/domain/track/service/TrackPreferences.kt @@ -9,26 +9,24 @@ class TrackPreferences( private val preferenceStore: PreferenceStore, ) { - fun trackUsername(sync: Tracker) = preferenceStore.getString(trackUsername(sync.id), "") + fun trackUsername(tracker: Tracker) = preferenceStore.getString( + Preference.privateKey("pref_mangasync_username_${tracker.id}"), + "", + ) - fun trackPassword(sync: Tracker) = preferenceStore.getString(trackPassword(sync.id), "") + fun trackPassword(tracker: Tracker) = preferenceStore.getString( + Preference.privateKey("pref_mangasync_password_${tracker.id}"), + "", + ) - fun setCredentials(sync: Tracker, username: String, password: String) { - trackUsername(sync).set(username) - trackPassword(sync).set(password) + fun setCredentials(tracker: Tracker, username: String, password: String) { + trackUsername(tracker).set(username) + trackPassword(tracker).set(password) } - fun trackToken(sync: Tracker) = preferenceStore.getString(trackToken(sync.id), "") + fun trackToken(tracker: Tracker) = preferenceStore.getString(Preference.privateKey("track_token_${tracker.id}"), "") fun anilistScoreType() = preferenceStore.getString("anilist_score_type", Anilist.POINT_10) fun autoUpdateTrack() = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true) - - companion object { - fun trackUsername(syncId: Long) = Preference.privateKey("pref_mangasync_username_$syncId") - - private fun trackPassword(syncId: Long) = Preference.privateKey("pref_mangasync_password_$syncId") - - private fun trackToken(syncId: Long) = Preference.privateKey("track_token_$syncId") - } } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceItem.kt b/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceItem.kt index b68f17fcd..b22e69323 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceItem.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/PreferenceItem.kt @@ -21,7 +21,6 @@ import eu.kanade.presentation.more.settings.widget.SwitchPreferenceWidget import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget import eu.kanade.presentation.more.settings.widget.TrackingPreferenceWidget import kotlinx.coroutines.launch -import tachiyomi.core.preference.PreferenceStore import tachiyomi.presentation.core.components.SliderItem import tachiyomi.presentation.core.util.collectAsState import uy.kohesive.injekt.Injekt @@ -157,8 +156,8 @@ internal fun PreferenceItem( ) } is Preference.PreferenceItem.TrackerPreference -> { - val uName by Injekt.get() - .getString(TrackPreferences.trackUsername(item.tracker.id)) + val uName by Injekt.get() + .trackUsername(item.tracker) .collectAsState() item.tracker.run { TrackingPreferenceWidget( diff --git a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt index 422192383..2961529a3 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt @@ -34,11 +34,10 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import eu.kanade.presentation.theme.TachiyomiTheme -import eu.kanade.tachiyomi.data.database.models.Chapter -import eu.kanade.tachiyomi.data.database.models.ChapterImpl import eu.kanade.tachiyomi.data.database.models.toDomainChapter import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter +import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.service.calculateChapterGap import tachiyomi.i18n.MR import tachiyomi.presentation.core.i18n.pluralStringResource @@ -51,8 +50,8 @@ fun ChapterTransition( currChapterDownloaded: Boolean, goingToChapterDownloaded: Boolean, ) { - val currChapter = transition.from.chapter - val goingToChapter = transition.to?.chapter + val currChapter = transition.from.chapter.toDomainChapter() + val goingToChapter = transition.to?.chapter?.toDomainChapter() ProvideTextStyle(MaterialTheme.typography.bodyMedium) { when (transition) { @@ -65,7 +64,7 @@ fun ChapterTransition( bottomChapter = currChapter, bottomChapterDownloaded = currChapterDownloaded, fallbackLabel = stringResource(MR.strings.transition_no_previous), - chapterGap = calculateChapterGap(currChapter.toDomainChapter(), goingToChapter?.toDomainChapter()), + chapterGap = calculateChapterGap(currChapter, goingToChapter), ) } is ChapterTransition.Next -> { @@ -77,7 +76,7 @@ fun ChapterTransition( bottomChapter = goingToChapter, bottomChapterDownloaded = goingToChapterDownloaded, fallbackLabel = stringResource(MR.strings.transition_no_next), - chapterGap = calculateChapterGap(goingToChapter?.toDomainChapter(), currChapter.toDomainChapter()), + chapterGap = calculateChapterGap(goingToChapter, currChapter), ) } } @@ -275,24 +274,23 @@ private val CardColor: CardColors private val VerticalSpacerSize = 24.dp private const val DownloadedIconContentId = "downloaded" -private fun previewChapter(name: String, scanlator: String, chapterNumber: Float) = ChapterImpl().apply { - this.name = name - this.scanlator = scanlator - this.chapter_number = chapterNumber - - this.id = 0 - this.manga_id = 0 - this.url = "" -} +private fun previewChapter(name: String, scanlator: String, chapterNumber: Double) = Chapter.create().copy( + id = 0L, + mangaId = 0L, + url = "", + name = name, + scanlator = scanlator, + chapterNumber = chapterNumber, +) private val FakeChapter = previewChapter( name = "Vol.1, Ch.1 - Fake Chapter Title", scanlator = "Scanlator Name", - chapterNumber = 1f, + chapterNumber = 1.0, ) private val FakeGapChapter = previewChapter( name = "Vol.5, Ch.44 - Fake Gap Chapter Title", scanlator = "Scanlator Name", - chapterNumber = 44f, + chapterNumber = 44.0, ) private val FakeChapterLongTitle = previewChapter( name = "Vol.1, Ch.0 - The Mundane Musings of a Metafictional Manga: A Chapter About a Chapter, Featuring" + @@ -301,7 +299,7 @@ private val FakeChapterLongTitle = previewChapter( "Fictional Realities and Reality-Bending Fiction, Where the Fourth Wall is Always in Danger of Being Broken " + "and the Line Between Author and Character is Forever Blurred.", scanlator = "Long Long Funny Scanlator Sniper Group Name Reborn", - chapterNumber = 1f, + chapterNumber = 1.0, ) @PreviewLightDark diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHomePreviewProvider.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHomePreviewProvider.kt index e2733b7bf..51b7ca3f8 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHomePreviewProvider.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHomePreviewProvider.kt @@ -13,7 +13,7 @@ internal class TrackInfoDialogHomePreviewProvider : private val aTrack = Track( id = 1L, mangaId = 2L, - syncId = 3L, + trackerId = 3L, remoteId = 4L, libraryId = null, title = "Manage Name On Tracker Site", diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackerSearchPreviewProvider.kt b/app/src/main/java/eu/kanade/presentation/track/TrackerSearchPreviewProvider.kt index fe5578f7b..7bc78781b 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackerSearchPreviewProvider.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackerSearchPreviewProvider.kt @@ -62,7 +62,7 @@ internal class TrackerSearchPreviewProvider : PreviewParameterProvider<@Composab private fun randTrackSearch() = TrackSearch().let { it.id = Random.nextLong() it.manga_id = Random.nextLong() - it.sync_id = Random.nextInt() + it.tracker_id = Random.nextInt() it.remote_id = Random.nextLong() it.library_id = Random.nextLong() it.title = lorem((1..10).random()).joinToString() 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 deb4e5553..6ca9f95d9 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 @@ -346,12 +346,12 @@ class MangaRestorer( } private suspend fun restoreTracking(manga: Manga, backupTracks: List) { - val dbTrackBySyncId = getTracks.await(manga.id).associateBy { it.syncId } + val dbTrackByTrackerId = getTracks.await(manga.id).associateBy { it.trackerId } val (existingTracks, newTracks) = backupTracks .mapNotNull { val track = it.getTrackImpl() - val dbTrack = dbTrackBySyncId[track.syncId] + val dbTrack = dbTrackByTrackerId[track.trackerId] ?: // New track return@mapNotNull track.copy( id = 0, // Let DB assign new ID @@ -380,7 +380,7 @@ class MangaRestorer( existingTracks.forEach { track -> manga_syncQueries.update( track.mangaId, - track.syncId, + track.trackerId, track.remoteId, track.libraryId, track.title, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt index e0bc5f047..9d7f98983 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Track.kt @@ -8,7 +8,7 @@ interface Track : Serializable { var manga_id: Long - var sync_id: Int + var tracker_id: Int var remote_id: Long @@ -40,7 +40,7 @@ interface Track : Serializable { companion object { fun create(serviceId: Long): Track = TrackImpl().apply { - sync_id = serviceId.toInt() + tracker_id = serviceId.toInt() } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt index faf86f021..2a0abce31 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/TrackImpl.kt @@ -6,7 +6,7 @@ class TrackImpl : Track { override var manga_id: Long = 0 - override var sync_id: Int = 0 + override var tracker_id: Int = 0 override var remote_id: Long = 0 diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt index a62ad4401..598a0c06c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackerManager.kt @@ -33,6 +33,4 @@ class TrackerManager { fun loggedInTrackers() = trackers.filter { it.isLoggedIn } fun get(id: Long) = trackers.find { it.id == id } - - fun hasLoggedIn() = trackers.any { it.isLoggedIn } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt index b43d8009a..b8a71687f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/model/TrackSearch.kt @@ -8,7 +8,7 @@ class TrackSearch : Track { override var manga_id: Long = 0 - override var sync_id: Int = 0 + override var tracker_id: Int = 0 override var remote_id: Long = 0 @@ -47,7 +47,7 @@ class TrackSearch : Track { other as TrackSearch if (manga_id != other.manga_id) return false - if (sync_id != other.sync_id) return false + if (tracker_id != other.tracker_id) return false if (remote_id != other.remote_id) return false return true @@ -55,14 +55,14 @@ class TrackSearch : Track { override fun hashCode(): Int { var result = manga_id.hashCode() - result = 31 * result + sync_id + result = 31 * result + tracker_id result = 31 * result + remote_id.hashCode() return result } companion object { fun create(serviceId: Long): TrackSearch = TrackSearch().apply { - sync_id = serviceId.toInt() + tracker_id = serviceId.toInt() } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt index 72fa1cc6c..a19753a84 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt @@ -217,7 +217,7 @@ class LibraryScreenModel( if (isNotLoggedInAnyTrack || trackFiltersIsIgnored) return@tracking true val mangaTracks = trackMap - .mapValues { entry -> entry.value.map { it.syncId } }[item.libraryManga.id] + .mapValues { entry -> entry.value.map { it.trackerId } }[item.libraryManga.id] .orEmpty() val isExcluded = excludedTracks.isNotEmpty() && mangaTracks.fastAny { it in excludedTracks } @@ -257,7 +257,7 @@ class LibraryScreenModel( entry.value.isEmpty() -> null else -> entry.value - .mapNotNull { trackerMap[it.syncId]?.get10PointScore(it) } + .mapNotNull { trackerMap[it.trackerId]?.get10PointScore(it) } .average() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index a6541fe30..1c36d19d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -983,7 +983,7 @@ class MangaScreenModel( .map { tracks -> loggedInTrackers // Map to TrackItem - .map { service -> TrackItem(tracks.find { it.syncId == service.id }, service) } + .map { service -> TrackItem(tracks.find { it.trackerId == service.id }, service) } // Show only if the service supports this manga's source .filter { (it.tracker as? EnhancedTracker)?.accept(source!!) ?: true } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt index aab8f802a..9ad9f5bb2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt @@ -244,7 +244,7 @@ data class TrackInfoDialogHomeScreen( val source = Injekt.get().getOrStub(sourceId) return loggedInTrackers // Map to TrackItem - .map { service -> TrackItem(find { it.syncId == service.id }, service) } + .map { service -> TrackItem(find { it.trackerId == service.id }, service) } // Show only if the service supports this manga's source .filter { (it.tracker as? EnhancedTracker)?.accept(source) ?: true } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderChapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderChapter.kt index af32c11b3..c0cdfdd7c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderChapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderChapter.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.ui.reader.model +import eu.kanade.domain.chapter.model.toDbChapter import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.ui.reader.loader.PageLoader import kotlinx.coroutines.flow.MutableStateFlow @@ -23,6 +24,8 @@ data class ReaderChapter(val chapter: Chapter) { private var references = 0 + constructor(chapter: tachiyomi.domain.chapter.model.Chapter) : this(chapter.toDbChapter()) + fun ref() { references++ } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt index e925c7dcb..9ed04cd78 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/stats/StatsScreenModel.kt @@ -118,7 +118,7 @@ class StatsScreenModel( val loggedInTrackerIds = loggedInTrackers.map { it.id }.toHashSet() return libraryManga.associate { manga -> val tracks = getTracks.await(manga.id) - .fastFilter { it.syncId in loggedInTrackerIds } + .fastFilter { it.trackerId in loggedInTrackerIds } manga.id to tracks } @@ -144,7 +144,7 @@ class StatsScreenModel( } private fun get10PointScore(track: Track): Double { - val service = trackerManager.get(track.syncId)!! + val service = trackerManager.get(track.trackerId)!! return service.get10PointScore(track) } } diff --git a/data/src/main/java/tachiyomi/data/track/TrackMapper.kt b/data/src/main/java/tachiyomi/data/track/TrackMapper.kt index 8ac852731..ee941d49c 100644 --- a/data/src/main/java/tachiyomi/data/track/TrackMapper.kt +++ b/data/src/main/java/tachiyomi/data/track/TrackMapper.kt @@ -20,7 +20,7 @@ object TrackMapper { ): Track = Track( id = id, mangaId = mangaId, - syncId = syncId, + trackerId = syncId, remoteId = remoteId, libraryId = libraryId, title = title, diff --git a/data/src/main/java/tachiyomi/data/track/TrackRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/track/TrackRepositoryImpl.kt index 19a3daa02..6cd8396b1 100644 --- a/data/src/main/java/tachiyomi/data/track/TrackRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/track/TrackRepositoryImpl.kt @@ -31,11 +31,11 @@ class TrackRepositoryImpl( } } - override suspend fun delete(mangaId: Long, syncId: Long) { + override suspend fun delete(mangaId: Long, trackerId: Long) { handler.await { manga_syncQueries.delete( mangaId = mangaId, - syncId = syncId, + syncId = trackerId, ) } } @@ -53,7 +53,7 @@ class TrackRepositoryImpl( tracks.forEach { mangaTrack -> manga_syncQueries.insert( mangaId = mangaTrack.mangaId, - syncId = mangaTrack.syncId, + syncId = mangaTrack.trackerId, remoteId = mangaTrack.remoteId, libraryId = mangaTrack.libraryId, title = mangaTrack.title, diff --git a/domain/src/main/java/tachiyomi/domain/backup/model/BackupTracking.kt b/domain/src/main/java/tachiyomi/domain/backup/model/BackupTracking.kt index caa727ad3..dff8f2582 100644 --- a/domain/src/main/java/tachiyomi/domain/backup/model/BackupTracking.kt +++ b/domain/src/main/java/tachiyomi/domain/backup/model/BackupTracking.kt @@ -7,7 +7,6 @@ import tachiyomi.domain.track.model.Track @Serializable data class BackupTracking( // in 1.x some of these values have different types or names - // syncId is called siteId in 1,x @ProtoNumber(1) var syncId: Int, // LibraryId is not null in 1.x @ProtoNumber(2) var libraryId: Long, @@ -34,7 +33,7 @@ data class BackupTracking( return Track( id = -1, mangaId = -1, - syncId = this@BackupTracking.syncId.toLong(), + trackerId = this@BackupTracking.syncId.toLong(), remoteId = if (this@BackupTracking.mediaIdInt != 0) { this@BackupTracking.mediaIdInt.toLong() } else { diff --git a/domain/src/main/java/tachiyomi/domain/track/interactor/DeleteTrack.kt b/domain/src/main/java/tachiyomi/domain/track/interactor/DeleteTrack.kt index 9672a6586..2a30e0ffc 100644 --- a/domain/src/main/java/tachiyomi/domain/track/interactor/DeleteTrack.kt +++ b/domain/src/main/java/tachiyomi/domain/track/interactor/DeleteTrack.kt @@ -8,9 +8,9 @@ class DeleteTrack( private val trackRepository: TrackRepository, ) { - suspend fun await(mangaId: Long, syncId: Long) { + suspend fun await(mangaId: Long, trackerId: Long) { try { - trackRepository.delete(mangaId, syncId) + trackRepository.delete(mangaId, trackerId) } catch (e: Exception) { logcat(LogPriority.ERROR, e) } diff --git a/domain/src/main/java/tachiyomi/domain/track/model/Track.kt b/domain/src/main/java/tachiyomi/domain/track/model/Track.kt index 91ac2c833..1a656fcad 100644 --- a/domain/src/main/java/tachiyomi/domain/track/model/Track.kt +++ b/domain/src/main/java/tachiyomi/domain/track/model/Track.kt @@ -3,7 +3,7 @@ package tachiyomi.domain.track.model data class Track( val id: Long, val mangaId: Long, - val syncId: Long, + val trackerId: Long, val remoteId: Long, val libraryId: Long?, val title: String, diff --git a/domain/src/main/java/tachiyomi/domain/track/repository/TrackRepository.kt b/domain/src/main/java/tachiyomi/domain/track/repository/TrackRepository.kt index 1edd76fdf..1814a7a08 100644 --- a/domain/src/main/java/tachiyomi/domain/track/repository/TrackRepository.kt +++ b/domain/src/main/java/tachiyomi/domain/track/repository/TrackRepository.kt @@ -13,7 +13,7 @@ interface TrackRepository { fun getTracksByMangaIdAsFlow(mangaId: Long): Flow> - suspend fun delete(mangaId: Long, syncId: Long) + suspend fun delete(mangaId: Long, trackerId: Long) suspend fun insert(track: Track)