retrieve tables apps

This commit is contained in:
Simon Vieille 2024-06-27 20:08:56 +02:00
commit 05c35b9a63
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -5,6 +5,11 @@ namespace OCA\SideMenu\Service;
use OC\User\User;
use OCP\INavigationManager;
use OCP\L10N\IFactory;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\IUserSession;
use OCP\AppFramework\Http\TemplateResponse;
use OCA\SideMenu\AppInfo\Application;
/**
* class AppRepository.
@ -13,43 +18,19 @@ use OCP\L10N\IFactory;
*/
class AppRepository
{
/**
* @var \OC_App
*/
protected $ocApp;
/**
* @var IFactory
*/
protected $l10nFactory;
/**
* @var ConfigProxy
*/
protected $config;
/**
* @var CategoryRepository
*/
protected $categoryRepository;
/**
* @var INavigationManager
*/
protected $navigationManager;
public function __construct(
\OC_App $ocApp,
INavigationManager $navigationManager,
IFactory $l10nFactory,
ConfigProxy $config,
CategoryRepository $categoryRepository
protected \OC_App $ocApp,
protected INavigationManager $navigationManager,
protected IFactory $l10nFactory,
protected ConfigProxy $config,
protected CategoryRepository $categoryRepository,
protected IEventDispatcher $dispatcher,
protected IUserSession $userSession,
) {
$this->ocApp = $ocApp;
$this->l10nFactory = $l10nFactory;
$this->config = $config;
$this->navigationManager = $navigationManager;
$this->categoryRepository = $categoryRepository;
$this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent(
$this->userSession->isLoggedIn(),
new TemplateResponse(Application::APP_NAME, '')
));
}
/**
@ -90,6 +71,14 @@ class AppRepository
'external_links',
],
];
} elseif ('tables_application' === substr($app['id'], 0, 18)) {
$visibleApps[$app['id']] = [
'id' => $app['id'],
'name' => $this->getAppName($app),
'href' => $app['href'],
'icon' => $app['icon'],
'category' => [],
];
} elseif ('files' === $app['id']) {
$visibleApps[$app['id']] = [
'id' => $app['id'],