添加isVolume规则

This commit is contained in:
Xwite
2022-01-09 23:03:21 +08:00
parent 9b6e45cd9a
commit 435232fbf4
12 changed files with 24 additions and 2 deletions
@@ -16,7 +16,7 @@ val appDb by lazy {
}
@Database(
version = 42,
version = 43,
exportSchema = true,
entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class,
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
@@ -38,7 +38,8 @@ object DatabaseMigrations {
migration_38_39,
migration_39_40,
migration_40_41,
migration_41_42
migration_41_42,
migration_42_43
)
}
@@ -336,4 +337,10 @@ object DatabaseMigrations {
database.execSQL("ALTER TABLE 'httpTTS' ADD `contentType` TEXT")
}
}
private val migration_42_43 = object : Migration(42, 43) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE `chapters` ADD `isVolume` INTEGER NOT NULL DEFAULT 0")
}
}
}
@@ -33,6 +33,7 @@ import splitties.init.appCtx
data class BookChapter(
var url: String = "", // 章节地址
var title: String = "", // 章节标题
var isVolume: Boolean = false, // 是否是卷名
var baseUrl: String = "", // 用来拼接相对url
var bookUrl: String = "", // 书籍地址
var index: Int = 0, // 章节序号
@@ -8,6 +8,7 @@ data class TocRule(
var chapterList: String? = null,
var chapterName: String? = null,
var chapterUrl: String? = null,
var isVolume: String? = null,
var isVip: String? = null,
var isPay: String? = null,
var updateTime: String? = null,
@@ -265,6 +265,7 @@ class BookSourceEditActivity :
add(EditEntity("chapterList", tr?.chapterList, R.string.rule_chapter_list))
add(EditEntity("chapterName", tr?.chapterName, R.string.rule_chapter_name))
add(EditEntity("chapterUrl", tr?.chapterUrl, R.string.rule_chapter_url))
add(EditEntity("isVolume", tr?.isVolume, R.string.rule_is_volume))
add(EditEntity("updateTime", tr?.updateTime, R.string.rule_update_time))
add(EditEntity("isVip", tr?.isVip, R.string.rule_is_vip))
add(EditEntity("isPay", tr?.isPay, R.string.rule_is_pay))
@@ -360,6 +361,7 @@ class BookSourceEditActivity :
"chapterList" -> tocRule.chapterList = it.value
"chapterName" -> tocRule.chapterName = it.value
"chapterUrl" -> tocRule.chapterUrl = it.value
"isVolume" -> tocRule.isVolume = it.value
"updateTime" -> tocRule.updateTime = it.value
"isVip" -> tocRule.isVip = it.value
"isPay" -> tocRule.isPay = it.value