|
|
@@ -211,7 +211,7 @@ object ReadManga : CoroutineScope by MainScope() {
|
|
|
return
|
|
|
}
|
|
|
val mangaChapter = getManageChapter(chapter, content)
|
|
|
- if (mangaChapter.imageCount == 0) {
|
|
|
+ if (mangaChapter.imageCount == 0 && !chapter.isVolume) {
|
|
|
mCallback?.loadFail("正文没有图片")
|
|
|
return
|
|
|
}
|
|
|
@@ -224,7 +224,7 @@ object ReadManga : CoroutineScope by MainScope() {
|
|
|
return
|
|
|
}
|
|
|
val mangaChapter = getManageChapter(chapter, content)
|
|
|
- if (mangaChapter.imageCount == 0) {
|
|
|
+ if (mangaChapter.imageCount == 0 && !chapter.isVolume) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -488,29 +488,28 @@ object ReadManga : CoroutineScope by MainScope() {
|
|
|
syncSuccessAction: (() -> Unit)? = null,
|
|
|
) {
|
|
|
if (!AppConfig.syncBookProgress) return
|
|
|
- book?.let {
|
|
|
- Coroutine.async {
|
|
|
- AppWebDav.getBookProgress(it)
|
|
|
- }.onError {
|
|
|
- AppLog.put("拉取阅读进度失败", it)
|
|
|
- }.onSuccess { progress ->
|
|
|
- if (progress == null || progress.durChapterIndex < it.durChapterIndex ||
|
|
|
- (progress.durChapterIndex == it.durChapterIndex
|
|
|
- && progress.durChapterPos < it.durChapterPos)
|
|
|
- ) {
|
|
|
- // 服务器没有进度或者进度比服务器快,上传现有进度
|
|
|
- Coroutine.async {
|
|
|
- AppWebDav.uploadBookProgress(BookProgress(it), uploadSuccessAction)
|
|
|
- it.update()
|
|
|
- }
|
|
|
- } else if (progress.durChapterIndex > it.durChapterIndex ||
|
|
|
- progress.durChapterPos > it.durChapterPos
|
|
|
- ) {
|
|
|
- // 进度比服务器慢,执行传入动作
|
|
|
- newProgressAction?.invoke(progress)
|
|
|
- } else {
|
|
|
- syncSuccessAction?.invoke()
|
|
|
+ val book = book ?: return
|
|
|
+ Coroutine.async {
|
|
|
+ AppWebDav.getBookProgress(book)
|
|
|
+ }.onError {
|
|
|
+ AppLog.put("拉取阅读进度失败", it)
|
|
|
+ }.onSuccess { progress ->
|
|
|
+ if (progress == null || progress.durChapterIndex < book.durChapterIndex ||
|
|
|
+ (progress.durChapterIndex == book.durChapterIndex
|
|
|
+ && progress.durChapterPos < book.durChapterPos)
|
|
|
+ ) {
|
|
|
+ // 服务器没有进度或者进度比服务器快,上传现有进度
|
|
|
+ Coroutine.async {
|
|
|
+ AppWebDav.uploadBookProgress(BookProgress(book), uploadSuccessAction)
|
|
|
+ book.update()
|
|
|
}
|
|
|
+ } else if (progress.durChapterIndex > book.durChapterIndex ||
|
|
|
+ progress.durChapterPos > book.durChapterPos
|
|
|
+ ) {
|
|
|
+ // 进度比服务器慢,执行传入动作
|
|
|
+ newProgressAction?.invoke(progress)
|
|
|
+ } else {
|
|
|
+ syncSuccessAction?.invoke()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -591,12 +590,21 @@ object ReadManga : CoroutineScope by MainScope() {
|
|
|
it.imageCount = imageCount
|
|
|
}
|
|
|
|
|
|
- val contentList = mutableListOf<BaseMangaPage>()
|
|
|
- contentList.add(ReaderLoading(chapter.index, -1, "阅读 ${chapter.title}"))
|
|
|
- contentList.addAll(list)
|
|
|
- contentList.add(ReaderLoading(chapter.index, imageCount, "已读完 ${chapter.title}"))
|
|
|
+ if (AppConfig.hideMangaTitle) {
|
|
|
+ return MangaChapter(chapter, list, imageCount)
|
|
|
+ }
|
|
|
+
|
|
|
+ val pages = mutableListOf<BaseMangaPage>()
|
|
|
+
|
|
|
+ if (imageCount == 0 && chapter.isVolume) {
|
|
|
+ pages.add(ReaderLoading(chapter.index, -1, chapter.title))
|
|
|
+ } else {
|
|
|
+ pages.add(ReaderLoading(chapter.index, -1, "阅读 ${chapter.title}"))
|
|
|
+ pages.addAll(list)
|
|
|
+ pages.add(ReaderLoading(chapter.index, imageCount, "已读完 ${chapter.title}"))
|
|
|
+ }
|
|
|
|
|
|
- return MangaChapter(chapter, contentList, imageCount)
|
|
|
+ return MangaChapter(chapter, pages, imageCount)
|
|
|
}
|
|
|
|
|
|
interface Callback {
|