From 54cfa4a1b55e4990760e11ebee4f6e2e894742f8 Mon Sep 17 00:00:00 2001 From: binsky Date: Thu, 15 Jun 2023 20:40:49 +0200 Subject: [PATCH] move navigation entry logic from Application.php to info.xml --- appinfo/info.xml | 8 ++++++++ lib/AppInfo/Application.php | 28 +--------------------------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index a48758db..946f6c76 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -55,6 +55,14 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc) + + + Passwords + passman.Page.index + 10 + + + OCA\Passman\Settings\Admin diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index efdda954..ce0697dd 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -46,9 +46,6 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\IDBConnection; use OCP\IGroupManager; -use OCP\IL10N; -use OCP\INavigationManager; -use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IUserSession; use OCP\Notification\IManager; @@ -127,32 +124,9 @@ class Application extends App implements IBootstrap { public function boot(IBootContext $context): void { /** @var IManager $manager */ - $manager = $context->getAppContainer()->get(IManager::class); + $manager = $context->getAppContainer()->query(IManager::class); $manager->registerNotifierService(Notifier::class); Util::addTranslations(self::APP_ID); - $this->registerNavigationEntry(); - } - - /** - * Register the navigation entry - */ - public function registerNavigationEntry() { - $c = $this->getContainer(); - /** @var INavigationManager $navigationManager */ - $navigationManager = $c->get(INavigationManager::class); - - $navigationEntry = function () use ($c) { - /** @var IURLGenerator $urlGenerator */ - $urlGenerator = $c->get(IURLGenerator::class); - return [ - 'id' => $c->getAppName(), - 'order' => 10, - 'name' => $c->get(IL10N::class)->t('Passwords'), - 'href' => $urlGenerator->linkToRoute('passman.Page.index'), - 'icon' => $urlGenerator->imagePath($c->getAppName(), 'app.svg'), - ]; - }; - $navigationManager->add($navigationEntry); } }