diff options
-rw-r--r-- | .gitlab-ci.yml | 6 | ||||
-rw-r--r-- | app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7374aa..8aa5006 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,7 +99,11 @@ build-e-release: variables: MAPBOX_KEY: $MAPBOX_KEY_PROD when: always - - when: never + - if: '$CI_COMMIT_REF_PROTECTED == "true"' + variables: + MAPBOX_KEY: $MAPBOX_KEY_PROD + when: manual + artifacts: paths: - app/build/outputs/apk diff --git a/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt b/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt index 0b951a8..2d7651d 100644 --- a/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt +++ b/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt @@ -138,16 +138,16 @@ class AppListsRepository( private var lastFetchApps = 0 private var refreshAppJob: Job? = null private fun refreshAppDescriptions(fetchMissingIcons: Boolean = true, force: Boolean = false): Job? { - if (refreshAppJob == null) { + if (refreshAppJob == null || refreshAppJob?.isCompleted == true) { refreshAppJob = coroutineScope.launch(Dispatchers.IO) { - if (force || context.packageManager.getChangedPackages(lastFetchApps) != null) { + if (appsByUid.isEmpty() || appsByAPId.isEmpty() || + force || context.packageManager.getChangedPackages(lastFetchApps) != null + ) { fetchAppDescriptions(fetchMissingIcons = fetchMissingIcons) if (fetchMissingIcons) { lastFetchApps = context.packageManager.getChangedPackages(lastFetchApps) ?.sequenceNumber ?: lastFetchApps } - - refreshAppJob = null } } } |