Loading app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt +12 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package foundation.e.apps.domain import com.aurora.gplayapi.data.models.ContentRating import com.aurora.gplayapi.exceptions.InternalException import foundation.e.apps.contract.ParentalControlContract.Age import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.application.apps.AppsApi Loading Loading @@ -77,7 +78,9 @@ class ValidateAppAgeLimitUseCase @Inject constructor( data = ContentRatingValidity(true) ) hasNoContentRatingOnGPlay(app) -> ResultSupreme.Error() hasNoContentRatingOnGPlay(app) -> ResultSupreme.Success( data = ContentRatingValidity(false, requestPin = true) ) isParentalGuidance(app) -> ResultSupreme.Success( data = ContentRatingValidity(false, requestPin = true) Loading Loading @@ -158,9 +161,14 @@ class ValidateAppAgeLimitUseCase @Inject constructor( private suspend fun verifyContentRatingExists(app: AppInstall): Boolean { if (app.contentRating.id.isEmpty()) { val fetchedContentRating = var fetchedContentRating : ContentRating? = null try { fetchedContentRating = gPlayContentRatingRepository.getEnglishContentRating(app.packageName) } catch(exception: InternalException.AppNotFound){ Timber.d("Error fetching age ratings for the package : ${app.packageName}" ) return false } Timber.d("Fetched content rating - ${app.packageName} - ${fetchedContentRating?.id}") app.contentRating = if (fetchedContentRating == null) { Loading Loading
app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt +12 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package foundation.e.apps.domain import com.aurora.gplayapi.data.models.ContentRating import com.aurora.gplayapi.exceptions.InternalException import foundation.e.apps.contract.ParentalControlContract.Age import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.application.apps.AppsApi Loading Loading @@ -77,7 +78,9 @@ class ValidateAppAgeLimitUseCase @Inject constructor( data = ContentRatingValidity(true) ) hasNoContentRatingOnGPlay(app) -> ResultSupreme.Error() hasNoContentRatingOnGPlay(app) -> ResultSupreme.Success( data = ContentRatingValidity(false, requestPin = true) ) isParentalGuidance(app) -> ResultSupreme.Success( data = ContentRatingValidity(false, requestPin = true) Loading Loading @@ -158,9 +161,14 @@ class ValidateAppAgeLimitUseCase @Inject constructor( private suspend fun verifyContentRatingExists(app: AppInstall): Boolean { if (app.contentRating.id.isEmpty()) { val fetchedContentRating = var fetchedContentRating : ContentRating? = null try { fetchedContentRating = gPlayContentRatingRepository.getEnglishContentRating(app.packageName) } catch(exception: InternalException.AppNotFound){ Timber.d("Error fetching age ratings for the package : ${app.packageName}" ) return false } Timber.d("Fetched content rating - ${app.packageName} - ${fetchedContentRating?.id}") app.contentRating = if (fetchedContentRating == null) { Loading