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

Commit 0efaa76f authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

change "eligible" to "updatable"

parent 8eb91a1d
Loading
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import timber.log.Timber
@Singleton
class SystemAppsUpdatesRepository @Inject constructor(
    @ApplicationContext private val context: Context,
    private val eligibleSystemAppsApi: EligibleSystemAppsApi,
    private val updatableSystemAppsApi: UpdatableSystemAppsApi,
    private val systemAppDefinitionApi: SystemAppDefinitionApi,
    private val applicationDataManager: ApplicationDataManager,
    private val appLoungePackageManager: AppLoungePackageManager,
@@ -43,22 +43,22 @@ class SystemAppsUpdatesRepository @Inject constructor(

    private var systemAppProjectList = mutableListOf<SystemAppProject>()

    suspend fun fetchEligibleSystemApps() {
    suspend fun fetchUpdatableSystemApps() {
        val result = handleNetworkResult {
            val response = eligibleSystemAppsApi.getUpdatableSystemApps()
            val response = updatableSystemAppsApi.getUpdatableSystemApps()
            if (response.isSuccessful && !response.body().isNullOrEmpty()) {
                response.body()?.let { systemAppProjectList.addAll(it) }
            } else {
                Timber.e("Failed to fetch eligible apps: ${response.errorBody()?.string()}")
                Timber.e("Failed to fetch updatable apps: ${response.errorBody()?.string()}")
            }
        }

        if (!result.isSuccess()) {
            Timber.e("Network error when fetching eligible apps - ${result.message}")
            Timber.e("Network error when fetching updatable apps - ${result.message}")
        }
    }

    fun getEligibleSystemApps(): List<String> {
    fun getUpdatableSystemApps(): List<String> {
        return systemAppProjectList.map { it.packageName }
    }

@@ -117,8 +117,8 @@ class SystemAppsUpdatesRepository @Inject constructor(
        val sdkLevel = getSdkLevel()
        val device = getDevice()

        val eligibleApps = getEligibleSystemApps()
        eligibleApps.forEach {
        val updatableApps = getUpdatableSystemApps()
        updatableApps.forEach {

            if (!appLoungePackageManager.isInstalled(it)) {
                // Don't install for system apps which are removed (by root or otherwise)
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import foundation.e.apps.data.gitlab.models.SystemAppProject
import retrofit2.Response
import retrofit2.http.GET

interface EligibleSystemAppsApi {
interface UpdatableSystemAppsApi {

    companion object {
        const val BASE_URL =
+5 −5
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import foundation.e.apps.data.cleanapk.CleanApkRetrofit
import foundation.e.apps.data.ecloud.EcloudApiInterface
import foundation.e.apps.data.exodus.ExodusTrackerApi
import foundation.e.apps.data.fdroid.FdroidApiInterface
import foundation.e.apps.data.gitlab.EligibleSystemAppsApi
import foundation.e.apps.data.gitlab.UpdatableSystemAppsApi
import foundation.e.apps.data.gitlab.SystemAppDefinitionApi
import foundation.e.apps.data.parentalcontrol.fdroid.FDroidMonitorApi
import foundation.e.apps.data.parentalcontrol.googleplay.AgeGroupApi
@@ -135,16 +135,16 @@ class RetrofitApiModule {

    @Singleton
    @Provides
    fun provideEligibleSystemAppsApi(
    fun provideUpdatableSystemAppsApi(
        okHttpClient: OkHttpClient,
        moshi: Moshi,
    ): EligibleSystemAppsApi {
    ): UpdatableSystemAppsApi {
        return Retrofit.Builder()
            .baseUrl(EligibleSystemAppsApi.BASE_URL)
            .baseUrl(UpdatableSystemAppsApi.BASE_URL)
            .client(okHttpClient)
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .build()
            .create(EligibleSystemAppsApi::class.java)
            .create(UpdatableSystemAppsApi::class.java)
    }

    @Singleton