From 3c252f27c43d4f11d99a27c2ed789013638e7681 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 19 Aug 2021 08:02:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/data/entities/BookSource.kt | 13 +++++++++++++ app/src/main/java/io/legado/app/model/ReadBook.kt | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index aa47ad73c..45152370c 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -190,6 +190,19 @@ data class BookSource( private fun equal(a: String?, b: String?) = a == b || (a.isNullOrEmpty() && b.isNullOrEmpty()) class Converters { + @TypeConverter + fun loginRuleTString(loginRule: LoginRule?): String = GSON.toJson(loginRule) + + @TypeConverter + fun stringToLoginRule(json: String?): LoginRule? { + json ?: return null + return if (json.isJsonObject()) { + GSON.fromJsonObject(json) + } else { + LoginRule(url = json) + } + } + @TypeConverter fun exploreRuleToString(exploreRule: ExploreRule?): String = GSON.toJson(exploreRule) diff --git a/app/src/main/java/io/legado/app/model/ReadBook.kt b/app/src/main/java/io/legado/app/model/ReadBook.kt index 041e75e8b..ad51bd6d6 100644 --- a/app/src/main/java/io/legado/app/model/ReadBook.kt +++ b/app/src/main/java/io/legado/app/model/ReadBook.kt @@ -217,7 +217,7 @@ object ReadBook { book?.let { book -> //最后一章时检查更新 if (durChapterPos == 0 && durChapterIndex == chapterSize - 1 && book.isOnLineTxt()) { - callBack?.loadChapterList(book) + } } }