From b8cdb9d55e268d5fd9f232b2ad148e412503e668 Mon Sep 17 00:00:00 2001 From: LuftVerbot <97435834+LuftVerbot@users.noreply.github.com> Date: Mon, 20 Nov 2023 21:47:46 +0100 Subject: [PATCH] small Episode Tracker change --- .../eu/kanade/domain/track/anime/interactor/TrackEpisode.kt | 6 +++--- .../java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/track/anime/interactor/TrackEpisode.kt b/app/src/main/java/eu/kanade/domain/track/anime/interactor/TrackEpisode.kt index cf67d18a4..86d854796 100644 --- a/app/src/main/java/eu/kanade/domain/track/anime/interactor/TrackEpisode.kt +++ b/app/src/main/java/eu/kanade/domain/track/anime/interactor/TrackEpisode.kt @@ -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 } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt index 437d14bd1..6b6d03d8a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerViewModel.kt @@ -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() viewModelScope.launchNonCancellable {