Skip to content

Commit

Permalink
add 'supported'-label to all supported apps, also if they are not dow…
Browse files Browse the repository at this point in the history
…nloaded yet

Signed-off-by: Bjoern Schiessle <[email protected]>
  • Loading branch information
schiessle committed Oct 6, 2021
1 parent 9a569ff commit 664bd58
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions apps/settings/lib/Controller/AppSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,18 @@ private function fetchApps() {
}

$apps = $this->getAppsForCategory('');
$supportedApps = $appClass->getSupportedApps();
foreach ($apps as $app) {
$app['appstore'] = true;
if (!array_key_exists($app['id'], $this->allApps)) {
$this->allApps[$app['id']] = $app;
} 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
Expand Down
16 changes: 13 additions & 3 deletions lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,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
*
Expand All @@ -787,9 +799,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) {
Expand Down

0 comments on commit 664bd58

Please sign in to comment.