mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -105,11 +105,13 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
||||
} else {
|
||||
ReadBook.loadContent(resetPageOffset = true)
|
||||
}
|
||||
checkLocalBookFileExist(book)
|
||||
} else {
|
||||
if (ReadBook.durChapterIndex > ReadBook.chapterSize - 1) {
|
||||
ReadBook.durChapterIndex = ReadBook.chapterSize - 1
|
||||
}
|
||||
ReadBook.loadContent(resetPageOffset = false)
|
||||
checkLocalBookFileExist(book)
|
||||
}
|
||||
if (ReadBook.chapterChanged) {
|
||||
// 有章节跳转不同步阅读进度
|
||||
@@ -123,6 +125,18 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkLocalBookFileExist(book: Book) {
|
||||
if (book.isLocal) {
|
||||
execute {
|
||||
LocalBook.getBookInputStream(book)
|
||||
}.onError {
|
||||
if (it is FileNotFoundException) {
|
||||
permissionDenialLiveData.postValue(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载详情页
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user