From 38428c6ebeba0f87f3aabe3095a1a4d8babd94bc 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 (cherry picked from commit 14d1bcacc9cba0e14cdf90a7972bf85660465c0b) --- .../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 c8541988d..f6f0ba994 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 @@ -977,6 +977,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 { @@ -1055,10 +1063,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" - }