From 7aa3e419db4e8aecf4818aefe6a796db11ec8a66 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 8 Jun 2023 16:38:13 -0300 Subject: [PATCH] [app] always check for new updates when index had changes and auto-download updates only once, not again for each repo that gets updated --- .../main/java/org/fdroid/fdroid/UpdateService.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/UpdateService.java b/app/src/main/java/org/fdroid/fdroid/UpdateService.java index 1e0d67c38..cdcbc3e5c 100644 --- a/app/src/main/java/org/fdroid/fdroid/UpdateService.java +++ b/app/src/main/java/org/fdroid/fdroid/UpdateService.java @@ -489,17 +489,15 @@ public class UpdateService extends JobIntentService { } Log.e(TAG, "Error updating repository " + repo.getAddress(), e); } - // now that downloading the index is done, start downloading updates - // TODO why are we checking for updates several times (in loop and below) - if (changes && fdroidPrefs.isAutoDownloadEnabled() && fdroidPrefs.isBackgroundDownloadAllowed()) { - autoDownloadUpdates(this); - } } - if (!changes) { - Utils.debugLog(TAG, "Not checking app details or compatibility, because repos were up to date."); - } else if (fdroidPrefs.isUpdateNotificationEnabled() && !fdroidPrefs.isAutoDownloadEnabled()) { + if (changes) { appUpdateStatusManager.checkForUpdates(); + // now that downloading the index is done, start downloading updates + if (fdroidPrefs.isAutoDownloadEnabled() && fdroidPrefs.isBackgroundDownloadAllowed()) { + // this is using DbUpdateChecker#getUpdatableApps() again which isn't optimal + autoDownloadUpdates(this); + } } fdroidPrefs.setLastUpdateCheck(System.currentTimeMillis());