diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt index bf832a8fc..b13b29049 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt @@ -32,6 +32,7 @@ import eu.kanade.tachiyomi.data.database.models.TrackImpl import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.source.Source +import eu.kanade.tachiyomi.util.chapter.NoChaptersException import eu.kanade.tachiyomi.util.system.acquireWakeLock import eu.kanade.tachiyomi.util.system.isServiceRunning import java.io.File @@ -398,7 +399,12 @@ class BackupRestoreService : Service() { return backupManager.restoreChapterFetchObservable(source, manga, chapters) // If there's any error, return empty update and continue. .onErrorReturn { - errors.add(Date() to "${manga.title} - ${it.message}") + val errorMessage = if (it is NoChaptersException) { + getString(R.string.no_chapters_error) + } else { + it.message + } + errors.add(Date() to "${manga.title} - $errorMessage") Pair(emptyList(), emptyList()) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 597376e5a..faff75b9f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -6,6 +6,7 @@ import android.content.Intent import android.os.Build import android.os.IBinder import android.os.PowerManager +import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.database.DatabaseHelper import eu.kanade.tachiyomi.data.database.models.Category @@ -21,6 +22,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.model.SManga +import eu.kanade.tachiyomi.util.chapter.NoChaptersException import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource import eu.kanade.tachiyomi.util.prepUpdateCover import eu.kanade.tachiyomi.util.shouldDownloadNewChapters @@ -268,7 +270,12 @@ class LibraryUpdateService( updateManga(manga) // If there's any error, return empty update and continue. .onErrorReturn { - failedUpdates.add(Pair(manga, it.message)) + val errorMessage = if (it is NoChaptersException) { + getString(R.string.no_chapters_error) + } else { + it.message + } + failedUpdates.add(Pair(manga, errorMessage)) Pair(emptyList(), emptyList()) } // Filter out mangas without new chapters (or failed). diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index 39a0e4e58..ec2159eb7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -65,6 +65,7 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.recent.history.HistoryController import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController import eu.kanade.tachiyomi.ui.webview.WebViewActivity +import eu.kanade.tachiyomi.util.chapter.NoChaptersException import eu.kanade.tachiyomi.util.hasCustomCover import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.toast @@ -696,7 +697,11 @@ class MangaController : fun onFetchChaptersError(error: Throwable) { isRefreshingChapters = false updateRefreshing() - activity?.toast(error.message) + if (error is NoChaptersException) { + activity?.toast(activity?.getString(R.string.no_chapters_error)) + } else { + activity?.toast(error.message) + } } fun onChapterStatusChange(download: Download) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt index be4a87dc8..3c665723d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/ChapterSourceSync.kt @@ -28,7 +28,7 @@ fun syncChaptersWithSource( source: Source ): Pair, List> { if (rawSourceChapters.isEmpty()) { - throw Exception("No chapters found") + throw NoChaptersException() } val downloadManager: DownloadManager = Injekt.get() diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/chapter/NoChaptersException.kt b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/NoChaptersException.kt new file mode 100644 index 000000000..180179248 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/util/chapter/NoChaptersException.kt @@ -0,0 +1,3 @@ +package eu.kanade.tachiyomi.util.chapter + +class NoChaptersException : Exception() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 31bff21d2..7e1bfd788 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -524,6 +524,7 @@ Unread Are you sure you want to delete the selected chapters? Invalid download location + No chapters found Tracking @@ -590,6 +591,10 @@ Failed to load pages: %1$s No pages found Source not found + + There is 1 missing chapter + There are %d missing chapters + Updating library @@ -700,9 +705,4 @@ Horizontal Vertical Both - - - There is 1 missing chapter - There are %d missing chapters -