This commit is contained in:
Horis
2023-09-27 23:22:37 +08:00
parent ff4b560c91
commit 083293df39

View File

@@ -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)
}
}
}
}
/**
* 加载详情页
*/