retrieve tables apps

This commit is contained in:
Simon Vieille
2024-06-27 20:08:56 +02:00
parent 38f400b24c
commit 05c35b9a63
+24 -35
View File
@@ -5,6 +5,11 @@ namespace OCA\SideMenu\Service;
use OC\User\User; use OC\User\User;
use OCP\INavigationManager; use OCP\INavigationManager;
use OCP\L10N\IFactory; 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. * class AppRepository.
@@ -13,43 +18,19 @@ use OCP\L10N\IFactory;
*/ */
class AppRepository 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( public function __construct(
\OC_App $ocApp, protected \OC_App $ocApp,
INavigationManager $navigationManager, protected INavigationManager $navigationManager,
IFactory $l10nFactory, protected IFactory $l10nFactory,
ConfigProxy $config, protected ConfigProxy $config,
CategoryRepository $categoryRepository protected CategoryRepository $categoryRepository,
protected IEventDispatcher $dispatcher,
protected IUserSession $userSession,
) { ) {
$this->ocApp = $ocApp; $this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent(
$this->l10nFactory = $l10nFactory; $this->userSession->isLoggedIn(),
$this->config = $config; new TemplateResponse(Application::APP_NAME, '')
$this->navigationManager = $navigationManager; ));
$this->categoryRepository = $categoryRepository;
} }
/** /**
@@ -90,6 +71,14 @@ class AppRepository
'external_links', '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']) { } elseif ('files' === $app['id']) {
$visibleApps[$app['id']] = [ $visibleApps[$app['id']] = [
'id' => $app['id'], 'id' => $app['id'],