Loading app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +8 −8 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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 } } Loading Loading @@ -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) Loading app/src/main/java/foundation/e/apps/data/gitlab/EligibleSystemAppsApi.kt→app/src/main/java/foundation/e/apps/data/gitlab/UpdatableSystemAppsApi.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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 = Loading app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt +5 −5 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 Loading Loading
app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +8 −8 Original line number Diff line number Diff line Loading @@ -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, Loading @@ -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 } } Loading Loading @@ -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) Loading
app/src/main/java/foundation/e/apps/data/gitlab/EligibleSystemAppsApi.kt→app/src/main/java/foundation/e/apps/data/gitlab/UpdatableSystemAppsApi.kt +1 −1 Original line number Diff line number Diff line Loading @@ -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 = Loading
app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt +5 −5 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 Loading