From 664bd5802f19c8e0768b64a6f66713d95a9aaab5 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 78326c2e25a..5ed25ec2e2a 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -204,6 +204,7 @@ class AppSettingsController extends Controller { } $apps = $this->getAppsForCategory(''); + $supportedApps = $appClass->getSupportedApps(); foreach ($apps as $app) { $app['appstore'] = true; if (!array_key_exists($app['id'], $this->allApps)) { @@ -211,6 +212,10 @@ class AppSettingsController extends Controller { } 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 811703570a2..101523fcfe7 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -773,6 +773,18 @@ class OC_App { 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 * @@ -787,9 +799,7 @@ class OC_App { $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) { -- 2.39.5