pull/1251/head
gedoor 3 years ago
parent 2d059e66f2
commit 3c252f27c4
  1. 13
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  2. 2
      app/src/main/java/io/legado/app/model/ReadBook.kt

@ -190,6 +190,19 @@ data class BookSource(
private fun equal(a: String?, b: String?) = a == b || (a.isNullOrEmpty() && b.isNullOrEmpty()) private fun equal(a: String?, b: String?) = a == b || (a.isNullOrEmpty() && b.isNullOrEmpty())
class Converters { 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 @TypeConverter
fun exploreRuleToString(exploreRule: ExploreRule?): String = GSON.toJson(exploreRule) fun exploreRuleToString(exploreRule: ExploreRule?): String = GSON.toJson(exploreRule)

@ -217,7 +217,7 @@ object ReadBook {
book?.let { book -> book?.let { book ->
//最后一章时检查更新 //最后一章时检查更新
if (durChapterPos == 0 && durChapterIndex == chapterSize - 1 && book.isOnLineTxt()) { if (durChapterPos == 0 && durChapterIndex == chapterSize - 1 && book.isOnLineTxt()) {
callBack?.loadChapterList(book)
} }
} }
} }

Loading…
Cancel
Save