Move the paid title warning location in Bilibili. (#11747)

This commit is contained in:
Alessandro Jean 2022-05-05 19:37:47 -03:00 committed by GitHub
parent a4da018f9f
commit 6afdc59180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'BILIBILI'
pkgNameSuffix = 'all.bilibili'
extClass = '.BilibiliFactory'
extVersionCode = 6
extVersionCode = 7
}
dependencies {

View File

@ -98,10 +98,16 @@ abstract class Bilibili(
protected open val defaultLatestSort: Int = 2
protected open val hasPaidChaptersWarning: String = when (lang) {
"zh", "zh-Hans" -> "此漫画的付费章节已从章节列表中过滤暂时请用网页端或官方app阅读。"
"zh", "zh-Hans" -> "$EMOJI_WARNING 此漫画的付费章节已从章节列表中过滤暂时请用网页端或官方app阅读。"
else ->
"This series has paid chapters that were filtered out from the chapter list. " +
"Use the BILIBILI website or the official app to read them for now."
"$EMOJI_WARNING WARNING: This series has paid chapters that were filtered out from " +
"the chapter list. If you have already bought and have any in your account, sign " +
"in through WebView and refresh the chapter list to read them."
}
protected open val paidLabel: String = when (lang) {
"zh", "zh-Hans" -> "付费"
else -> "Paid"
}
protected open val imageQualityPrefTitle: String = when (lang) {
@ -347,13 +353,13 @@ abstract class Bilibili(
title = comic.title
author = comic.authorName.joinToString()
status = if (comic.isFinish == 1) SManga.COMPLETED else SManga.ONGOING
genre = comic.styles.joinToString()
genre = comic.genres(paidLabel, EMOJI_LOCKED).joinToString()
description = comic.classicLines
thumbnail_url = comic.verticalCover + THUMBNAIL_RESOLUTION
url = "/detail/mc" + comic.id
if (comic.hasPaidChapters && !signedIn) {
description += "\n\n$hasPaidChaptersWarning"
description = "$hasPaidChaptersWarning\n\n$description"
}
}
@ -586,5 +592,8 @@ abstract class Bilibili(
private val DATE_FORMATTER by lazy {
SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH)
}
private const val EMOJI_LOCKED = "\uD83D\uDD12"
private const val EMOJI_WARNING = "\u26A0\uFE0F"
}
}

View File

@ -30,6 +30,9 @@ data class BilibiliComicDto(
) {
val hasPaidChapters: Boolean
get() = episodeList.any { episode -> episode.payMode == 1 && episode.payGold > 0 }
fun genres(paidLabel: String, emoji: String): List<String> =
(if (hasPaidChapters) listOf("$emoji $paidLabel") else emptyList()) + styles
}
@Serializable