Smart updates fix (#268)

* Allow check completed entries for update if un-tick option "Skip completed..."
* Always predict next-release date for all entries, even if it's completed.
This commit is contained in:
kana-shii 2024-08-24 05:58:11 -03:00 committed by Cuong-Tran
parent 7d5dfdf78b
commit 266f449614
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
4 changed files with 30 additions and 5 deletions

View file

@ -589,6 +589,9 @@ private fun MangaScreenSmallImpl(
// SY -->
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
// SY <--
// KMK -->
status = state.manga.status,
// KMK <--
)
}
@ -985,6 +988,9 @@ private fun MangaScreenLargeImpl(
// SY -->
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
// SY <--
// KMK -->
status = state.manga.status,
// KMK <--
)
// SY -->
metadataDescription?.invoke(

View file

@ -79,6 +79,8 @@ import eu.kanade.presentation.components.DropdownMenu
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.system.copyToClipboard
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.i18n.kmk.KMR
@ -208,13 +210,21 @@ fun MangaActionRow(
// SY -->
onMergeClicked: (() -> Unit)?,
// SY <--
// KMK -->
status: Long,
// KMK <--
modifier: Modifier = Modifier,
) {
// KMK -->
val libraryPreferences: LibraryPreferences = Injekt.get()
val restrictions = libraryPreferences.autoUpdateMangaRestrictions().get()
val isSkipCompleted = MANGA_NON_COMPLETED !in restrictions || status != SManga.COMPLETED.toLong()
// KMK <--
val defaultActionButtonColor = MaterialTheme.colorScheme.onSurface.copy(alpha = DISABLED_ALPHA)
// TODO: show something better when using custom interval
val nextUpdateDays = remember(nextUpdate) {
return@remember if (nextUpdate != null) {
return@remember if (nextUpdate != null && isSkipCompleted) {
val now = Instant.now()
now.until(nextUpdate, ChronoUnit.DAYS).toInt().coerceAtLeast(0)
} else {

View file

@ -317,7 +317,14 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
false
}
MANGA_OUTSIDE_RELEASE_PERIOD in restrictions && it.manga.nextUpdate > fetchWindowUpperBound -> {
MANGA_OUTSIDE_RELEASE_PERIOD in restrictions &&
(
it.manga.nextUpdate > fetchWindowUpperBound ||
// KMK -->
MANGA_NON_COMPLETED in restrictions &&
it.manga.status.toInt() == SManga.COMPLETED
// KMK <--
) -> {
skippedUpdates.add(
it.manga to
context.stringResource(MR.strings.skipped_reason_not_in_release_period),

View file

@ -1,6 +1,5 @@
package tachiyomi.domain.manga.model
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.model.UpdateStrategy
import tachiyomi.core.common.preference.TriState
import tachiyomi.domain.manga.interactor.GetCustomMangaInfo
@ -67,8 +66,11 @@ data class Manga(
val expectedNextUpdate: Instant?
get() = nextUpdate
.takeIf { status != SManga.COMPLETED.toLong() }
?.let { Instant.ofEpochMilli(it) }
/* KMK -->
Always predict release date even for Completed entries
.takeIf { status != SManga.COMPLETED.toLong() }?
KMK <-- */
.let { Instant.ofEpochMilli(it) }
val sorting: Long
get() = chapterFlags and CHAPTER_SORTING_MASK