Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45adc5e3 authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

convert age ratings to lowercase before comparison

parent 6379c7c0
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -73,8 +73,10 @@ class ValidateAppAgeLimitUseCase @Inject constructor(
    private fun isValidAppAgeRating(
        app: AppInstall,
        allowedContentRating: ContentRatingGroup?
    ) = (app.contentRating.id.isNotEmpty()
            && allowedContentRating?.ratings?.contains(app.contentRating.id) == true)
    ): Boolean {
        val allowedAgeRatings = allowedContentRating?.ratings?.map { it.lowercase() } ?: emptyList()
        return app.contentRating.id.isNotEmpty() && allowedAgeRatings.contains(app.contentRating.id)
    }

    private fun isParentalControlDisabled(ageGroup: Age) = ageGroup == Age.PARENTAL_CONTROL_DISABLED