From 1237d64bdba24efdc219a4198c5bf82289d4d668 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 8 Sep 2021 23:43:17 +0200 Subject: [PATCH] add 'supported'-label to all supported apps, also if they are not downloaded yet Signed-off-by: Bjoern Schiessle --- .../lib/Controller/AppSettingsController.php | 5 +++++ lib/private/legacy/OC_App.php | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index 4d22e90f6458f..059d2d990797e 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -205,6 +205,7 @@ private function fetchApps() { } $apps = $this->getAppsForCategory(''); + $supportedApps = $appClass->getSupportedApps(); foreach ($apps as $app) { $app['appstore'] = true; if (!array_key_exists($app['id'], $this->allApps)) { @@ -212,6 +213,10 @@ private function fetchApps() { } else { $this->allApps[$app['id']] = array_merge($app, $this->allApps[$app['id']]); } + + if (in_array($app['id'], $supportedApps)) { + $this->allApps[$app['id']]['level'] = \OC_App::supportedApp; + } } // add bundle information diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 6fecddba54017..aba99ca17ccb5 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -776,6 +776,18 @@ public static function getAllApps(): array { return $apps; } + /** + * List all supported apps + * + * @return array + */ + public function getSupportedApps(): array { + /** @var \OCP\Support\Subscription\IRegistry $subscriptionRegistry */ + $subscriptionRegistry = \OC::$server->query(\OCP\Support\Subscription\IRegistry::class); + $supportedApps = $subscriptionRegistry->delegateGetSupportedApps(); + return $supportedApps; + } + /** * List all apps, this is used in apps.php * @@ -790,9 +802,7 @@ public function listAllApps(): array { $appList = []; $langCode = \OC::$server->getL10N('core')->getLanguageCode(); $urlGenerator = \OC::$server->getURLGenerator(); - /** @var \OCP\Support\Subscription\IRegistry $subscriptionRegistry */ - $subscriptionRegistry = \OC::$server->query(\OCP\Support\Subscription\IRegistry::class); - $supportedApps = $subscriptionRegistry->delegateGetSupportedApps(); + $supportedApps = $this->getSupportedApps(); foreach ($installedApps as $app) { if (array_search($app, $blacklist) === false) {