Fix ProgressUpdateUseCase
This commit is contained in:
@@ -34,12 +34,17 @@ class ProgressUpdateUseCase @Inject constructor(
|
|||||||
}
|
}
|
||||||
val chapter = details.findChapterById(history.chapterId) ?: return PROGRESS_NONE
|
val chapter = details.findChapterById(history.chapterId) ?: return PROGRESS_NONE
|
||||||
val chapters = details.getChapters(chapter.branch)
|
val chapters = details.getChapters(chapter.branch)
|
||||||
|
val chapterRepo = if (repo.source == chapter.source) {
|
||||||
|
repo
|
||||||
|
} else {
|
||||||
|
mangaRepositoryFactory.create(chapter.source)
|
||||||
|
}
|
||||||
val chaptersCount = chapters.size
|
val chaptersCount = chapters.size
|
||||||
if (chaptersCount == 0) {
|
if (chaptersCount == 0) {
|
||||||
return PROGRESS_NONE
|
return PROGRESS_NONE
|
||||||
}
|
}
|
||||||
val chapterIndex = chapters.indexOfFirst { x -> x.id == history.chapterId }
|
val chapterIndex = chapters.indexOfFirst { x -> x.id == history.chapterId }
|
||||||
val pagesCount = repo.getPages(chapter).size
|
val pagesCount = chapterRepo.getPages(chapter).size
|
||||||
if (pagesCount == 0) {
|
if (pagesCount == 0) {
|
||||||
return PROGRESS_NONE
|
return PROGRESS_NONE
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user