Fix branch detection #143
This commit is contained in:
@@ -191,7 +191,8 @@ class DetailsViewModel(
|
|||||||
// find default branch
|
// find default branch
|
||||||
val hist = historyRepository.getOne(manga)
|
val hist = historyRepository.getOne(manga)
|
||||||
selectedBranch.value = if (hist != null) {
|
selectedBranch.value = if (hist != null) {
|
||||||
manga.chapters?.find { it.id == hist.chapterId }?.branch
|
val currentChapter = manga.chapters?.find { it.id == hist.chapterId }
|
||||||
|
if (currentChapter != null) currentChapter.branch else predictBranch(manga.chapters)
|
||||||
} else {
|
} else {
|
||||||
predictBranch(manga.chapters)
|
predictBranch(manga.chapters)
|
||||||
}
|
}
|
||||||
@@ -203,6 +204,8 @@ class DetailsViewModel(
|
|||||||
} else {
|
} else {
|
||||||
localMangaRepository.findSavedManga(manga)
|
localMangaRepository.findSavedManga(manga)
|
||||||
}
|
}
|
||||||
|
}.onFailure { error ->
|
||||||
|
if (BuildConfig.DEBUG) error.printStackTrace()
|
||||||
}.getOrNull()
|
}.getOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user