Loading app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +8 −5 Original line number Original line Diff line number Diff line Loading @@ -43,8 +43,15 @@ class SystemAppsUpdatesRepository @Inject constructor( private var systemAppProjectList = mutableListOf<SystemAppProject>() private var systemAppProjectList = mutableListOf<SystemAppProject>() suspend fun fetchUpdatableSystemApps() { private fun getUpdatableSystemApps(): List<String> { return systemAppProjectList.map { it.packageName } } suspend fun fetchUpdatableSystemApps(forceRefresh: Boolean = false) { val result = handleNetworkResult { val result = handleNetworkResult { if (getUpdatableSystemApps().isNotEmpty() && !forceRefresh) { return@handleNetworkResult } val response = updatableSystemAppsApi.getUpdatableSystemApps() val response = updatableSystemAppsApi.getUpdatableSystemApps() if (response.isSuccessful && !response.body().isNullOrEmpty()) { if (response.isSuccessful && !response.body().isNullOrEmpty()) { response.body()?.let { systemAppProjectList.addAll(it) } response.body()?.let { systemAppProjectList.addAll(it) } Loading @@ -58,10 +65,6 @@ class SystemAppsUpdatesRepository @Inject constructor( } } } } fun getUpdatableSystemApps(): List<String> { return systemAppProjectList.map { it.packageName } } private fun isSystemAppBlocked( private fun isSystemAppBlocked( systemAppInfo: SystemAppInfo, systemAppInfo: SystemAppInfo, sdkLevel: Int, sdkLevel: Int, Loading app/src/main/java/foundation/e/apps/install/updates/UpdatesWorker.kt +1 −7 Original line number Original line Diff line number Diff line Loading @@ -64,7 +64,7 @@ class UpdatesWorker @AssistedInject constructor( } } refreshBlockedAppList() refreshBlockedAppList() refreshEligibleSystemApps() systemAppsUpdatesRepository.fetchUpdatableSystemApps(forceRefresh = true) checkForUpdates() checkForUpdates() Result.success() Result.success() } catch (e: Throwable) { } catch (e: Throwable) { Loading @@ -83,12 +83,6 @@ class UpdatesWorker @AssistedInject constructor( } } } } private suspend fun refreshEligibleSystemApps() { if (systemAppsUpdatesRepository.getEligibleSystemApps().isEmpty()) { systemAppsUpdatesRepository.fetchEligibleSystemApps() } } private suspend fun checkManualUpdateRunning(): Boolean { private suspend fun checkManualUpdateRunning(): Boolean { val workInfos = val workInfos = withContext(Dispatchers.IO) { withContext(Dispatchers.IO) { Loading Loading
app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +8 −5 Original line number Original line Diff line number Diff line Loading @@ -43,8 +43,15 @@ class SystemAppsUpdatesRepository @Inject constructor( private var systemAppProjectList = mutableListOf<SystemAppProject>() private var systemAppProjectList = mutableListOf<SystemAppProject>() suspend fun fetchUpdatableSystemApps() { private fun getUpdatableSystemApps(): List<String> { return systemAppProjectList.map { it.packageName } } suspend fun fetchUpdatableSystemApps(forceRefresh: Boolean = false) { val result = handleNetworkResult { val result = handleNetworkResult { if (getUpdatableSystemApps().isNotEmpty() && !forceRefresh) { return@handleNetworkResult } val response = updatableSystemAppsApi.getUpdatableSystemApps() val response = updatableSystemAppsApi.getUpdatableSystemApps() if (response.isSuccessful && !response.body().isNullOrEmpty()) { if (response.isSuccessful && !response.body().isNullOrEmpty()) { response.body()?.let { systemAppProjectList.addAll(it) } response.body()?.let { systemAppProjectList.addAll(it) } Loading @@ -58,10 +65,6 @@ class SystemAppsUpdatesRepository @Inject constructor( } } } } fun getUpdatableSystemApps(): List<String> { return systemAppProjectList.map { it.packageName } } private fun isSystemAppBlocked( private fun isSystemAppBlocked( systemAppInfo: SystemAppInfo, systemAppInfo: SystemAppInfo, sdkLevel: Int, sdkLevel: Int, Loading
app/src/main/java/foundation/e/apps/install/updates/UpdatesWorker.kt +1 −7 Original line number Original line Diff line number Diff line Loading @@ -64,7 +64,7 @@ class UpdatesWorker @AssistedInject constructor( } } refreshBlockedAppList() refreshBlockedAppList() refreshEligibleSystemApps() systemAppsUpdatesRepository.fetchUpdatableSystemApps(forceRefresh = true) checkForUpdates() checkForUpdates() Result.success() Result.success() } catch (e: Throwable) { } catch (e: Throwable) { Loading @@ -83,12 +83,6 @@ class UpdatesWorker @AssistedInject constructor( } } } } private suspend fun refreshEligibleSystemApps() { if (systemAppsUpdatesRepository.getEligibleSystemApps().isEmpty()) { systemAppsUpdatesRepository.fetchEligibleSystemApps() } } private suspend fun checkManualUpdateRunning(): Boolean { private suspend fun checkManualUpdateRunning(): Boolean { val workInfos = val workInfos = withContext(Dispatchers.IO) { withContext(Dispatchers.IO) { Loading