From 14d1bcacc9cba0e14cdf90a7972bf85660465c0b Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 19 Mar 2023 17:23:51 -0400 Subject: [PATCH] Show proper string in manga detail screen for SourceNotInstalledException --- .../kanade/tachiyomi/ui/manga/MangaScreenModel.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 25465884c..019086385 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -954,6 +954,14 @@ class MangaInfoScreenModel( } } } + + private val Throwable.snackbarMessage: String + get() = when (val className = this::class.simpleName) { + null -> message ?: "" + "SourceNotInstalledException" -> context.getString(R.string.loader_not_implemented_error) + "Exception", "HttpException", "IOException" -> message ?: className + else -> "$className: $message" + } } sealed class MangaScreenState { @@ -1014,10 +1022,3 @@ val chapterDecimalFormat = DecimalFormat( DecimalFormatSymbols() .apply { decimalSeparator = '.' }, ) - -private val Throwable.snackbarMessage: String - get() = when (val className = this::class.simpleName) { - null -> message ?: "" - "Exception", "HttpException", "IOException", "SourceNotInstalledException" -> message ?: className - else -> "$className: $message" - }