Sort chapters by upload date (#3180)
* Added sorting by upload date Spanish 'strings' contains the proper translation for the new feature. * Added missing sorting cases handling Previous commit missed some cases resulting in errors at runtime * Implemented review changes Shorter UI text and >= date comparison instead of >
This commit is contained in:
@@ -98,6 +98,7 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||
val sortFunction: (Chapter, Chapter) -> Int = when (manga.sorting) {
|
||||
Manga.SORTING_SOURCE -> { c1, c2 -> c2.source_order.compareTo(c1.source_order) }
|
||||
Manga.SORTING_NUMBER -> { c1, c2 -> c1.chapter_number.compareTo(c2.chapter_number) }
|
||||
Manga.SORTING_UPLOAD_DATE -> { c1, c2 -> c1.date_upload.compareTo(c2.date_upload) }
|
||||
else -> throw NotImplementedError("Unknown sorting method")
|
||||
}
|
||||
|
||||
@@ -117,6 +118,10 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||
it.chapter_number <= chapterNumber + 1
|
||||
}
|
||||
}
|
||||
Manga.SORTING_UPLOAD_DATE -> {
|
||||
chapters.drop(currChapterIndex + 1)
|
||||
.firstOrNull { it.date_upload >= chapter.date_upload}
|
||||
}
|
||||
else -> throw NotImplementedError("Unknown sorting method")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user