mirror of
https://github.com/mihonapp/mihon.git
synced 2025-05-05 02:26:30 +02:00
Fix an issue where tracker reading progress is changed to a lower value (#1795)
This commit is contained in:
parent
b2765a00d2
commit
2e2f1ed82d
@ -36,6 +36,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||
- Fix App's preferences referencing deleted categories ([@cuong-tran](https://github.com/cuong-tran)) ([#1734](https://github.com/mihonapp/mihon/pull/1734))
|
||||
- Fix backup/restore of category related preferences ([@cuong-tran](https://github.com/cuong-tran)) ([#1726](https://github.com/mihonapp/mihon/pull/1726))
|
||||
- Fix WebView sending app's package name in `X-Requested-With` header, which led to sources blocking access ([@AwkwardPeak7](https://github.com/AwkwardPeak7)) ([#1812](https://github.com/mihonapp/mihon/pull/1812))
|
||||
- Fix an issue where tracker reading progress is changed to a lower value ([@Animeboynz](https://github.com/Animeboynz)) ([#1795](https://github.com/mihonapp/mihon/pull/1795))
|
||||
|
||||
### Removed
|
||||
- Remove alphabetical category sort option
|
||||
|
@ -24,6 +24,7 @@ import eu.kanade.domain.manga.model.chaptersFiltered
|
||||
import eu.kanade.domain.manga.model.downloadedFilter
|
||||
import eu.kanade.domain.manga.model.toSManga
|
||||
import eu.kanade.domain.track.interactor.AddTracks
|
||||
import eu.kanade.domain.track.interactor.RefreshTracks
|
||||
import eu.kanade.domain.track.interactor.TrackChapter
|
||||
import eu.kanade.domain.track.model.AutoTrackState
|
||||
import eu.kanade.domain.track.service.TrackPreferences
|
||||
@ -87,6 +88,8 @@ import tachiyomi.i18n.MR
|
||||
import tachiyomi.source.local.isLocal
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import kotlin.collections.filter
|
||||
import kotlin.collections.forEach
|
||||
import kotlin.math.floor
|
||||
|
||||
class MangaScreenModel(
|
||||
@ -741,6 +744,8 @@ class MangaScreenModel(
|
||||
return@launchIO
|
||||
}
|
||||
|
||||
refreshTrackers()
|
||||
|
||||
val tracks = getTracks.await(mangaId)
|
||||
val maxChapterNumber = chapters.maxOf { it.chapterNumber }
|
||||
val shouldPromptTrackingUpdate = tracks.any { track -> maxChapterNumber > track.lastChapterRead }
|
||||
@ -767,6 +772,27 @@ class MangaScreenModel(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun refreshTrackers(
|
||||
refreshTracks: RefreshTracks = Injekt.get(),
|
||||
) {
|
||||
refreshTracks.await(mangaId)
|
||||
.filter { it.first != null }
|
||||
.forEach { (track, e) ->
|
||||
logcat(LogPriority.ERROR, e) {
|
||||
"Failed to refresh track data mangaId=$mangaId for service ${track!!.id}"
|
||||
}
|
||||
withUIContext {
|
||||
context.toast(
|
||||
context.stringResource(
|
||||
MR.strings.track_error,
|
||||
track!!.name,
|
||||
e.message ?: "",
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the given list of chapters with the manager.
|
||||
* @param chapters the list of chapters to download.
|
||||
|
Loading…
x
Reference in New Issue
Block a user