阅读记录添加最后阅读时间

pull/2084/head
kunfei 2 years ago
parent 9a56e9834c
commit b3a470a4b0
  1. 1674
      app/schemas/io.legado.app.data.AppDatabase/51.json
  2. 5
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  3. 6
      app/src/main/java/io/legado/app/data/entities/ReadRecord.kt
  4. 1
      app/src/main/java/io/legado/app/model/ReadBook.kt

File diff suppressed because it is too large Load Diff

@ -20,7 +20,7 @@ val appDb by lazy {
}
@Database(
version = 50,
version = 51,
exportSchema = true,
entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class,
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
@ -34,7 +34,8 @@ val appDb by lazy {
AutoMigration(from = 46, to = 47),
AutoMigration(from = 47, to = 48),
AutoMigration(from = 48, to = 49),
AutoMigration(from = 49, to = 50)
AutoMigration(from = 49, to = 50),
AutoMigration(from = 50, to = 51)
]
)
abstract class AppDatabase : RoomDatabase() {

@ -1,10 +1,14 @@
package io.legado.app.data.entities
import androidx.room.ColumnInfo
import androidx.room.Entity
@Entity(tableName = "readRecord", primaryKeys = ["deviceId", "bookName"])
data class ReadRecord(
var deviceId: String = "",
var bookName: String = "",
var readTime: Long = 0L
@ColumnInfo(defaultValue = "0")
var readTime: Long = 0L,
@ColumnInfo(defaultValue = "0")
var lastRead: Long = System.currentTimeMillis()
)

@ -117,6 +117,7 @@ object ReadBook : CoroutineScope by MainScope() {
Coroutine.async {
readRecord.readTime = readRecord.readTime + System.currentTimeMillis() - readStartTime
readStartTime = System.currentTimeMillis()
readRecord.lastRead = System.currentTimeMillis()
if (AppConfig.enableReadRecord) {
appDb.readRecordDao.insert(readRecord)
}

Loading…
Cancel
Save