Repository: Automattic/pocket-casts-android
File: modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/create/SmartPlaylistPreviewPage.kt (Kotlin)

Code before:
        val spannable = getSummaryText(formatter, tintColor, showDuration = false, context)
        spannable.toAnnotatedString()
    }
}

@Composable
private fun PodcastEpisode.rememberTimeLeftText(): String {
    val context = LocalContext.current
    return remember(playedUpToMs, durationMs, isInProgress, context) {
        TimeHelper.getTimeLeft(playedUpToMs, durationMs.toLong(), isInProgress, context).text
    }
}

@Composable
@ReadOnlyComposable
private fun AppliedRules.description(ruleType: RuleType) = when (ruleType) {
    RuleType.Podcasts -> when (podcasts) {
        is PodcastsRule.Any -> stringResource(LR.string.all)
        is PodcastsRule.Selected -> podcasts.uuids.size.toString()
        null -> null
    }

    RuleType.EpisodeStatus -> {
        if (episodeStatus != null) {
            when {
                episodeStatus.unplayed -> when {
                    episodeStatus.inProgress && episodeStatus.completed -> {
                        stringResource(LR.string.episode_status_rule_description, stringResource(LR.string.unplayed), 2)
                    }
                    episodeStatus.inProgress || episodeStatus.completed -> {
                        stringResource(LR.string.episode_status_rule_description, stringResource(LR.string.unplayed), 1)
                    }
                    else -> {
                        stringResource(LR.string.unplayed)
                    }
                }

                episodeStatus.inProgress -> when {
                    episodeStatus.completed -> {
                        stringResource(LR.string.episode_status_rule_description, stringResource(LR.string.in_progress_uppercase), 1)
                    }

                    else -> {
                        stringResource(LR.string.in_progress_uppercase)
                    }
                }

                episodeStatus.completed -> {
                    stringResource(LR.string.played)
                }
                else -> null

Review comment (suggestion):
I believe this is the same as not using the episode status rule? In the current Filters create page, it would not be toggled on if this were the user's option. I wonder if this means the rule shouldn't be listed. 

Code after:
        spannable.toAnnotatedString()
    }
}

@Composable
private fun PodcastEpisode.rememberTimeLeftText(): String {
    val context = LocalContext.current
    return remember(playedUpToMs, durationMs, isInProgress, context) {
        TimeHelper.getTimeLeft(playedUpToMs, durationMs.toLong(), isInProgress, context).text
    }
}

@Composable
@ReadOnlyComposable
private fun AppliedRules.description(ruleType: RuleType) = when (ruleType) {
    RuleType.Podcasts -> when (podcasts) {
        is PodcastsRule.Any -> stringResource(LR.string.all)
        is PodcastsRule.Selected -> podcasts.uuids.size.toString()
        null -> null
    }

    RuleType.EpisodeStatus -> {
        if (episodeStatus != null) {
            when {
                episodeStatus.unplayed -> when {
                    episodeStatus.inProgress && episodeStatus.completed -> {
                        stringResource(LR.string.episode_status_rule_description, stringResource(LR.string.unplayed), 2)
                    }
                    episodeStatus.inProgress || episodeStatus.completed -> {
                        stringResource(LR.string.episode_status_rule_description, stringResource(LR.string.unplayed), 1)
                    }
                    else -> {
                        stringResource(LR.string.unplayed)
                    }
                }

                episodeStatus.inProgress -> when {
                    episodeStatus.completed -> {
                        stringResource(LR.string.episode_status_rule_description, stringResource(LR.string.in_progress_uppercase), 1)
                    }

                    else -> {
                        stringResource(LR.string.in_progress_uppercase)
                    }
                }

                episodeStatus.completed -> {
                    stringResource(LR.string.played)
                }
                else -> null
            }