From 21820dc75d670ca3b6b473b36968da2f669335c6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 2 Oct 2022 23:19:40 +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 --- app/build.gradle | 4 ++-- app/schemas/io.legado.app.data.AppDatabase/55.json | 8 ++++---- app/src/main/java/io/legado/app/data/AppDatabase.kt | 5 +++-- .../main/java/io/legado/app/data/DatabaseMigrations.kt | 2 +- app/src/main/java/io/legado/app/data/entities/Book.kt | 4 ++-- app/src/main/java/io/legado/app/help/BookExtensions.kt | 3 +++ 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 99c22e592..53f2dab70 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -69,8 +69,8 @@ android { } applicationIdSuffix '.release' - minifyEnabled true - shrinkResources true + minifyEnabled false + //shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } debug { diff --git a/app/schemas/io.legado.app.data.AppDatabase/55.json b/app/schemas/io.legado.app.data.AppDatabase/55.json index 865f5e394..c4d25304c 100644 --- a/app/schemas/io.legado.app.data.AppDatabase/55.json +++ b/app/schemas/io.legado.app.data.AppDatabase/55.json @@ -2,11 +2,11 @@ "formatVersion": 1, "database": { "version": 55, - "identityHash": "09020e77cffa237f9a98c62eed0a01f2", + "identityHash": "7dc698b0bf395df06befb13d41df87b9", "entities": [ { "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": [ { "fieldPath": "bookUrl", @@ -97,7 +97,7 @@ "columnName": "type", "affinity": "INTEGER", "notNull": true, - "defaultValue": "1" + "defaultValue": "0" }, { "fieldPath": "group", @@ -1705,7 +1705,7 @@ "views": [], "setupQueries": [ "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')" ] } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index 924992552..01351d2eb 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.kt @@ -20,7 +20,7 @@ val appDb by lazy { } @Database( - version = 55, + version = 56, exportSchema = true, entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class, ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class, @@ -39,7 +39,8 @@ val appDb by lazy { AutoMigration(from = 51, to = 52), AutoMigration(from = 52, to = 53), 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() { diff --git a/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt b/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt index e4c10dcd6..0613c0a27 100644 --- a/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt +++ b/app/src/main/java/io/legado/app/data/DatabaseMigrations.kt @@ -325,7 +325,7 @@ object DatabaseMigrations { @Suppress("ClassName") - class Migration_44_45 : AutoMigrationSpec { + class Migration_54_55 : AutoMigrationSpec { override fun onPostMigrate(db: SupportSQLiteDatabase) { db.execSQL( diff --git a/app/src/main/java/io/legado/app/data/entities/Book.kt b/app/src/main/java/io/legado/app/data/entities/Book.kt index bebecb0bc..2d3e2229a 100644 --- a/app/src/main/java/io/legado/app/data/entities/Book.kt +++ b/app/src/main/java/io/legado/app/data/entities/Book.kt @@ -64,8 +64,8 @@ data class Book( // 自定义字符集名称(仅适用于本地书籍) var charset: String? = null, // 类型,详见BookType - @ColumnInfo(defaultValue = "1") - var type: Int = 0, + @ColumnInfo(defaultValue = "0") + var type: Int = BookType.text, // 自定义分组索引号 @ColumnInfo(defaultValue = "0") var group: Long = 0, diff --git a/app/src/main/java/io/legado/app/help/BookExtensions.kt b/app/src/main/java/io/legado/app/help/BookExtensions.kt index 6af710c82..4f831a9b9 100644 --- a/app/src/main/java/io/legado/app/help/BookExtensions.kt +++ b/app/src/main/java/io/legado/app/help/BookExtensions.kt @@ -18,6 +18,9 @@ val Book.isImage: Boolean val Book.isLocal: Boolean get() { + if (type == 0) { + return origin == BookType.localTag || origin.startsWith(BookType.webDavTag) + } return type and BookType.local > 0 }