更新时检测webDav书籍是否比本地新,自动重新下载
This commit is contained in:
@@ -319,8 +319,7 @@ object LocalBook {
|
||||
}
|
||||
}
|
||||
return uri?.let {
|
||||
localBook.bookUrl = if (it.isContentScheme()) it.toString()
|
||||
else it.path!!
|
||||
localBook.bookUrl = if (it.isContentScheme()) it.toString() else it.path!!
|
||||
localBook.save()
|
||||
it.inputStream(appCtx)
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ class BookInfoActivity :
|
||||
try {
|
||||
RemoteBookWebDav.upload(it)
|
||||
//更新书籍最后更新时间,使之比远程书籍的时间新
|
||||
it.latestChapterTime = System.currentTimeMillis()
|
||||
it.lastCheckTime = System.currentTimeMillis()
|
||||
viewModel.saveBook(it)
|
||||
} catch (e: Exception) {
|
||||
toastOnUi(e.localizedMessage)
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.legado.app.R
|
||||
import io.legado.app.base.BaseViewModel
|
||||
import io.legado.app.constant.AppLog
|
||||
import io.legado.app.constant.BookSourceType
|
||||
import io.legado.app.constant.BookType
|
||||
import io.legado.app.constant.EventBus
|
||||
import io.legado.app.data.appDb
|
||||
import io.legado.app.data.entities.Book
|
||||
@@ -116,8 +117,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
||||
book.getRemoteUrl()?.let {
|
||||
val remoteBook = RemoteBookWebDav.getRemoteBook(it)
|
||||
if (remoteBook == null) {
|
||||
|
||||
} else if (remoteBook.lastModify > book.latestChapterTime) {
|
||||
book.origin = BookType.localTag
|
||||
} else if (remoteBook.lastModify > book.lastCheckTime) {
|
||||
val uri = RemoteBookWebDav.downloadRemoteBook(remoteBook)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user