Skip to content

add app-dark.svg #839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)

<settings>
<admin>OCA\Passman\Settings\Admin</admin>
<admin-section>OCA\Passman\Settings\AdminSection</admin-section>
</settings>
</info>
12 changes: 12 additions & 0 deletions img/app-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getForm() {
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'additional';
return 'passman';
}

/**
Expand Down
7 changes: 7 additions & 0 deletions lib/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace OCA\Passman;

use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
Expand All @@ -31,6 +32,7 @@ class Notifier implements INotifier {

public function __construct(
protected IFactory $factory,
protected IURLGenerator $url,
) {
}

Expand All @@ -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':
Expand Down
2 changes: 1 addition & 1 deletion lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getForm(): TemplateResponse {
* @return string
*/
public function getSection(): string {
return 'additional';
return 'passman';
}

/**
Expand Down
58 changes: 58 additions & 0 deletions lib/Settings/AdminSection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Passman\Settings;

use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

class AdminSection implements IIconSection {
public function __construct(
private string $appName,
private IURLGenerator $url,
private IL10N $l,
) {
}

/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
*/
public function getID() {
return $this->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');
}
}