mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Localize "Page list is empty" exception message
This commit is contained in:
		| @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.download | ||||
| import android.content.Context | ||||
| import com.hippo.unifile.UniFile | ||||
| import com.jakewharton.rxrelay.BehaviorRelay | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.database.models.Chapter | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| import eu.kanade.tachiyomi.data.download.model.Download | ||||
| @@ -152,7 +153,7 @@ class DownloadManager(private val context: Context) { | ||||
|                 .filter { "image" in it.type.orEmpty() } | ||||
|  | ||||
|             if (files.isEmpty()) { | ||||
|                 throw Exception("Page list is empty") | ||||
|                 throw Exception(context.getString(R.string.page_list_empty_error)) | ||||
|             } | ||||
|  | ||||
|             files.sortedBy { it.name } | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import android.webkit.MimeTypeMap | ||||
| import com.hippo.unifile.UniFile | ||||
| import com.jakewharton.rxrelay.BehaviorRelay | ||||
| import com.jakewharton.rxrelay.PublishRelay | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.cache.ChapterCache | ||||
| import eu.kanade.tachiyomi.data.database.models.Chapter | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| @@ -276,7 +277,7 @@ class Downloader( | ||||
|             download.source.fetchPageList(download.chapter) | ||||
|                 .doOnNext { pages -> | ||||
|                     if (pages.isEmpty()) { | ||||
|                         throw Exception("Page list is empty") | ||||
|                         throw Exception(context.getString(R.string.page_list_empty_error)) | ||||
|                     } | ||||
|                     download.pages = pages | ||||
|                 } | ||||
|   | ||||
| @@ -225,8 +225,9 @@ class ReaderPresenter( | ||||
|         this.manga = manga | ||||
|         if (chapterId == -1L) chapterId = initialChapterId | ||||
|  | ||||
|         val context = Injekt.get<Application>() | ||||
|         val source = sourceManager.getOrStub(manga.source) | ||||
|         loader = ChapterLoader(downloadManager, manga, source) | ||||
|         loader = ChapterLoader(context, downloadManager, manga, source) | ||||
|  | ||||
|         Observable.just(manga).subscribeLatestCache(ReaderActivity::setManga) | ||||
|         viewerChaptersRelay.subscribeLatestCache(ReaderActivity::setChapters) | ||||
|   | ||||
| @@ -1,5 +1,7 @@ | ||||
| package eu.kanade.tachiyomi.ui.reader.loader | ||||
|  | ||||
| import android.content.Context | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| import eu.kanade.tachiyomi.data.download.DownloadManager | ||||
| import eu.kanade.tachiyomi.source.LocalSource | ||||
| @@ -16,6 +18,7 @@ import timber.log.Timber | ||||
|  * Loader used to retrieve the [PageLoader] for a given chapter. | ||||
|  */ | ||||
| class ChapterLoader( | ||||
|     private val context: Context, | ||||
|     private val downloadManager: DownloadManager, | ||||
|     private val manga: Manga, | ||||
|     private val source: Source | ||||
| @@ -46,7 +49,7 @@ class ChapterLoader( | ||||
|             .observeOn(AndroidSchedulers.mainThread()) | ||||
|             .doOnNext { pages -> | ||||
|                 if (pages.isEmpty()) { | ||||
|                     throw Exception("Page list is empty") | ||||
|                     throw Exception(context.getString(R.string.page_list_empty_error)) | ||||
|                 } | ||||
|  | ||||
|                 chapter.state = ReaderChapter.State.Loaded(pages) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user