mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 13:48:55 +03:00
small Episode Tracker change
This commit is contained in:
parent
f6d430df6c
commit
b8cdb9d55e
2 changed files with 4 additions and 5 deletions
|
@ -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.service.DelayedAnimeTrackingUpdateJob
|
||||||
import eu.kanade.domain.track.anime.store.DelayedAnimeTrackingStore
|
import eu.kanade.domain.track.anime.store.DelayedAnimeTrackingStore
|
||||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||||
|
import eu.kanade.tachiyomi.util.system.isOnline
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.awaitAll
|
import kotlinx.coroutines.awaitAll
|
||||||
import kotlinx.coroutines.coroutineScope
|
import kotlinx.coroutines.coroutineScope
|
||||||
|
@ -34,13 +35,12 @@ class TrackEpisode(
|
||||||
|
|
||||||
async {
|
async {
|
||||||
runCatching {
|
runCatching {
|
||||||
try {
|
if (context.isOnline()) {
|
||||||
service.animeService.update(updatedTrack.toDbTrack(), true)
|
service.animeService.update(updatedTrack.toDbTrack(), true)
|
||||||
insertTrack.await(updatedTrack)
|
insertTrack.await(updatedTrack)
|
||||||
} catch (e: Exception) {
|
} else {
|
||||||
delayedTrackingStore.addAnimeItem(updatedTrack)
|
delayedTrackingStore.addAnimeItem(updatedTrack)
|
||||||
DelayedAnimeTrackingUpdateJob.setupTask(context)
|
DelayedAnimeTrackingUpdateJob.setupTask(context)
|
||||||
throw e
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,11 +573,10 @@ class PlayerViewModel @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTrackEpisodeSeen(episode: Episode) {
|
private fun updateTrackEpisodeSeen(episode: Episode) {
|
||||||
if (basePreferences.incognitoMode().get()) return
|
if (basePreferences.incognitoMode().get() || !hasTrackers) return
|
||||||
if (!trackPreferences.autoUpdateTrack().get()) return
|
if (!trackPreferences.autoUpdateTrack().get()) return
|
||||||
|
|
||||||
val anime = currentAnime ?: return
|
val anime = currentAnime ?: return
|
||||||
|
|
||||||
val context = Injekt.get<Application>()
|
val context = Injekt.get<Application>()
|
||||||
|
|
||||||
viewModelScope.launchNonCancellable {
|
viewModelScope.launchNonCancellable {
|
||||||
|
|
Loading…
Reference in a new issue