small Episode Tracker change

This commit is contained in:
LuftVerbot 2023-11-20 21:47:46 +01:00
parent f6d430df6c
commit b8cdb9d55e
2 changed files with 4 additions and 5 deletions

View file

@ -5,6 +5,7 @@ import eu.kanade.domain.track.anime.model.toDbTrack
import eu.kanade.domain.track.anime.service.DelayedAnimeTrackingUpdateJob
import eu.kanade.domain.track.anime.store.DelayedAnimeTrackingStore
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.util.system.isOnline
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
@ -34,13 +35,12 @@ class TrackEpisode(
async {
runCatching {
try {
if (context.isOnline()) {
service.animeService.update(updatedTrack.toDbTrack(), true)
insertTrack.await(updatedTrack)
} catch (e: Exception) {
} else {
delayedTrackingStore.addAnimeItem(updatedTrack)
DelayedAnimeTrackingUpdateJob.setupTask(context)
throw e
}
}
}

View file

@ -573,11 +573,10 @@ class PlayerViewModel @JvmOverloads constructor(
}
private fun updateTrackEpisodeSeen(episode: Episode) {
if (basePreferences.incognitoMode().get()) return
if (basePreferences.incognitoMode().get() || !hasTrackers) return
if (!trackPreferences.autoUpdateTrack().get()) return
val anime = currentAnime ?: return
val context = Injekt.get<Application>()
viewModelScope.launchNonCancellable {