fixed autosync

This commit is contained in:
LagradOst 2022-04-13 19:42:02 +02:00
parent e5515b575c
commit ef00cf6589

View file

@ -387,6 +387,8 @@ class GeneratorPlayer : FullScreenPlayer() {
super.onDestroy()
}
var maxEpisodeSet: Int? = null
override fun playerPositionChanged(posDur: Pair<Long, Long>) {
val (position, duration) = posDur
viewModel.getId()?.let {
@ -434,7 +436,9 @@ class GeneratorPlayer : FullScreenPlayer() {
var isOpVisible = false
when (val meta = currentMeta) {
is ResultEpisode -> {
if (percentage >= UPDATE_SYNC_PROGRESS_PERCENTAGE) {
if (percentage >= UPDATE_SYNC_PROGRESS_PERCENTAGE && (maxEpisodeSet
?: -1) < meta.episode
) {
context?.let { ctx ->
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
if (settingsManager.getBoolean(
@ -442,6 +446,7 @@ class GeneratorPlayer : FullScreenPlayer() {
true
)
)
maxEpisodeSet = meta.episode
sync.modifyMaxEpisode(meta.episode)
}
}