pull/2368/head
kunfei 2 years ago
parent 4e92243413
commit 21820dc75d
  1. 4
      app/build.gradle
  2. 8
      app/schemas/io.legado.app.data.AppDatabase/55.json
  3. 5
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  4. 2
      app/src/main/java/io/legado/app/data/DatabaseMigrations.kt
  5. 4
      app/src/main/java/io/legado/app/data/entities/Book.kt
  6. 3
      app/src/main/java/io/legado/app/help/BookExtensions.kt

@ -69,8 +69,8 @@ android {
} }
applicationIdSuffix '.release' applicationIdSuffix '.release'
minifyEnabled true minifyEnabled false
shrinkResources true //shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
} }
debug { debug {

@ -2,11 +2,11 @@
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 55, "version": 55,
"identityHash": "09020e77cffa237f9a98c62eed0a01f2", "identityHash": "7dc698b0bf395df06befb13d41df87b9",
"entities": [ "entities": [
{ {
"tableName": "books", "tableName": "books",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`bookUrl` TEXT NOT NULL DEFAULT '', `tocUrl` TEXT NOT NULL DEFAULT '', `origin` TEXT NOT NULL DEFAULT 'loc_book', `originName` TEXT NOT NULL DEFAULT '', `name` TEXT NOT NULL DEFAULT '', `author` TEXT NOT NULL DEFAULT '', `kind` TEXT, `customTag` TEXT, `coverUrl` TEXT, `customCoverUrl` TEXT, `intro` TEXT, `customIntro` TEXT, `charset` TEXT, `type` INTEGER NOT NULL DEFAULT 1, `group` INTEGER NOT NULL DEFAULT 0, `latestChapterTitle` TEXT, `latestChapterTime` INTEGER NOT NULL DEFAULT 0, `lastCheckTime` INTEGER NOT NULL DEFAULT 0, `lastCheckCount` INTEGER NOT NULL DEFAULT 0, `totalChapterNum` INTEGER NOT NULL DEFAULT 0, `durChapterTitle` TEXT, `durChapterIndex` INTEGER NOT NULL DEFAULT 0, `durChapterPos` INTEGER NOT NULL DEFAULT 0, `durChapterTime` INTEGER NOT NULL DEFAULT 0, `wordCount` TEXT, `canUpdate` INTEGER NOT NULL DEFAULT 1, `order` INTEGER NOT NULL DEFAULT 0, `originOrder` INTEGER NOT NULL DEFAULT 0, `variable` TEXT, `readConfig` TEXT, PRIMARY KEY(`bookUrl`))", "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`bookUrl` TEXT NOT NULL DEFAULT '', `tocUrl` TEXT NOT NULL DEFAULT '', `origin` TEXT NOT NULL DEFAULT 'loc_book', `originName` TEXT NOT NULL DEFAULT '', `name` TEXT NOT NULL DEFAULT '', `author` TEXT NOT NULL DEFAULT '', `kind` TEXT, `customTag` TEXT, `coverUrl` TEXT, `customCoverUrl` TEXT, `intro` TEXT, `customIntro` TEXT, `charset` TEXT, `type` INTEGER NOT NULL DEFAULT 0, `group` INTEGER NOT NULL DEFAULT 0, `latestChapterTitle` TEXT, `latestChapterTime` INTEGER NOT NULL DEFAULT 0, `lastCheckTime` INTEGER NOT NULL DEFAULT 0, `lastCheckCount` INTEGER NOT NULL DEFAULT 0, `totalChapterNum` INTEGER NOT NULL DEFAULT 0, `durChapterTitle` TEXT, `durChapterIndex` INTEGER NOT NULL DEFAULT 0, `durChapterPos` INTEGER NOT NULL DEFAULT 0, `durChapterTime` INTEGER NOT NULL DEFAULT 0, `wordCount` TEXT, `canUpdate` INTEGER NOT NULL DEFAULT 1, `order` INTEGER NOT NULL DEFAULT 0, `originOrder` INTEGER NOT NULL DEFAULT 0, `variable` TEXT, `readConfig` TEXT, PRIMARY KEY(`bookUrl`))",
"fields": [ "fields": [
{ {
"fieldPath": "bookUrl", "fieldPath": "bookUrl",
@ -97,7 +97,7 @@
"columnName": "type", "columnName": "type",
"affinity": "INTEGER", "affinity": "INTEGER",
"notNull": true, "notNull": true,
"defaultValue": "1" "defaultValue": "0"
}, },
{ {
"fieldPath": "group", "fieldPath": "group",
@ -1705,7 +1705,7 @@
"views": [], "views": [],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '09020e77cffa237f9a98c62eed0a01f2')" "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7dc698b0bf395df06befb13d41df87b9')"
] ]
} }
} }

@ -20,7 +20,7 @@ val appDb by lazy {
} }
@Database( @Database(
version = 55, version = 56,
exportSchema = true, exportSchema = true,
entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class, entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class,
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class, ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
@ -39,7 +39,8 @@ val appDb by lazy {
AutoMigration(from = 51, to = 52), AutoMigration(from = 51, to = 52),
AutoMigration(from = 52, to = 53), AutoMigration(from = 52, to = 53),
AutoMigration(from = 53, to = 54), AutoMigration(from = 53, to = 54),
AutoMigration(from = 54, to = 55, spec = DatabaseMigrations.Migration_44_45::class) AutoMigration(from = 54, to = 55, spec = DatabaseMigrations.Migration_54_55::class),
AutoMigration(from = 55, to = 56),
] ]
) )
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {

@ -325,7 +325,7 @@ object DatabaseMigrations {
@Suppress("ClassName") @Suppress("ClassName")
class Migration_44_45 : AutoMigrationSpec { class Migration_54_55 : AutoMigrationSpec {
override fun onPostMigrate(db: SupportSQLiteDatabase) { override fun onPostMigrate(db: SupportSQLiteDatabase) {
db.execSQL( db.execSQL(

@ -64,8 +64,8 @@ data class Book(
// 自定义字符集名称(仅适用于本地书籍) // 自定义字符集名称(仅适用于本地书籍)
var charset: String? = null, var charset: String? = null,
// 类型,详见BookType // 类型,详见BookType
@ColumnInfo(defaultValue = "1") @ColumnInfo(defaultValue = "0")
var type: Int = 0, var type: Int = BookType.text,
// 自定义分组索引号 // 自定义分组索引号
@ColumnInfo(defaultValue = "0") @ColumnInfo(defaultValue = "0")
var group: Long = 0, var group: Long = 0,

@ -18,6 +18,9 @@ val Book.isImage: Boolean
val Book.isLocal: Boolean val Book.isLocal: Boolean
get() { get() {
if (type == 0) {
return origin == BookType.localTag || origin.startsWith(BookType.webDavTag)
}
return type and BookType.local > 0 return type and BookType.local > 0
} }

Loading…
Cancel
Save