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 nonAppearanceInfo: String = "",
val chapterListGroup: List<ChapterListGroup> = emptyList(),
val chapterListV2: List<Chapter> = emptyList(),
val isSimulReleased: Boolean = false,
val rating: Rating = Rating.ALL_AGES,
val chaptersDescending: Boolean = true,
@ -84,13 +85,18 @@ class TitleDetailView(
) {
val chapterList: List<Chapter> by lazy {
// Doesn't include `midChapterList` by design as their site API returns it
// 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.
if (titleLabels.planType != "standard") {
chapterListGroup.flatMap { it.firstChapterList + it.lastChapterList }
// Use the new V2 format if available, otherwise fall back to the old format
if (chapterListV2.isNotEmpty()) {
chapterListV2
} else {
chapterListGroup.flatMap { it.firstChapterList + it.midChapterList + it.lastChapterList }
// Doesn't include `midChapterList` by design as their site API returns it
// 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.
if (titleLabels.planType != "standard") {
chapterListGroup.flatMap { it.firstChapterList + it.lastChapterList }
} else {
chapterListGroup.flatMap { it.firstChapterList + it.midChapterList + it.lastChapterList }
}
}
}
@ -322,9 +328,14 @@ class Chapter(
val chapterId: Int,
val name: String,
val subTitle: String? = null,
val thumbnailUrl: String? = null,
val startTimeStamp: Int,
val endTimeStamp: Int,
val isVerticalOnly: Boolean = false,
val alreadyViewed: Boolean = false,
val viewedForFree: Boolean = false,
val viewCount: Int = 0,
val commentCount: Int = 0,
) {
val isExpired: Boolean