diff --git a/app/src/main/java/eu/kanade/domain/track/interactor/AddTracks.kt b/app/src/main/java/eu/kanade/domain/track/interactor/AddTracks.kt index 2d31c64e7b..a5b6a0e1c0 100644 --- a/app/src/main/java/eu/kanade/domain/track/interactor/AddTracks.kt +++ b/app/src/main/java/eu/kanade/domain/track/interactor/AddTracks.kt @@ -5,6 +5,7 @@ import eu.kanade.domain.track.model.toDomainTrack import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.EnhancedTracker import eu.kanade.tachiyomi.data.track.Tracker +import eu.kanade.tachiyomi.data.track.TrackerManager import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.util.lang.convertEpochMillisZone import logcat.LogPriority @@ -14,17 +15,16 @@ import tachiyomi.core.common.util.system.logcat import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId import tachiyomi.domain.history.interactor.GetHistory import tachiyomi.domain.manga.model.Manga -import tachiyomi.domain.track.interactor.GetTracks import tachiyomi.domain.track.interactor.InsertTrack import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.time.ZoneOffset class AddTracks( - private val getTracks: GetTracks, private val insertTrack: InsertTrack, private val syncChapterProgressWithTrack: SyncChapterProgressWithTrack, private val getChaptersByMangaId: GetChaptersByMangaId, + private val trackerManager: TrackerManager, ) { // TODO: update all trackers based on common data @@ -79,7 +79,7 @@ class AddTracks( suspend fun bindEnhancedTrackers(manga: Manga, source: Source) = withNonCancellableContext { withIOContext { - getTracks.await(manga.id) + trackerManager.loggedInTrackers() .filterIsInstance() .filter { it.accept(source) } .forEach { service -> @@ -87,11 +87,11 @@ class AddTracks( service.match(manga)?.let { track -> track.manga_id = manga.id (service as Tracker).bind(track) - insertTrack.await(track.toDomainTrack()!!) + insertTrack.await(track.toDomainTrack(idRequired = false)!!) syncChapterProgressWithTrack.await( manga.id, - track.toDomainTrack()!!, + track.toDomainTrack(idRequired = false)!!, service, ) }