Add: Add ReviewRule and related codes
This commit is contained in:
@@ -50,6 +50,9 @@ interface BookSourceDao {
|
||||
@Query("select * from book_sources where enabledExplore = 1 and trim(exploreUrl) <> '' order by customOrder asc")
|
||||
fun flowExplore(): Flow<List<BookSource>>
|
||||
|
||||
// @Query("select * from book_sources where enabledReview = 1 order by customOrder asc")
|
||||
// fun flowReview(): Flow<List<BookSource>>
|
||||
|
||||
@Query("select * from book_sources where loginUrl is not null and loginUrl != ''")
|
||||
fun flowLogin(): Flow<List<BookSource>>
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ data class BookSource(
|
||||
override var loginUrl: String? = null,
|
||||
// 登录UI
|
||||
override var loginUi: String? = null,
|
||||
// 启用段评
|
||||
var enabledReview: Boolean? = false,
|
||||
// 登录检测js
|
||||
var loginCheckJs: String? = null,
|
||||
// 注释
|
||||
@@ -74,7 +76,9 @@ data class BookSource(
|
||||
// 目录页规则
|
||||
var ruleToc: TocRule? = null,
|
||||
// 正文页规则
|
||||
var ruleContent: ContentRule? = null
|
||||
var ruleContent: ContentRule? = null,
|
||||
// 段评规则
|
||||
var ruleReview: ReviewRule? = null
|
||||
) : Parcelable, BaseSource {
|
||||
|
||||
override fun getTag(): String {
|
||||
@@ -170,6 +174,13 @@ data class BookSource(
|
||||
return rule
|
||||
}
|
||||
|
||||
fun getReviewRule(): ReviewRule {
|
||||
ruleReview?.let { return it }
|
||||
val rule = ReviewRule()
|
||||
ruleReview = rule
|
||||
return rule
|
||||
}
|
||||
|
||||
fun getDisPlayNameGroup(): String {
|
||||
return if (bookSourceGroup.isNullOrBlank()) {
|
||||
bookSourceName
|
||||
@@ -303,5 +314,13 @@ data class BookSource(
|
||||
fun stringToContentRule(json: String?) =
|
||||
GSON.fromJsonObject<ContentRule>(json).getOrNull()
|
||||
|
||||
@TypeConverter
|
||||
fun stringToReviewRule(json: String?) =
|
||||
GSON.fromJsonObject<ReviewRule>(json).getOrNull()
|
||||
|
||||
@TypeConverter
|
||||
fun reviewRuleToString(reviewRule: ReviewRule?): String =
|
||||
GSON.toJson(reviewRule)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package io.legado.app.data.entities.rule
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class ReviewRule(
|
||||
var reviewUrl: String? = null, // 段评URL
|
||||
var avatarRule: String? = null, // 段评发布者头像
|
||||
var contentRule: String? = null, // 段评内容
|
||||
var postTimeRule: String? = null, // 段评发布时间
|
||||
var reviewReplyUrl: String? = null, // 获取段评回复URL
|
||||
|
||||
// 这些功能将在以上功能完成以后实现
|
||||
var voteUpUrl: String? = null, // 点赞URL
|
||||
var voteDownUrl: String? = null, // 点踩URL
|
||||
var replyUrl: String? = null // 回复URL
|
||||
): Parcelable
|
||||
Reference in New Issue
Block a user