ref: remove IMDb badges from store version

This commit is contained in:
tapframe 2026-06-03 23:14:57 +05:30
parent 8560e0f323
commit 53bd43963b
8 changed files with 91 additions and 36 deletions

View file

@ -5,4 +5,5 @@ actual object AppFeaturePolicy {
actual val p2pEnabled: Boolean = true
actual val trailerPlaybackMode: TrailerPlaybackMode = TrailerPlaybackMode.IN_APP
actual val inAppUpdaterEnabled: Boolean = true
}
actual val imdbRatingLogoEnabled: Boolean = true
}

View file

@ -5,4 +5,5 @@ actual object AppFeaturePolicy {
actual val p2pEnabled: Boolean = true
actual val trailerPlaybackMode: TrailerPlaybackMode = TrailerPlaybackMode.EXTERNAL
actual val inAppUpdaterEnabled: Boolean = false
actual val imdbRatingLogoEnabled: Boolean = false
}

View file

@ -10,4 +10,5 @@ expect object AppFeaturePolicy {
val p2pEnabled: Boolean
val trailerPlaybackMode: TrailerPlaybackMode
val inAppUpdaterEnabled: Boolean
}
val imdbRatingLogoEnabled: Boolean
}

View file

@ -34,10 +34,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.nuvio.app.core.build.AppFeaturePolicy
import com.nuvio.app.features.details.MetaDetails
import com.nuvio.app.features.details.MetaExternalRating
import com.nuvio.app.features.details.formatRuntimeForDisplay
@ -111,30 +113,22 @@ fun DetailMetaInfo(
DetailHeroMetaBadge(text = badge)
}
if (validImdbRating != null && !hasMdbImdbRating) {
val imdbTextStyle = MaterialTheme.typography.titleMedium.copy(
fontWeight = FontWeight.Bold,
letterSpacing = 0.sp,
)
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Surface(
shape = RoundedCornerShape(4.dp),
color = ImdbYellow,
) {
Text(
text = stringResource(Res.string.source_imdb),
modifier = Modifier.padding(horizontal = 4.dp, vertical = 2.dp),
style = MaterialTheme.typography.labelMedium.copy(
fontSize = 10.sp,
fontWeight = FontWeight.Black,
letterSpacing = 0.sp,
),
color = ImdbBlack,
)
}
ImdbRatingSourceLabel(
storeTextStyle = imdbTextStyle,
storeTextColor = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(modifier = Modifier.width(5.dp))
Text(
text = validImdbRating,
style = MaterialTheme.typography.titleMedium,
style = imdbTextStyle,
color = ImdbYellow,
fontWeight = FontWeight.Bold,
)
}
}
@ -223,26 +217,67 @@ private fun DetailRatingsRow(
horizontalArrangement = Arrangement.spacedBy(14.dp),
) {
orderedRatings.forEach { (visuals, rating) ->
val ratingTextStyle = MaterialTheme.typography.titleSmall.copy(
fontWeight = FontWeight.Bold,
letterSpacing = 0.sp,
)
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Image(
painter = painterResource(visuals.logo),
contentDescription = visuals.displayName,
modifier = Modifier.size(width = visuals.logoWidth, height = 16.dp),
)
if (visuals.source == PROVIDER_IMDB && !AppFeaturePolicy.imdbRatingLogoEnabled) {
ImdbRatingSourceLabel(
storeTextStyle = ratingTextStyle,
storeTextColor = visuals.valueColor,
)
} else {
Image(
painter = painterResource(visuals.logo),
contentDescription = visuals.displayName,
modifier = Modifier.size(width = visuals.logoWidth, height = 16.dp),
)
}
Spacer(modifier = Modifier.width(4.dp))
Text(
text = visuals.format(rating.value),
style = MaterialTheme.typography.titleSmall,
style = ratingTextStyle,
color = visuals.valueColor,
fontWeight = FontWeight.Bold,
)
}
}
}
}
@Composable
private fun ImdbRatingSourceLabel(
storeTextStyle: TextStyle,
storeTextColor: Color,
) {
if (AppFeaturePolicy.imdbRatingLogoEnabled) {
Surface(
shape = RoundedCornerShape(4.dp),
color = ImdbYellow,
) {
Text(
text = stringResource(Res.string.source_imdb),
modifier = Modifier.padding(horizontal = 4.dp, vertical = 2.dp),
style = MaterialTheme.typography.labelMedium.copy(
fontSize = 10.sp,
fontWeight = FontWeight.Black,
letterSpacing = 0.sp,
),
color = ImdbBlack,
)
}
} else {
Text(
text = stringResource(Res.string.source_imdb),
style = storeTextStyle,
color = storeTextColor,
maxLines = 1,
)
}
}
@Composable
private fun MetaLabelValueRow(
label: String,

View file

@ -60,6 +60,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil3.compose.AsyncImage
import co.touchlab.kermit.Logger
import com.nuvio.app.core.build.AppFeaturePolicy
import com.nuvio.app.core.format.formatReleaseDateForDisplay
import com.nuvio.app.core.i18n.localizedSeasonEpisodeCode
import com.nuvio.app.core.ui.NuvioAnimatedWatchedBadge
@ -979,14 +980,27 @@ private fun ImdbEpisodeRatingBadge(
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Image(
painter = painterResource(Res.drawable.rating_imdb),
contentDescription = stringResource(Res.string.source_imdb),
modifier = Modifier
.width(logoWidth)
.height(logoHeight),
contentScale = ContentScale.Fit,
)
if (AppFeaturePolicy.imdbRatingLogoEnabled) {
Image(
painter = painterResource(Res.drawable.rating_imdb),
contentDescription = stringResource(Res.string.source_imdb),
modifier = Modifier
.width(logoWidth)
.height(logoHeight),
contentScale = ContentScale.Fit,
)
} else {
Text(
text = stringResource(Res.string.source_imdb),
style = MaterialTheme.typography.labelSmall.copy(
fontSize = textSize,
fontWeight = FontWeight.SemiBold,
letterSpacing = 0.sp,
),
color = Color.White.copy(alpha = 0.78f),
maxLines = 1,
)
}
Text(
text = rating,
style = MaterialTheme.typography.labelSmall.copy(

View file

@ -5,4 +5,5 @@ actual object AppFeaturePolicy {
actual val p2pEnabled: Boolean = false
actual val trailerPlaybackMode: TrailerPlaybackMode = TrailerPlaybackMode.EXTERNAL
actual val inAppUpdaterEnabled: Boolean = false
}
actual val imdbRatingLogoEnabled: Boolean = true
}

View file

@ -5,4 +5,5 @@ actual object AppFeaturePolicy {
actual val p2pEnabled: Boolean = false
actual val trailerPlaybackMode: TrailerPlaybackMode = TrailerPlaybackMode.EXTERNAL
actual val inAppUpdaterEnabled: Boolean = false
}
actual val imdbRatingLogoEnabled: Boolean = false
}

View file

@ -5,4 +5,5 @@ actual object AppFeaturePolicy {
actual val p2pEnabled: Boolean = false
actual val trailerPlaybackMode: TrailerPlaybackMode = TrailerPlaybackMode.IN_APP
actual val inAppUpdaterEnabled: Boolean = false
actual val imdbRatingLogoEnabled: Boolean = true
}