diff --git a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/home/components/HomeContinueWatchingSection.kt b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/home/components/HomeContinueWatchingSection.kt index 9eaadf55d..209f7d647 100644 --- a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/home/components/HomeContinueWatchingSection.kt +++ b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/home/components/HomeContinueWatchingSection.kt @@ -23,6 +23,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text +import androidx.compose.material3.contentColorFor import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -434,10 +435,13 @@ private fun UpNextBadge( compact: Boolean, textSize: androidx.compose.ui.unit.TextUnit, ) { + val chipColor = MaterialTheme.colorScheme.primary + val chipTextColor = contentColorFor(chipColor) + Box( modifier = Modifier .clip(RoundedCornerShape(if (compact) 4.dp else 12.dp)) - .background(MaterialTheme.colorScheme.primary) + .background(chipColor) .padding( horizontal = if (compact) 6.dp else 8.dp, vertical = if (compact) 3.dp else 4.dp, @@ -449,7 +453,7 @@ private fun UpNextBadge( fontSize = textSize, fontWeight = FontWeight.Bold, ), - color = Color.White, + color = chipTextColor, maxLines = 1, ) } diff --git a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/watchprogress/WatchProgressRules.kt b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/watchprogress/WatchProgressRules.kt index 1caba2688..096feb643 100644 --- a/composeApp/src/commonMain/kotlin/com/nuvio/app/features/watchprogress/WatchProgressRules.kt +++ b/composeApp/src/commonMain/kotlin/com/nuvio/app/features/watchprogress/WatchProgressRules.kt @@ -4,11 +4,10 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import kotlin.math.max internal const val ContinueWatchingLimit = 20 -private const val MinResumePositionMs = 30_000L -private const val CompletionThresholdMs = 180_000L +private const val InProgressStartThresholdFraction = 0.02f +private const val CompletionThresholdFraction = 0.85 @Serializable private data class StoredWatchProgressPayload( @@ -39,9 +38,9 @@ internal fun shouldStoreWatchProgress( durationMs: Long, ): Boolean { val thresholdMs = if (durationMs > 0L) { - max(MinResumePositionMs, (durationMs * 0.02f).toLong()) + (durationMs * InProgressStartThresholdFraction).toLong() } else { - MinResumePositionMs + 1L } return positionMs >= thresholdMs } @@ -54,9 +53,8 @@ internal fun isWatchProgressComplete( if (isEnded) return true if (durationMs <= 0L) return false - val remainingMs = (durationMs - positionMs).coerceAtLeast(0L) val watchedFraction = positionMs.toDouble() / durationMs.toDouble() - return watchedFraction >= 0.92 || remainingMs <= CompletionThresholdMs + return watchedFraction >= CompletionThresholdFraction } internal fun List.resumeEntryForSeries(metaId: String): WatchProgressEntry? =