pull/1264/head
gedoor 3 years ago
parent fcd2b9b967
commit db2d3cc4c4
  1. 5
      app/src/main/java/io/legado/app/api/controller/BookController.kt
  2. 2
      app/src/main/java/io/legado/app/help/storage/AppWebDav.kt
  3. 2
      app/src/main/java/io/legado/app/help/storage/Backup.kt
  4. 4
      app/src/main/java/io/legado/app/model/ReadBook.kt
  5. 5
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt
  6. 6
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt
  7. 3
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  8. 4
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt
  9. 3
      app/src/main/java/io/legado/app/ui/book/toc/ChapterListFragment.kt
  10. 4
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
  11. 3
      app/src/main/java/io/legado/app/ui/main/bookshelf/style1/BookshelfFragment1.kt
  12. 3
      app/src/main/java/io/legado/app/ui/main/bookshelf/style1/books/BooksFragment.kt
  13. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt
  14. 3
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  15. 3
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesFragment.kt
  16. 3
      app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt
  17. 4
      app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt

@ -10,6 +10,7 @@ import io.legado.app.data.entities.Book
import io.legado.app.help.BookHelp import io.legado.app.help.BookHelp
import io.legado.app.help.ContentProcessor import io.legado.app.help.ContentProcessor
import io.legado.app.help.glide.ImageLoader import io.legado.app.help.glide.ImageLoader
import io.legado.app.help.storage.AppWebDav
import io.legado.app.model.ReadBook import io.legado.app.model.ReadBook
import io.legado.app.model.localBook.EpubFile import io.legado.app.model.localBook.EpubFile
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
@ -167,6 +168,7 @@ object BookController {
val returnData = ReturnData() val returnData = ReturnData()
if (book != null) { if (book != null) {
book.save() book.save()
AppWebDav.uploadBookProgress(book)
if (ReadBook.book?.bookUrl == book.bookUrl) { if (ReadBook.book?.bookUrl == book.bookUrl) {
ReadBook.book = book ReadBook.book = book
ReadBook.durChapterIndex = book.durChapterIndex ReadBook.durChapterIndex = book.durChapterIndex
@ -177,19 +179,18 @@ object BookController {
} }
private fun saveBookReadIndex(book: Book, index: Int) { private fun saveBookReadIndex(book: Book, index: Int) {
if (index > book.durChapterIndex) {
book.durChapterIndex = index book.durChapterIndex = index
book.durChapterTime = System.currentTimeMillis() book.durChapterTime = System.currentTimeMillis()
appDb.bookChapterDao.getChapter(book.bookUrl, index)?.let { appDb.bookChapterDao.getChapter(book.bookUrl, index)?.let {
book.durChapterTitle = it.title book.durChapterTitle = it.title
} }
appDb.bookDao.update(book) appDb.bookDao.update(book)
AppWebDav.uploadBookProgress(book)
if (ReadBook.book?.bookUrl == book.bookUrl) { if (ReadBook.book?.bookUrl == book.bookUrl) {
ReadBook.book = book ReadBook.book = book
ReadBook.durChapterIndex = index ReadBook.durChapterIndex = index
} }
} }
}
fun addLocalBook(parameters: Map<String, List<String>>): ReturnData { fun addLocalBook(parameters: Map<String, List<String>>): ReturnData {
val returnData = ReturnData() val returnData = ReturnData()

@ -20,7 +20,7 @@ import java.io.File
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
object BookWebDav { object AppWebDav {
private const val defaultWebDavUrl = "https://dav.jianguoyun.com/dav/" private const val defaultWebDavUrl = "https://dav.jianguoyun.com/dav/"
private val bookProgressUrl = "${rootWebDavUrl}bookProgress/" private val bookProgressUrl = "${rootWebDavUrl}bookProgress/"
private val zipFilePath = "${appCtx.externalFiles.absolutePath}${File.separator}backup.zip" private val zipFilePath = "${appCtx.externalFiles.absolutePath}${File.separator}backup.zip"

@ -98,7 +98,7 @@ object Backup {
} }
edit.commit() edit.commit()
} }
BookWebDav.backUpWebDav(backupPath) AppWebDav.backUpWebDav(backupPath)
if (path.isContentScheme()) { if (path.isContentScheme()) {
copyBackup(context, Uri.parse(path), isAuto) copyBackup(context, Uri.parse(path), isAuto)
} else { } else {

@ -7,7 +7,7 @@ import io.legado.app.data.appDb
import io.legado.app.data.entities.* import io.legado.app.data.entities.*
import io.legado.app.help.* import io.legado.app.help.*
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.storage.BookWebDav import io.legado.app.help.storage.AppWebDav
import io.legado.app.model.webBook.WebBook import io.legado.app.model.webBook.WebBook
import io.legado.app.service.BaseReadAloudService import io.legado.app.service.BaseReadAloudService
import io.legado.app.service.help.CacheBook import io.legado.app.service.help.CacheBook
@ -100,7 +100,7 @@ object ReadBook : CoroutineScope by MainScope() {
fun uploadProgress(syncBookProgress: Boolean = AppConfig.syncBookProgress) { fun uploadProgress(syncBookProgress: Boolean = AppConfig.syncBookProgress) {
if (syncBookProgress) { if (syncBookProgress) {
book?.let { book?.let {
BookWebDav.uploadBookProgress(it) AppWebDav.uploadBookProgress(it)
} }
} }
} }

@ -6,7 +6,6 @@ import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.lifecycle.whenStarted
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R import io.legado.app.R
@ -111,7 +110,6 @@ class ArrangeBookActivity : VMBaseActivity<ActivityArrangeBookBinding, ArrangeBo
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
private fun initGroupData() { private fun initGroupData() {
launch { launch {
lifecycle.whenStarted {
appDb.bookGroupDao.flowAll().collect { appDb.bookGroupDao.flowAll().collect {
groupList.clear() groupList.clear()
groupList.addAll(it) groupList.addAll(it)
@ -120,12 +118,10 @@ class ArrangeBookActivity : VMBaseActivity<ActivityArrangeBookBinding, ArrangeBo
} }
} }
} }
}
private fun initBookData() { private fun initBookData() {
booksFlowJob?.cancel() booksFlowJob?.cancel()
booksFlowJob = launch { booksFlowJob = launch {
lifecycle.whenStarted {
when (groupId) { when (groupId) {
AppConst.bookGroupAllId -> appDb.bookDao.flowAll() AppConst.bookGroupAllId -> appDb.bookDao.flowAll()
AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal() AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal()
@ -145,7 +141,6 @@ class ArrangeBookActivity : VMBaseActivity<ActivityArrangeBookBinding, ArrangeBo
} }
} }
} }
}
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {

@ -18,7 +18,7 @@ import io.legado.app.data.entities.BookChapter
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.BookHelp import io.legado.app.help.BookHelp
import io.legado.app.help.ContentProcessor import io.legado.app.help.ContentProcessor
import io.legado.app.help.storage.BookWebDav import io.legado.app.help.storage.AppWebDav
import io.legado.app.utils.* import io.legado.app.utils.*
import me.ag2s.epublib.domain.* import me.ag2s.epublib.domain.*
import me.ag2s.epublib.epub.EpubWriter import me.ag2s.epublib.epub.EpubWriter
@ -78,7 +78,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
// 导出到webdav // 导出到webdav
val byteArray = val byteArray =
stringBuilder.toString().toByteArray(Charset.forName(AppConfig.exportCharset)) stringBuilder.toString().toByteArray(Charset.forName(AppConfig.exportCharset))
BookWebDav.exportWebDav(byteArray, filename) AppWebDav.exportWebDav(byteArray, filename)
} }
} }
getSrcList(book).forEach { getSrcList(book).forEach {
@ -105,7 +105,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
if (AppConfig.exportToWebDav) { if (AppConfig.exportToWebDav) {
val byteArray = val byteArray =
stringBuilder.toString().toByteArray(Charset.forName(AppConfig.exportCharset)) stringBuilder.toString().toByteArray(Charset.forName(AppConfig.exportCharset))
BookWebDav.exportWebDav(byteArray, filename) // 导出到webdav AppWebDav.exportWebDav(byteArray, filename) // 导出到webdav
} }
getSrcList(book).forEach { getSrcList(book).forEach {
val vFile = BookHelp.getImage(book, it.third) val vFile = BookHelp.getImage(book, it.third)

@ -7,7 +7,6 @@ import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.lifecycle.whenStarted
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R import io.legado.app.R
@ -154,7 +153,6 @@ class ChangeSourceDialog : BaseDialogFragment(),
adapter.setItems(it) adapter.setItems(it)
}) })
launch { launch {
lifecycle.whenStarted {
appDb.bookSourceDao.flowGroupEnabled().collect { appDb.bookSourceDao.flowGroupEnabled().collect {
groups.clear() groups.clear()
it.map { group -> it.map { group ->
@ -164,7 +162,6 @@ class ChangeSourceDialog : BaseDialogFragment(),
} }
} }
} }
}
private val stopMenuItem: MenuItem? private val stopMenuItem: MenuItem?
get() = binding.toolBar.menu.findItem(R.id.menu_stop) get() = binding.toolBar.menu.findItem(R.id.menu_stop)

@ -13,7 +13,7 @@ import io.legado.app.data.entities.BookProgress
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.BookHelp import io.legado.app.help.BookHelp
import io.legado.app.help.ContentProcessor import io.legado.app.help.ContentProcessor
import io.legado.app.help.storage.BookWebDav import io.legado.app.help.storage.AppWebDav
import io.legado.app.model.ReadBook import io.legado.app.model.ReadBook
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
import io.legado.app.model.webBook.PreciseSearch import io.legado.app.model.webBook.PreciseSearch
@ -169,7 +169,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
) { ) {
if (syncBookProgress) if (syncBookProgress)
execute { execute {
BookWebDav.getBookProgress(book) AppWebDav.getBookProgress(book)
}.onSuccess { }.onSuccess {
it?.let { progress -> it?.let { progress ->
if (progress.durChapterIndex < book.durChapterIndex || if (progress.durChapterIndex < book.durChapterIndex ||

@ -6,7 +6,6 @@ import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.whenStarted
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.VMBaseFragment import io.legado.app.base.VMBaseFragment
import io.legado.app.constant.EventBus import io.legado.app.constant.EventBus
@ -110,7 +109,6 @@ class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapt
override fun upChapterList(searchKey: String?) { override fun upChapterList(searchKey: String?) {
tocFlowJob?.cancel() tocFlowJob?.cancel()
tocFlowJob = launch { tocFlowJob = launch {
lifecycle.whenStarted {
when { when {
searchKey.isNullOrBlank() -> appDb.bookChapterDao.flowByBook(viewModel.bookUrl) searchKey.isNullOrBlank() -> appDb.bookChapterDao.flowByBook(viewModel.bookUrl)
else -> appDb.bookChapterDao.flowSearch(viewModel.bookUrl, searchKey) else -> appDb.bookChapterDao.flowSearch(viewModel.bookUrl, searchKey)
@ -123,7 +121,6 @@ class ChapterListFragment : VMBaseFragment<TocViewModel>(R.layout.fragment_chapt
} }
} }
} }
}
override val isLocalBook: Boolean override val isLocalBook: Boolean
get() = viewModel.bookData.value?.isLocalBook() == true get() = viewModel.bookData.value?.isLocalBook() == true

@ -19,8 +19,8 @@ import io.legado.app.constant.PreferKey
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.LocalConfig import io.legado.app.help.LocalConfig
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.storage.AppWebDav
import io.legado.app.help.storage.Backup import io.legado.app.help.storage.Backup
import io.legado.app.help.storage.BookWebDav
import io.legado.app.help.storage.ImportOldData import io.legado.app.help.storage.ImportOldData
import io.legado.app.help.storage.Restore import io.legado.app.help.storage.Restore
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
@ -268,7 +268,7 @@ class BackupConfigFragment : BasePreferenceFragment(),
fun restore() { fun restore() {
Coroutine.async(context = Main) { Coroutine.async(context = Main) {
BookWebDav.showRestoreDialog(requireContext()) AppWebDav.showRestoreDialog(requireContext())
}.onError { }.onError {
alert { alert {
setTitle(R.string.restore) setTitle(R.string.restore)

@ -10,7 +10,6 @@ import androidx.appcompat.widget.SearchView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.lifecycle.whenStarted
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
@ -79,14 +78,12 @@ class BookshelfFragment1 : BaseBookshelfFragment(R.layout.fragment_bookshelf),
private fun initBookGroupData() { private fun initBookGroupData() {
launch { launch {
lifecycle.whenStarted {
appDb.bookGroupDao.flowShow().collect { appDb.bookGroupDao.flowShow().collect {
viewModel.checkGroup(it) viewModel.checkGroup(it)
upGroup(it) upGroup(it)
} }
} }
} }
}
override fun onQueryTextSubmit(query: String?): Boolean { override fun onQueryTextSubmit(query: String?): Boolean {
SearchActivity.start(requireContext(), query) SearchActivity.start(requireContext(), query)

@ -5,7 +5,6 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.whenStarted
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -107,7 +106,6 @@ class BooksFragment : BaseFragment(R.layout.fragment_books),
private fun upRecyclerData() { private fun upRecyclerData() {
booksFlowJob?.cancel() booksFlowJob?.cancel()
booksFlowJob = launch { booksFlowJob = launch {
lifecycle.whenStarted {
when (groupId) { when (groupId) {
AppConst.bookGroupAllId -> appDb.bookDao.flowAll() AppConst.bookGroupAllId -> appDb.bookDao.flowAll()
AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal() AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal()
@ -128,7 +126,6 @@ class BooksFragment : BaseFragment(R.layout.fragment_books),
} }
} }
} }
}
fun getBooks(): List<Book> { fun getBooks(): List<Book> {
return booksAdapter.getItems() return booksAdapter.getItems()

@ -6,7 +6,6 @@ import android.view.Menu
import android.view.View import android.view.View
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.lifecycle.whenStarted
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -101,7 +100,6 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
private fun initGroupData() { private fun initGroupData() {
launch { launch {
lifecycle.whenStarted {
appDb.bookGroupDao.flowShow().collect { appDb.bookGroupDao.flowShow().collect {
if (it != bookGroups) { if (it != bookGroups) {
bookGroups = it bookGroups = it
@ -111,7 +109,6 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
} }
} }
} }
}
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
private fun initBooksData() { private fun initBooksData() {
@ -126,7 +123,6 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
} }
booksFlowJob?.cancel() booksFlowJob?.cancel()
booksFlowJob = launch { booksFlowJob = launch {
lifecycle.whenStarted {
when (groupId) { when (groupId) {
AppConst.bookGroupAllId -> appDb.bookDao.flowAll() AppConst.bookGroupAllId -> appDb.bookDao.flowAll()
AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal() AppConst.bookGroupLocalId -> appDb.bookDao.flowLocal()
@ -153,7 +149,6 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
} }
} }
} }
}
fun back(): Boolean { fun back(): Boolean {
if (groupId != AppConst.bookGroupNoneId) { if (groupId != AppConst.bookGroupNoneId) {

@ -7,7 +7,6 @@ import android.view.SubMenu
import android.view.View import android.view.View
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.lifecycle.whenStarted
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.VMBaseFragment import io.legado.app.base.VMBaseFragment
import io.legado.app.constant.AppPattern import io.legado.app.constant.AppPattern
@ -122,7 +121,6 @@ class RssFragment : VMBaseFragment<RssSourceViewModel>(R.layout.fragment_rss),
private fun initGroupData() { private fun initGroupData() {
launch { launch {
lifecycle.whenStarted {
appDb.rssSourceDao.flowGroup().collect { appDb.rssSourceDao.flowGroup().collect {
groups.clear() groups.clear()
it.map { group -> it.map { group ->
@ -132,7 +130,6 @@ class RssFragment : VMBaseFragment<RssSourceViewModel>(R.layout.fragment_rss),
} }
} }
} }
}
private fun upRssFlowJob(searchKey: String? = null) { private fun upRssFlowJob(searchKey: String? = null) {
rssFlowJob?.cancel() rssFlowJob?.cancel()

@ -6,7 +6,6 @@ import android.view.View
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.whenStarted
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -98,13 +97,11 @@ class RssArticlesFragment : VMBaseFragment<RssArticlesViewModel>(R.layout.fragme
val rssUrl = activityViewModel.url ?: return val rssUrl = activityViewModel.url ?: return
articlesFlowJob?.cancel() articlesFlowJob?.cancel()
articlesFlowJob = lifecycleScope.launch { articlesFlowJob = lifecycleScope.launch {
lifecycle.whenStarted {
appDb.rssArticleDao.flowByOriginSort(rssUrl, viewModel.sortName).collect { appDb.rssArticleDao.flowByOriginSort(rssUrl, viewModel.sortName).collect {
adapter.setItems(it) adapter.setItems(it)
} }
} }
} }
}
private fun loadArticles() { private fun loadArticles() {
activityViewModel.rssSource?.let { activityViewModel.rssSource?.let {

@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.lifecycle.whenStarted
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
@ -63,14 +62,12 @@ class RuleSubActivity : BaseActivity<ActivityRuleSubBinding>(),
private fun initData() { private fun initData() {
launch { launch {
lifecycle.whenStarted {
appDb.ruleSubDao.flowAll().collect { appDb.ruleSubDao.flowAll().collect {
binding.tvEmptyMsg.isGone = it.isNotEmpty() binding.tvEmptyMsg.isGone = it.isNotEmpty()
adapter.setItems(it) adapter.setItems(it)
} }
} }
} }
}
override fun openSubscription(ruleSub: RuleSub) { override fun openSubscription(ruleSub: RuleSub) {
when (ruleSub.type) { when (ruleSub.type) {

@ -9,7 +9,7 @@ import io.legado.app.data.appDb
import io.legado.app.databinding.ActivityWelcomeBinding import io.legado.app.databinding.ActivityWelcomeBinding
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.storage.BookWebDav import io.legado.app.help.storage.AppWebDav
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.main.MainActivity import io.legado.app.ui.main.MainActivity
@ -37,7 +37,7 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
Coroutine.async { Coroutine.async {
val books = appDb.bookDao.all val books = appDb.bookDao.all
books.forEach { book -> books.forEach { book ->
BookWebDav.getBookProgress(book)?.let { bookProgress -> AppWebDav.getBookProgress(book)?.let { bookProgress ->
if (bookProgress.durChapterIndex > book.durChapterIndex || if (bookProgress.durChapterIndex > book.durChapterIndex ||
(bookProgress.durChapterIndex == book.durChapterIndex && (bookProgress.durChapterIndex == book.durChapterIndex &&
bookProgress.durChapterPos > book.durChapterPos) bookProgress.durChapterPos > book.durChapterPos)

Loading…
Cancel
Save