Fix an issue where tracker reading progress is changed to a lower value (mihonapp/mihon#1795)
(cherry picked from commit 2e2f1ed82d63a93ebf87ee8494434c1bad2e268c)
This commit is contained in:
parent
7d38c10776
commit
9183c19cd2
2 changed files with 26 additions and 0 deletions
|
|
@ -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 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 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 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
|
### Removed
|
||||||
- Remove alphabetical category sort option
|
- Remove alphabetical category sort option
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,8 @@ import tachiyomi.source.local.isLocal
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import kotlin.collections.filter
|
||||||
|
import kotlin.collections.forEach
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
import androidx.compose.runtime.State as RuntimeState
|
import androidx.compose.runtime.State as RuntimeState
|
||||||
|
|
||||||
|
|
@ -1348,6 +1350,8 @@ class MangaScreenModel(
|
||||||
return@launchIO
|
return@launchIO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshTrackers()
|
||||||
|
|
||||||
val tracks = getTracks.await(mangaId)
|
val tracks = getTracks.await(mangaId)
|
||||||
val maxChapterNumber = chapters.maxOf { it.chapterNumber }
|
val maxChapterNumber = chapters.maxOf { it.chapterNumber }
|
||||||
val shouldPromptTrackingUpdate = tracks.any { track -> maxChapterNumber > track.lastChapterRead }
|
val shouldPromptTrackingUpdate = tracks.any { track -> maxChapterNumber > track.lastChapterRead }
|
||||||
|
|
@ -1374,6 +1378,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.
|
* Downloads the given list of chapters with the manager.
|
||||||
* @param chapters the list of chapters to download.
|
* @param chapters the list of chapters to download.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue