diff --git a/lib/Service/AppRepository.php b/lib/Service/AppRepository.php index ec10a36..d53317c 100644 --- a/lib/Service/AppRepository.php +++ b/lib/Service/AppRepository.php @@ -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'],