|
|
@ -9,6 +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.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 |
|
|
@ -48,7 +49,25 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() { |
|
|
|
else -> null |
|
|
|
else -> null |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
binding.root.postDelayed({ startMainActivity() }, 500) |
|
|
|
Coroutine.async(this) { |
|
|
|
|
|
|
|
val books = appDb.bookDao.all |
|
|
|
|
|
|
|
books.forEach { book -> |
|
|
|
|
|
|
|
BookWebDav.getBookProgress(book)?.let { bookProgress -> |
|
|
|
|
|
|
|
if (bookProgress.durChapterIndex > book.durChapterIndex || |
|
|
|
|
|
|
|
(bookProgress.durChapterIndex == book.durChapterIndex && |
|
|
|
|
|
|
|
bookProgress.durChapterPos > book.durChapterPos) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
book.durChapterIndex = bookProgress.durChapterIndex |
|
|
|
|
|
|
|
book.durChapterPos = bookProgress.durChapterPos |
|
|
|
|
|
|
|
book.durChapterTitle = bookProgress.durChapterTitle |
|
|
|
|
|
|
|
book.durChapterTime = bookProgress.durChapterTime |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
appDb.bookDao.update(*books.toTypedArray()) |
|
|
|
|
|
|
|
}.onFinally { |
|
|
|
|
|
|
|
binding.root.postDelayed({ startMainActivity() }, 300) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun startMainActivity() { |
|
|
|
private fun startMainActivity() { |
|
|
|