From d27a64d12874ace1027a2b32b6689c8683a16859 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 12 Aug 2021 20:34:46 +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 | 11 +++++++++++ .../io/legado/app/data/entities/rule/LogInRule.kt | 12 ++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) 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 d5c43ef7e..20d8c8ce1 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 @@ -46,6 +46,17 @@ data class BookSource( var ruleContent: ContentRule? = null // 正文页规则 ) : Parcelable, JsExtensions { + @delegate:Transient + @delegate:Ignore + @IgnoredOnParcel + val logInRule by lazy { + if (loginUrl.isJsonObject()) { + return@lazy GSON.fromJsonObject(loginUrl) + } else { + return@lazy LogInRule(url = loginUrl) + } + } + @delegate:Transient @delegate:Ignore @IgnoredOnParcel diff --git a/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt index f8046237c..7b0fb908c 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/LogInRule.kt @@ -1,7 +1,11 @@ package io.legado.app.data.entities.rule +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize data class LogInRule( - val ui: HashMap, - val logInUrl: String, - val checkJs: String -) \ No newline at end of file + val ui: HashMap? = null, + val url: String? = null, + val checkJs: String? = null +) : Parcelable \ No newline at end of file