diff --git a/app/src/main/java/foundation/e/apps/MainActivity.kt b/app/src/main/java/foundation/e/apps/MainActivity.kt index c262504537f917938d160b2855465e715f87643e..f4f0988ec2c093f2ff53ebf9ede1caad0aea552d 100644 --- a/app/src/main/java/foundation/e/apps/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/MainActivity.kt @@ -382,7 +382,7 @@ class MainActivity : AppCompatActivity() { Timber.d("Sending broadcast with login type - $user") val intent = Intent(Constants.ACTION_PARENTAL_CONTROL_APP_LOUNGE_LOGIN).apply { setPackage(BuildConfig.PACKAGE_NAME_PARENTAL_CONTROL) - putExtra(COLUMN_LOGIN_TYPE, user) + putExtra(COLUMN_LOGIN_TYPE, user.name) } sendBroadcast(intent) } diff --git a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingsRepository.kt b/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingsRepository.kt index a3d77f95207c594f03cab37f4a2a3445586dfbbe..7804d09483d9a4d0cb5fa1de67ec146c0e9525fa 100644 --- a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingsRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingsRepository.kt @@ -25,6 +25,7 @@ import foundation.e.apps.data.ageRating.AgeGroupApi import foundation.e.apps.data.ageRating.FDroidMonitorApi import foundation.e.apps.data.handleNetworkResult import foundation.e.apps.data.login.AuthenticatorRepository +import foundation.e.apps.data.playstore.PlayStoreRepository import javax.inject.Inject import javax.inject.Singleton @@ -32,7 +33,7 @@ import javax.inject.Singleton class ContentRatingsRepository @Inject constructor( private val ageGroupApi: AgeGroupApi, private val fDroidMonitorApi: FDroidMonitorApi, - private val authenticatorRepository: AuthenticatorRepository, + private val playStoreRepository: PlayStoreRepository, ) { private var _contentRatingGroups = listOf() @@ -54,11 +55,8 @@ class ContentRatingsRepository @Inject constructor( } suspend fun getEnglishContentRating(packageName: String): ContentRating? { - val authData = authenticatorRepository.gplayAuth ?: return null - val contentRatingHelper = ContentRatingHelper(authData) - return handleNetworkResult { - contentRatingHelper.getEnglishContentRating(packageName) + playStoreRepository.getEnglishContentRating(packageName) }.data } } diff --git a/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt b/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt index 0239ce1f3366e1819c763876af65e8ffd3269af0..03733b0d271499e289a93363e50c4ed76a31a9ae 100644 --- a/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt @@ -49,4 +49,5 @@ interface PlayStoreRepository : StoreRepository { appPackage: String, contentRating: ContentRating ): ContentRating + suspend fun getEnglishContentRating(packageName: String): ContentRating? } diff --git a/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepositoryImpl.kt b/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepositoryImpl.kt index da884772134504403fa3cc1bdf52ffec02d5fe0c..f0e77af58647af9ca2a53aff6719d9709c2457c0 100644 --- a/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepositoryImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepositoryImpl.kt @@ -38,6 +38,7 @@ import com.aurora.gplayapi.helpers.TopChartsHelper import dagger.hilt.android.qualifiers.ApplicationContext import foundation.e.apps.R import foundation.e.apps.data.application.utils.CategoryType +import foundation.e.apps.data.handleNetworkResult import foundation.e.apps.data.login.AuthenticatorRepository import foundation.e.apps.data.playstore.utils.GPlayHttpClient import kotlinx.coroutines.Dispatchers @@ -228,4 +229,13 @@ class PlayStoreRepositoryImpl @Inject constructor( ) } } + + override suspend fun getEnglishContentRating(packageName: String): ContentRating? { + val authData = authenticatorRepository.gplayAuth ?: return null + val contentRatingHelper = ContentRatingHelper(authData) + + return withContext(Dispatchers.IO) { + contentRatingHelper.getEnglishContentRating(packageName) + } + } }