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

Commit 72c352c2 authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

Use new gplayapi method to directly get ratings in english

parent c3ecebe6
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ dependencies {
    api files('libs/splitinstall-lib.jar')

    implementation 'foundation.e.lib:telemetry:0.0.11-alpha'
    implementation "foundation.e:gplayapi:3.2.10-3"
    implementation "foundation.e:gplayapi:3.2.10-4"
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.fragment:fragment-ktx:1.5.6'
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
package foundation.e.apps.data.application.apps

import com.aurora.gplayapi.data.models.AuthData
import com.aurora.gplayapi.data.models.ContentRating
import foundation.e.apps.data.application.data.Application
import foundation.e.apps.data.enums.FilterLevel
import foundation.e.apps.data.enums.Origin
@@ -66,4 +67,6 @@ interface AppsApi {

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

    suspend fun getEnglishContentRating(packageName: String): ContentRating?
}
+7 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ package foundation.e.apps.data.application.apps
import android.content.Context
import com.aurora.gplayapi.data.models.App
import com.aurora.gplayapi.data.models.AuthData
import com.aurora.gplayapi.data.models.ContentRating
import dagger.hilt.android.qualifiers.ApplicationContext
import foundation.e.apps.data.AppSourcesContainer
import foundation.e.apps.data.application.ApplicationDataManager
@@ -265,4 +266,10 @@ class AppsApiImpl @Inject constructor(
    }

    override fun isOpenSourceSelected() = appLoungePreference.isOpenSourceSelected()

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

    suspend fun getEnglishContentRating(
        appPackage: String,
    ): ContentRating
}
+9 −0
Original line number Diff line number Diff line
@@ -228,4 +228,13 @@ 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