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

Commit a2e2a7de authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

move getEnglishContentRating to ContentRatingsRepository

parent e2d2b61e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -67,6 +67,4 @@ interface AppsApi {

    fun isAnyAppInstallStatusChanged(currentList: List<Application>): Boolean
    fun isOpenSourceSelected(): Boolean

    suspend fun getEnglishContentRating(packageName: String): ContentRating?
}
+0 −6
Original line number Diff line number Diff line
@@ -266,10 +266,4 @@ class AppsApiImpl @Inject constructor(
    }

    override fun isOpenSourceSelected() = appLoungePreference.isOpenSourceSelected()

    override suspend fun getEnglishContentRating(packageName: String): ContentRating? {
        return handleNetworkResult {
            appSources.gplayRepo.getEnglishContentRating(packageName)
        }.data
    }
}
+14 −0
Original line number Diff line number Diff line
@@ -19,13 +19,18 @@

package foundation.e.apps.data.blockedApps

import com.aurora.gplayapi.data.models.ContentRating
import com.aurora.gplayapi.helpers.ContentRatingHelper
import foundation.e.apps.data.ageRating.AgeGroupApi
import foundation.e.apps.data.handleNetworkResult
import foundation.e.apps.data.login.AuthenticatorRepository
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class ContentRatingsRepository @Inject constructor(
    private val ageGroupApi: AgeGroupApi,
    private val authenticatorRepository: AuthenticatorRepository,
) {

    private var _contentRatingGroups = listOf<ContentRatingGroup>()
@@ -38,4 +43,13 @@ class ContentRatingsRepository @Inject constructor(
            _contentRatingGroups = response.body() ?: emptyList()
        }
    }

    suspend fun getEnglishContentRating(packageName: String): ContentRating? {
        val authData = authenticatorRepository.gplayAuth!!
        val contentRatingHelper = ContentRatingHelper(authData)

        return handleNetworkResult {
            contentRatingHelper.getEnglishContentRating(packageName)
        }.data
    }
}
+0 −4
Original line number Diff line number Diff line
@@ -49,8 +49,4 @@ interface PlayStoreRepository : StoreRepository {
        appPackage: String,
        contentRating: ContentRating
    ): ContentRating

    suspend fun getEnglishContentRating(
        appPackage: String,
    ): ContentRating
}
+0 −9
Original line number Diff line number Diff line
@@ -228,13 +228,4 @@ class PlayStoreRepositoryImpl @Inject constructor(
            )
        }
    }

    override suspend fun getEnglishContentRating(appPackage: String): ContentRating {
        val authData = authenticatorRepository.gplayAuth!!
        val contentRatingHelper = ContentRatingHelper(authData)

        return withContext(Dispatchers.IO) {
            contentRatingHelper.getEnglishContentRating(appPackage)
        }
    }
}
Loading