mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 01:39:19 +01:00
Localize "No chapters found" error
This commit is contained in:
parent
7a33e198dc
commit
66baf01e43
@ -32,6 +32,7 @@ import eu.kanade.tachiyomi.data.database.models.TrackImpl
|
|||||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||||
import eu.kanade.tachiyomi.source.Source
|
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.acquireWakeLock
|
||||||
import eu.kanade.tachiyomi.util.system.isServiceRunning
|
import eu.kanade.tachiyomi.util.system.isServiceRunning
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -398,7 +399,12 @@ class BackupRestoreService : Service() {
|
|||||||
return backupManager.restoreChapterFetchObservable(source, manga, chapters)
|
return backupManager.restoreChapterFetchObservable(source, manga, chapters)
|
||||||
// If there's any error, return empty update and continue.
|
// If there's any error, return empty update and continue.
|
||||||
.onErrorReturn {
|
.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())
|
Pair(emptyList(), emptyList())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import android.content.Intent
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Category
|
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.data.track.TrackManager
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
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.chapter.syncChaptersWithSource
|
||||||
import eu.kanade.tachiyomi.util.prepUpdateCover
|
import eu.kanade.tachiyomi.util.prepUpdateCover
|
||||||
import eu.kanade.tachiyomi.util.shouldDownloadNewChapters
|
import eu.kanade.tachiyomi.util.shouldDownloadNewChapters
|
||||||
@ -268,7 +270,12 @@ class LibraryUpdateService(
|
|||||||
updateManga(manga)
|
updateManga(manga)
|
||||||
// If there's any error, return empty update and continue.
|
// If there's any error, return empty update and continue.
|
||||||
.onErrorReturn {
|
.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())
|
Pair(emptyList(), emptyList())
|
||||||
}
|
}
|
||||||
// Filter out mangas without new chapters (or failed).
|
// Filter out mangas without new chapters (or failed).
|
||||||
|
@ -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.history.HistoryController
|
||||||
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController
|
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController
|
||||||
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
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.hasCustomCover
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
@ -696,7 +697,11 @@ class MangaController :
|
|||||||
fun onFetchChaptersError(error: Throwable) {
|
fun onFetchChaptersError(error: Throwable) {
|
||||||
isRefreshingChapters = false
|
isRefreshingChapters = false
|
||||||
updateRefreshing()
|
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) {
|
fun onChapterStatusChange(download: Download) {
|
||||||
|
@ -28,7 +28,7 @@ fun syncChaptersWithSource(
|
|||||||
source: Source
|
source: Source
|
||||||
): Pair<List<Chapter>, List<Chapter>> {
|
): Pair<List<Chapter>, List<Chapter>> {
|
||||||
if (rawSourceChapters.isEmpty()) {
|
if (rawSourceChapters.isEmpty()) {
|
||||||
throw Exception("No chapters found")
|
throw NoChaptersException()
|
||||||
}
|
}
|
||||||
|
|
||||||
val downloadManager: DownloadManager = Injekt.get()
|
val downloadManager: DownloadManager = Injekt.get()
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
package eu.kanade.tachiyomi.util.chapter
|
||||||
|
|
||||||
|
class NoChaptersException : Exception()
|
@ -524,6 +524,7 @@
|
|||||||
<string name="download_unread">Unread</string>
|
<string name="download_unread">Unread</string>
|
||||||
<string name="confirm_delete_chapters">Are you sure you want to delete the selected chapters?</string>
|
<string name="confirm_delete_chapters">Are you sure you want to delete the selected chapters?</string>
|
||||||
<string name="invalid_download_dir">Invalid download location</string>
|
<string name="invalid_download_dir">Invalid download location</string>
|
||||||
|
<string name="no_chapters_error">No chapters found</string>
|
||||||
|
|
||||||
<!-- Tracking Screen -->
|
<!-- Tracking Screen -->
|
||||||
<string name="manga_tracking_tab">Tracking</string>
|
<string name="manga_tracking_tab">Tracking</string>
|
||||||
@ -590,6 +591,10 @@
|
|||||||
<string name="transition_pages_error">Failed to load pages: %1$s</string>
|
<string name="transition_pages_error">Failed to load pages: %1$s</string>
|
||||||
<string name="page_list_empty_error">No pages found</string>
|
<string name="page_list_empty_error">No pages found</string>
|
||||||
<string name="loader_not_implemented_error">Source not found</string>
|
<string name="loader_not_implemented_error">Source not found</string>
|
||||||
|
<plurals name="missing_chapters_warning">
|
||||||
|
<item quantity="one">There is 1 missing chapter</item>
|
||||||
|
<item quantity="other">There are %d missing chapters</item>
|
||||||
|
</plurals>
|
||||||
|
|
||||||
<!-- Updates fragment -->
|
<!-- Updates fragment -->
|
||||||
<string name="updating_library">Updating library</string>
|
<string name="updating_library">Updating library</string>
|
||||||
@ -700,9 +705,4 @@
|
|||||||
<string name="tapping_inverted_horizontal">Horizontal</string>
|
<string name="tapping_inverted_horizontal">Horizontal</string>
|
||||||
<string name="tapping_inverted_vertical">Vertical</string>
|
<string name="tapping_inverted_vertical">Vertical</string>
|
||||||
<string name="tapping_inverted_both">Both</string>
|
<string name="tapping_inverted_both">Both</string>
|
||||||
|
|
||||||
<plurals name="missing_chapters_warning">
|
|
||||||
<item quantity="one">There is 1 missing chapter</item>
|
|
||||||
<item quantity="other">There are %d missing chapters</item>
|
|
||||||
</plurals>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user