update m+ for new chapter list format
All checks were successful
CI / Prepare job (push) Successful in 9s
CI / Build individual modules (push) Successful in 3m31s
CI / Publish repo (push) Successful in 43s

This commit is contained in:
Draff 2025-11-22 22:10:01 +00:00
parent cbfdd982ff
commit 2f2671757e
Signed by: Draff
GPG Key ID: E8A89F3211677653

View File

@ -76,6 +76,7 @@ class TitleDetailView(
val viewingPeriodDescription: String = "", val viewingPeriodDescription: String = "",
val nonAppearanceInfo: String = "", val nonAppearanceInfo: String = "",
val chapterListGroup: List<ChapterListGroup> = emptyList(), val chapterListGroup: List<ChapterListGroup> = emptyList(),
val chapterListV2: List<Chapter> = emptyList(),
val isSimulReleased: Boolean = false, val isSimulReleased: Boolean = false,
val rating: Rating = Rating.ALL_AGES, val rating: Rating = Rating.ALL_AGES,
val chaptersDescending: Boolean = true, val chaptersDescending: Boolean = true,
@ -84,6 +85,10 @@ class TitleDetailView(
) { ) {
val chapterList: List<Chapter> by lazy { val chapterList: List<Chapter> by lazy {
// Use the new V2 format if available, otherwise fall back to the old format
if (chapterListV2.isNotEmpty()) {
chapterListV2
} else {
// Doesn't include `midChapterList` by design as their site API returns it // Doesn't include `midChapterList` by design as their site API returns it
// just for visual representation to redirect users to their app. The extension // just for visual representation to redirect users to their app. The extension
// intends to allow users to read only what they can already read in their site. // intends to allow users to read only what they can already read in their site.
@ -93,6 +98,7 @@ class TitleDetailView(
chapterListGroup.flatMap { it.firstChapterList + it.midChapterList + it.lastChapterList } chapterListGroup.flatMap { it.firstChapterList + it.midChapterList + it.lastChapterList }
} }
} }
}
private val isWebtoon: Boolean private val isWebtoon: Boolean
get() = chapterList.isNotEmpty() && chapterList.all(Chapter::isVerticalOnly) get() = chapterList.isNotEmpty() && chapterList.all(Chapter::isVerticalOnly)
@ -322,9 +328,14 @@ class Chapter(
val chapterId: Int, val chapterId: Int,
val name: String, val name: String,
val subTitle: String? = null, val subTitle: String? = null,
val thumbnailUrl: String? = null,
val startTimeStamp: Int, val startTimeStamp: Int,
val endTimeStamp: Int, val endTimeStamp: Int,
val isVerticalOnly: Boolean = false, val isVerticalOnly: Boolean = false,
val alreadyViewed: Boolean = false,
val viewedForFree: Boolean = false,
val viewCount: Int = 0,
val commentCount: Int = 0,
) { ) {
val isExpired: Boolean val isExpired: Boolean