Show better error when trying to open RARv5 file

Co-Authored-By: arkon <4098258+arkon@users.noreply.github.com>
This commit is contained in:
Jays2Kings 2022-08-21 01:19:42 -04:00
parent c905ac8d96
commit d236536e86
2 changed files with 7 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.ui.reader.loader package eu.kanade.tachiyomi.ui.reader.loader
import com.github.junrar.exception.UnsupportedRarV5Exception
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadManager
@ -81,7 +82,11 @@ class ChapterLoader(
when (format) { when (format) {
is LocalSource.Format.Directory -> DirectoryPageLoader(format.file) is LocalSource.Format.Directory -> DirectoryPageLoader(format.file)
is LocalSource.Format.Zip -> ZipPageLoader(format.file) is LocalSource.Format.Zip -> ZipPageLoader(format.file)
is LocalSource.Format.Rar -> RarPageLoader(format.file) is LocalSource.Format.Rar -> try {
RarPageLoader(format.file)
} catch (e: UnsupportedRarV5Exception) {
error(downloadManager.context.getString(R.string.loader_rar5_error))
}
is LocalSource.Format.Epub -> EpubPageLoader(format.file) is LocalSource.Format.Epub -> EpubPageLoader(format.file)
} }
} }

View file

@ -62,6 +62,7 @@
<string name="order_by">Order by</string> <string name="order_by">Order by</string>
<string name="no_chapters_error">No chapters found</string> <string name="no_chapters_error">No chapters found</string>
<string name="no_pages_found">No pages found</string> <string name="no_pages_found">No pages found</string>
<string name="loader_rar5_error">RARv5 format is not supported</string>
<string name="remove_all_downloads">Remove all downloads?</string> <string name="remove_all_downloads">Remove all downloads?</string>
<string name="no_chapters_to_delete">No chapters to delete</string> <string name="no_chapters_to_delete">No chapters to delete</string>
<string name="by_source_order">By source\'s order</string> <string name="by_source_order">By source\'s order</string>