From a7f6155627c846088552b50e7357248e33c4a549 Mon Sep 17 00:00:00 2001 From: Jobobby04 Date: Sun, 18 Feb 2024 11:47:19 -0500 Subject: [PATCH 1/6] Ignore chapters with 0 or under chapter numbers (cherry picked from commit d8082de1db35997874421e4dabcc53debea9dce7) --- .../kanade/tachiyomi/data/library/LibraryUpdateJob.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt index a88c8b9314ce..96c010cb5a77 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt @@ -28,7 +28,6 @@ import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.track.TrackStatus import eu.kanade.tachiyomi.data.track.TrackerManager -import eu.kanade.tachiyomi.source.UnmeteredSource import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.UpdateStrategy import eu.kanade.tachiyomi.source.online.all.MergedSource @@ -64,6 +63,7 @@ import tachiyomi.core.common.util.system.logcat import tachiyomi.domain.UnsortedPreferences import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.model.Category +import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.NoChaptersException import tachiyomi.domain.download.service.DownloadPreferences @@ -101,7 +101,6 @@ import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicInteger -import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId class LibraryUpdateJob(private val context: Context, workerParams: WorkerParameters) : CoroutineWorker(context, workerParams) { @@ -400,8 +399,12 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet .sortedByDescending { it.sourceOrder }.run { if (libraryPreferences.libraryReadDuplicateChapters().get()) { val readChapters = getChaptersByMangaId.await(manga.id).filter { it.read } - val newReadChapters = this.filter { chapter -> readChapters.any { it.chapterNumber == chapter.chapterNumber } } - .also { setReadStatus.await(true, *it.toTypedArray()) } + val newReadChapters = this.filter { chapter -> + chapter.chapterNumber > 0 && + readChapters.any { it.chapterNumber == chapter.chapterNumber } + } + + setReadStatus.await(true, *newReadChapters.toTypedArray()) this.filterNot { newReadChapters.contains(it) } } else { From dae034871012d7a3fd7196fc5603ce55bca94f77 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:19:55 +0600 Subject: [PATCH 2/6] Don't add custom User Agent for MAL Closes #298 (cherry picked from commit 7974a1fc0c2b0e237d5704a033a60ec0fd60cdbc) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt --- .../tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt index 5dd356b96eb3..38cad3eea6c3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt @@ -32,7 +32,7 @@ class MyAnimeListInterceptor(private val myanimelist: MyAnimeList) : Interceptor // Add the authorization header to the original request val authRequest = originalRequest.newBuilder() .addHeader("Authorization", "Bearer ${oauth!!.access_token}") - .header("User-Agent", "TachiyomiSY v${BuildConfig.VERSION_NAME} (${BuildConfig.APPLICATION_ID})") + // .header("User-Agent", "TachiyomiSY v${BuildConfig.VERSION_NAME} (${BuildConfig.APPLICATION_ID})") .build() return chain.proceed(authRequest) From 589b33a673b3f0b75be1e1caa8b0965ae7454cd1 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:54:24 +0600 Subject: [PATCH 3/6] Fix detekt issue (cherry picked from commit 9254079957e383e4aa5c914ccd9705612e0892d0) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt --- .../tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt index 38cad3eea6c3..8faff1e19f36 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListInterceptor.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.data.track.myanimelist -import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.network.parseAs import kotlinx.serialization.json.Json import okhttp3.Interceptor @@ -32,6 +31,7 @@ class MyAnimeListInterceptor(private val myanimelist: MyAnimeList) : Interceptor // Add the authorization header to the original request val authRequest = originalRequest.newBuilder() .addHeader("Authorization", "Bearer ${oauth!!.access_token}") + // TODO(antsy): Add back custom user agent when they stop blocking us for no apparent reason // .header("User-Agent", "TachiyomiSY v${BuildConfig.VERSION_NAME} (${BuildConfig.APPLICATION_ID})") .build() From 86722a31d03d013696edfb8d6a5662a597b5b652 Mon Sep 17 00:00:00 2001 From: MajorTanya <39014446+MajorTanya@users.noreply.github.com> Date: Sun, 18 Feb 2024 19:57:50 +0100 Subject: [PATCH 4/6] Fix DelayedTrackingUpdateJob spam on update errors (#411) * Fix DelayedTrackingUpdateJob spam on update errors DelayedTrackingUpdateJob would start spamming when it encountered an error (e.g. a tracker has an issue) and never stop. This seems to stem from a circular dependency between the Job's `doWork` and TrackChapter's `await`. TrackChapter sets up a completely new instance of the DelayedTrackingUpdateJob if any Exception was thrown during the track update. This causes the Job to get replaced (as per the WorkManager's set ExistingWorkPolicy). Because of this, the guard clause at the start of doWork would never trigger, as all instances of the Job would report being the 0th try (because they were completely new instances). This simple fix introduces a boolean `isRetry` parameter to TrackChapter's await method, which is set to `false` by default. DelayedTrackingUpdateJob however sets this parameter to `true`, which means TrackChapter won't try to set up the Job again. * Rename isRetry parameter to setupJobOnFailure This also inverts the logic, so true & false were swapped. (cherry picked from commit 617bf491eee1d1010dc23c3f6df5d148700feb44) --- .../java/eu/kanade/domain/track/interactor/TrackChapter.kt | 6 ++++-- .../kanade/domain/track/service/DelayedTrackingUpdateJob.kt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt b/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt index 8fa0b00a3402..0fcdd5e16eff 100644 --- a/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt +++ b/app/src/main/java/eu/kanade/domain/track/interactor/TrackChapter.kt @@ -23,7 +23,7 @@ class TrackChapter( private val delayedTrackingStore: DelayedTrackingStore, ) { - suspend fun await(context: Context, mangaId: Long, chapterNumber: Double) { + suspend fun await(context: Context, mangaId: Long, chapterNumber: Double, setupJobOnFailure: Boolean = true) { withNonCancellableContext { val tracks = getTracks.await(mangaId) if (tracks.isEmpty()) return@withNonCancellableContext @@ -50,7 +50,9 @@ class TrackChapter( delayedTrackingStore.remove(track.id) } catch (e: Exception) { delayedTrackingStore.add(track.id, chapterNumber) - DelayedTrackingUpdateJob.setupTask(context) + if (setupJobOnFailure) { + DelayedTrackingUpdateJob.setupTask(context) + } throw e } } diff --git a/app/src/main/java/eu/kanade/domain/track/service/DelayedTrackingUpdateJob.kt b/app/src/main/java/eu/kanade/domain/track/service/DelayedTrackingUpdateJob.kt index 1f4e246dc91c..50589ae9d639 100644 --- a/app/src/main/java/eu/kanade/domain/track/service/DelayedTrackingUpdateJob.kt +++ b/app/src/main/java/eu/kanade/domain/track/service/DelayedTrackingUpdateJob.kt @@ -45,7 +45,7 @@ class DelayedTrackingUpdateJob(private val context: Context, workerParams: Worke logcat(LogPriority.DEBUG) { "Updating delayed track item: ${track.mangaId}, last chapter read: ${track.lastChapterRead}" } - trackChapter.await(context, track.mangaId, track.lastChapterRead) + trackChapter.await(context, track.mangaId, track.lastChapterRead, setupJobOnFailure = false) } } From 97f22c500ba061446291417727dd8af0c310563f Mon Sep 17 00:00:00 2001 From: Jobobby04 Date: Sat, 2 Mar 2024 15:38:05 -0500 Subject: [PATCH 5/6] 1.10.5 --- .github/ISSUE_TEMPLATE/report_issue.yml | 4 ++-- .github/ISSUE_TEMPLATE/request_feature.yml | 2 +- app/build.gradle.kts | 4 ++-- app/src/main/res/raw/changelog_release.xml | 5 +++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/report_issue.yml b/.github/ISSUE_TEMPLATE/report_issue.yml index f87c37617a5e..ef055d726323 100644 --- a/.github/ISSUE_TEMPLATE/report_issue.yml +++ b/.github/ISSUE_TEMPLATE/report_issue.yml @@ -53,7 +53,7 @@ body: label: TachiyomiSY version description: You can find your TachiyomiSY version in **More → About**. placeholder: | - Example: "1.10.4" + Example: "1.10.5" validations: required: true @@ -96,7 +96,7 @@ body: required: true - label: I have gone through the [FAQ](https://mihon.app/docs/faq/general) and [troubleshooting guide](https:/mihon.app/docs/guides/troubleshooting/). required: true - - label: I have updated the app to version **[1.10.4](https://github.com/jobobby04/tachiyomisy/releases/latest)**. + - label: I have updated the app to version **[1.10.5](https://github.com/jobobby04/tachiyomisy/releases/latest)**. required: true - label: I have updated all installed extensions. required: true diff --git a/.github/ISSUE_TEMPLATE/request_feature.yml b/.github/ISSUE_TEMPLATE/request_feature.yml index 735158e269cb..045896b29573 100644 --- a/.github/ISSUE_TEMPLATE/request_feature.yml +++ b/.github/ISSUE_TEMPLATE/request_feature.yml @@ -31,7 +31,7 @@ body: required: true - label: I have written a short but informative title. required: true - - label: I have updated the app to version **[1.10.4](https://github.com/jobobby04/tachiyomisy/releases/latest)**. + - label: I have updated the app to version **[1.10.5](https://github.com/jobobby04/tachiyomisy/releases/latest)**. required: true - label: I will fill out all of the requested information in this form. required: true diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8578a543532b..31f0822ed574 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -26,8 +26,8 @@ android { defaultConfig { applicationId = "eu.kanade.tachiyomi.sy" - versionCode = 64 - versionName = "1.10.4" + versionCode = 65 + versionName = "1.10.5" buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"") diff --git a/app/src/main/res/raw/changelog_release.xml b/app/src/main/res/raw/changelog_release.xml index 3ef4fbe4b372..dcd26c688409 100755 --- a/app/src/main/res/raw/changelog_release.xml +++ b/app/src/main/res/raw/changelog_release.xml @@ -1,5 +1,10 @@ + + [b]Based on Mihon stable 0.16.4(from 0.16.3)[/b] + Minor fix for mark duplicate chapters as read + Include the delayed tracker update fix + Hotfix for 1.10.3 From 6c563d76191160bfb9bc16e599f2d2eeb91d3a55 Mon Sep 17 00:00:00 2001 From: Jobobby04 Date: Sat, 2 Mar 2024 15:34:28 -0500 Subject: [PATCH 6/6] Fix for duplicate read --- .../java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt index 96c010cb5a77..31229ae644c5 100755 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt @@ -404,7 +404,9 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet readChapters.any { it.chapterNumber == chapter.chapterNumber } } - setReadStatus.await(true, *newReadChapters.toTypedArray()) + if (newReadChapters.isNotEmpty()) { + setReadStatus.await(true, *newReadChapters.toTypedArray()) + } this.filterNot { newReadChapters.contains(it) } } else {