add 'supported'-label to all supported apps, also if they are not downloaded yet

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
pull/29182/head
Bjoern Schiessle 2021-09-08 23:43:17 +07:00 committed by backportbot[bot]
parent bb56e9df55
commit 1237d64bdb
2 changed files with 18 additions and 3 deletions

@ -205,6 +205,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)) {
@ -212,6 +213,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

@ -776,6 +776,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
*
@ -790,9 +802,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) {