diff --git a/appinfo/info.xml b/appinfo/info.xml index 3c350f161..c3e3c5f37 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -65,5 +65,6 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc) OCA\Passman\Settings\Admin + OCA\Passman\Settings\AdminSection diff --git a/img/app-dark.svg b/img/app-dark.svg new file mode 100644 index 000000000..88ed5d12e --- /dev/null +++ b/img/app-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 1c97b882e..f46cbb996 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -46,7 +46,7 @@ public function getForm() { * @return string the section ID, e.g. 'sharing' */ public function getSection() { - return 'additional'; + return 'passman'; } /** diff --git a/lib/Notifier.php b/lib/Notifier.php index d5beddec8..481451084 100644 --- a/lib/Notifier.php +++ b/lib/Notifier.php @@ -23,6 +23,7 @@ namespace OCA\Passman; +use OCP\IURLGenerator; use OCP\L10N\IFactory; use OCP\Notification\INotification; use OCP\Notification\INotifier; @@ -31,6 +32,7 @@ class Notifier implements INotifier { public function __construct( protected IFactory $factory, + protected IURLGenerator $url, ) { } @@ -47,6 +49,11 @@ public function prepare(INotification $notification, string $languageCode): INot // Read the language from the notification $l = $this->factory->get('passman', $languageCode); + // Set the icon for the notification + $notification->setIcon( + $this->url->getAbsoluteURL($this->url->imagePath('passman', 'app-dark.svg')) + ); + switch ($notification->getSubject()) { // Deal with known subjects case 'credential_expired': diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index ec7cb60ad..99b0b2b3a 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -95,7 +95,7 @@ public function getForm(): TemplateResponse { * @return string */ public function getSection(): string { - return 'additional'; + return 'passman'; } /** diff --git a/lib/Settings/AdminSection.php b/lib/Settings/AdminSection.php new file mode 100644 index 000000000..ef8f47a05 --- /dev/null +++ b/lib/Settings/AdminSection.php @@ -0,0 +1,58 @@ +appName; + } + + /** + * returns the translated name as it should be displayed, e.g. 'LDAP / AD + * integration'. Use the L10N service to translate it. + * + * @return string + */ + public function getName() { + return $this->l->t('Passman'); + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. + * + * E.g.: 70 + */ + public function getPriority() { + return 70; + } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath($this->appName, 'app-dark.svg'); + } +}