Retain remote last chapter read if it's higher than the local one for EnhancedTracker (mihonapp/mihon#1301)
(cherry picked from commit 44aab7a2437ffdab354ee5ed82593fbaabb06a64)
This commit is contained in:
parent
e7d4065c2a
commit
774f99e0b6
1 changed files with 3 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import tachiyomi.domain.track.interactor.InsertTrack
|
|||
import tachiyomi.domain.track.model.Track
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import kotlin.math.max
|
||||
|
||||
class SyncChapterProgressWithTrack(
|
||||
private val updateChapter: UpdateChapter,
|
||||
|
|
@ -59,7 +60,8 @@ class SyncChapterProgressWithTrack(
|
|||
// only take into account continuous reading
|
||||
val localLastRead = sortedChapters.takeWhile { it.read }.lastOrNull()?.chapterNumber ?: 0F
|
||||
// Tracker will update to latest read chapter
|
||||
val updatedTrack = remoteTrack.copy(lastChapterRead = localLastRead.toDouble())
|
||||
val lastRead = max(remoteTrack.lastChapterRead, localLastRead.toDouble())
|
||||
val updatedTrack = remoteTrack.copy(lastChapterRead = lastRead)
|
||||
|
||||
try {
|
||||
// Update Tracker to localLastRead if needed
|
||||
|
|
|
|||
Loading…
Reference in a new issue