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:
parent
7d5dfdf78b
commit
266f449614
4 changed files with 30 additions and 5 deletions
|
|
@ -589,6 +589,9 @@ private fun MangaScreenSmallImpl(
|
||||||
// SY -->
|
// SY -->
|
||||||
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
|
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
|
||||||
// SY <--
|
// SY <--
|
||||||
|
// KMK -->
|
||||||
|
status = state.manga.status,
|
||||||
|
// KMK <--
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -985,6 +988,9 @@ private fun MangaScreenLargeImpl(
|
||||||
// SY -->
|
// SY -->
|
||||||
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
|
onMergeClicked = onMergeClicked.takeUnless { state.showMergeInOverflow },
|
||||||
// SY <--
|
// SY <--
|
||||||
|
// KMK -->
|
||||||
|
status = state.manga.status,
|
||||||
|
// KMK <--
|
||||||
)
|
)
|
||||||
// SY -->
|
// SY -->
|
||||||
metadataDescription?.invoke(
|
metadataDescription?.invoke(
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@ import eu.kanade.presentation.components.DropdownMenu
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
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.domain.manga.model.Manga
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.i18n.kmk.KMR
|
import tachiyomi.i18n.kmk.KMR
|
||||||
|
|
@ -208,13 +210,21 @@ fun MangaActionRow(
|
||||||
// SY -->
|
// SY -->
|
||||||
onMergeClicked: (() -> Unit)?,
|
onMergeClicked: (() -> Unit)?,
|
||||||
// SY <--
|
// SY <--
|
||||||
|
// KMK -->
|
||||||
|
status: Long,
|
||||||
|
// KMK <--
|
||||||
modifier: Modifier = Modifier,
|
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)
|
val defaultActionButtonColor = MaterialTheme.colorScheme.onSurface.copy(alpha = DISABLED_ALPHA)
|
||||||
|
|
||||||
// TODO: show something better when using custom interval
|
// TODO: show something better when using custom interval
|
||||||
val nextUpdateDays = remember(nextUpdate) {
|
val nextUpdateDays = remember(nextUpdate) {
|
||||||
return@remember if (nextUpdate != null) {
|
return@remember if (nextUpdate != null && isSkipCompleted) {
|
||||||
val now = Instant.now()
|
val now = Instant.now()
|
||||||
now.until(nextUpdate, ChronoUnit.DAYS).toInt().coerceAtLeast(0)
|
now.until(nextUpdate, ChronoUnit.DAYS).toInt().coerceAtLeast(0)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,14 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
||||||
false
|
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(
|
skippedUpdates.add(
|
||||||
it.manga to
|
it.manga to
|
||||||
context.stringResource(MR.strings.skipped_reason_not_in_release_period),
|
context.stringResource(MR.strings.skipped_reason_not_in_release_period),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package tachiyomi.domain.manga.model
|
package tachiyomi.domain.manga.model
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
|
||||||
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
import eu.kanade.tachiyomi.source.model.UpdateStrategy
|
||||||
import tachiyomi.core.common.preference.TriState
|
import tachiyomi.core.common.preference.TriState
|
||||||
import tachiyomi.domain.manga.interactor.GetCustomMangaInfo
|
import tachiyomi.domain.manga.interactor.GetCustomMangaInfo
|
||||||
|
|
@ -67,8 +66,11 @@ data class Manga(
|
||||||
|
|
||||||
val expectedNextUpdate: Instant?
|
val expectedNextUpdate: Instant?
|
||||||
get() = nextUpdate
|
get() = nextUpdate
|
||||||
.takeIf { status != SManga.COMPLETED.toLong() }
|
/* KMK -->
|
||||||
?.let { Instant.ofEpochMilli(it) }
|
Always predict release date even for Completed entries
|
||||||
|
.takeIf { status != SManga.COMPLETED.toLong() }?
|
||||||
|
KMK <-- */
|
||||||
|
.let { Instant.ofEpochMilli(it) }
|
||||||
|
|
||||||
val sorting: Long
|
val sorting: Long
|
||||||
get() = chapterFlags and CHAPTER_SORTING_MASK
|
get() = chapterFlags and CHAPTER_SORTING_MASK
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue