kunfei před 4 roky
rodič
revize
4f621f7149

+ 0 - 25
app/src/main/java/io/legado/app/api/controller/BookController.kt

@@ -1,6 +1,5 @@
 package io.legado.app.api.controller
 
-import android.net.Uri
 import androidx.core.graphics.drawable.toBitmap
 import io.legado.app.api.ReturnData
 import io.legado.app.constant.PreferKey
@@ -14,16 +13,13 @@ import io.legado.app.help.glide.ImageLoader
 import io.legado.app.help.storage.AppWebDav
 import io.legado.app.model.BookCover
 import io.legado.app.model.ReadBook
-import io.legado.app.model.localBook.EpubFile
 import io.legado.app.model.localBook.LocalBook
-import io.legado.app.model.localBook.UmdFile
 import io.legado.app.model.webBook.WebBook
 import io.legado.app.ui.book.read.page.provider.ImageProvider
 import io.legado.app.utils.*
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.runBlocking
 import splitties.init.appCtx
-import java.io.File
 
 object BookController {
 
@@ -173,7 +169,6 @@ object BookController {
         var content: String? = BookHelp.getContent(book, chapter)
         if (content != null) {
             val contentProcessor = ContentProcessor.get(book.name, book.origin)
-            saveBookReadIndex(book, index)
             content = runBlocking {
                 contentProcessor.getContent(book, chapter, content!!, includeTitle = false)
                     .joinToString("\n")
@@ -186,7 +181,6 @@ object BookController {
             content = runBlocking {
                 WebBook.getContentAwait(this, bookSource, book, chapter).let {
                     val contentProcessor = ContentProcessor.get(book.name, book.origin)
-                    saveBookReadIndex(book, index)
                     contentProcessor.getContent(book, chapter, it, includeTitle = false)
                         .joinToString("\n")
                 }
@@ -215,25 +209,6 @@ object BookController {
         return returnData.setErrorMsg("格式不对")
     }
 
-    /**
-     * 保存进度
-     */
-    private fun saveBookReadIndex(book: Book, index: Int) {
-        book.durChapterIndex = index
-        book.durChapterTime = System.currentTimeMillis()
-        appDb.bookChapterDao.getChapter(book.bookUrl, index)?.let {
-            book.durChapterTitle = it.title
-        }
-        appDb.bookDao.update(book)
-        AppWebDav.uploadBookProgress(book)
-        if (ReadBook.book?.bookUrl == book.bookUrl) {
-            ReadBook.book = book
-            ReadBook.durChapterIndex = index
-            ReadBook.clearTextChapter()
-            ReadBook.loadContent(true)
-        }
-    }
-
     /**
      * 添加本地书籍
      */