Use previously updated track item when binding start date

Fixes #9743
This commit is contained in:
arkon 2023-07-22 09:32:17 -04:00
parent 8d00ff1b40
commit 46e3b9e40d
2 changed files with 9 additions and 6 deletions

View File

@ -110,7 +110,7 @@ abstract class TrackService(val id: Long) {
val hasReadChapters = allChapters.any { it.read }
bind(item, hasReadChapters)
val track = item.toDomainTrack(idRequired = false) ?: return@withIOContext
var track = item.toDomainTrack(idRequired = false) ?: return@withIOContext
Injekt.get<InsertTrack>().await(track)
@ -123,10 +123,10 @@ abstract class TrackService(val id: Long) {
?.chapterNumber?.toDouble() ?: -1.0
if (latestLocalReadChapterNumber > track.lastChapterRead) {
val updatedTrack = track.copy(
track = track.copy(
lastChapterRead = latestLocalReadChapterNumber,
)
setRemoteLastChapterRead(updatedTrack.toDbTrack(), latestLocalReadChapterNumber.toInt())
setRemoteLastChapterRead(track.toDbTrack(), latestLocalReadChapterNumber.toInt())
}
if (track.startDate <= 0) {
@ -137,6 +137,9 @@ abstract class TrackService(val id: Long) {
firstReadChapterDate?.let {
val startDate = firstReadChapterDate.time.convertEpochMillisZone(ZoneOffset.systemDefault(), ZoneOffset.UTC)
track = track.copy(
startDate = startDate,
)
setRemoteStartDate(track.toDbTrack(), startDate)
}
}

View File

@ -2,8 +2,8 @@
package androidx.recyclerview.widget
import android.content.Context
import androidx.recyclerview.widget.RecyclerView.NO_POSITION
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
/**
* Layout manager used by the webtoon viewer. Item prefetch is disabled because the extra layout
@ -13,12 +13,12 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
* This layout manager uses the same package name as the support library in order to use a package
* protected method.
*/
class WebtoonLayoutManager(activity: ReaderActivity) : LinearLayoutManager(activity) {
class WebtoonLayoutManager(context: Context) : LinearLayoutManager(context) {
/**
* Extra layout space is set to half the screen height.
*/
private val extraLayoutSpace = activity.resources.displayMetrics.heightPixels / 2
private val extraLayoutSpace = context.resources.displayMetrics.heightPixels / 2
init {
isItemPrefetchEnabled = false