浏览代码

Show proper string in manga detail screen for SourceNotInstalledException

arkon 2 年之前
父节点
当前提交
14d1bcacc9
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8 7
      app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt

+ 8 - 7
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"
-    }