From 7343fee4b240f71726de592ab216f1a221762bf7 Mon Sep 17 00:00:00 2001 From: Jonas Rittershofer Date: Wed, 3 Feb 2021 15:29:31 +0100 Subject: [PATCH 1/4] Create proper Settings Section Signed-off-by: Jonas Rittershofer --- appinfo/info.xml | 1 + lib/Settings/RegistrationSettings.php | 3 +- lib/Settings/RegistrationSettingsSection.php | 73 ++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 lib/Settings/RegistrationSettingsSection.php diff --git a/appinfo/info.xml b/appinfo/info.xml index 55d3b0a9..4dc27130 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -42,5 +42,6 @@ This app allows users to register a new account. OCA\Registration\Settings\RegistrationSettings + OCA\Registration\Settings\RegistrationSettingsSection diff --git a/lib/Settings/RegistrationSettings.php b/lib/Settings/RegistrationSettings.php index 5414213e..ecf31398 100644 --- a/lib/Settings/RegistrationSettings.php +++ b/lib/Settings/RegistrationSettings.php @@ -44,7 +44,6 @@ public function __construct(string $appName, $this->appName = $appName; $this->config = $config; $this->groupManager = $groupManager; - $this->appName = $appName; } public function getForm(): TemplateResponse { @@ -86,7 +85,7 @@ public function getForm(): TemplateResponse { } public function getSection(): string { - return 'additional'; + return 'registration'; } public function getPriority(): int { diff --git a/lib/Settings/RegistrationSettingsSection.php b/lib/Settings/RegistrationSettingsSection.php new file mode 100644 index 00000000..df11e3d8 --- /dev/null +++ b/lib/Settings/RegistrationSettingsSection.php @@ -0,0 +1,73 @@ + + * + * @author Jonas Rittershofer + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Registration\Settings; + +use OCP\IL10N; +use OCP\IURLGenerator; +use OCP\Settings\IIconSection; + +class RegistrationSettingsSection implements IIconSection { + /** @var IL10N */ + private $l10n; + + /** @var IURLGenerator */ + private $urlGenerator; + + public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { + $this->l10n = $l10n; + $this->urlGenerator = $urlGenerator; + } + + /** + * Section ID to be set in Settings + * @return string + */ + public function getID(): string { + return 'registration'; + } + + /** + * Section Name to be displayed + * @return string + */ + public function getName(): string { + return $this->l10n->t('Registration'); + } + + /** + * Return Priority of section 0-100 + * @return int + */ + public function getPriority(): int { + return 80; + } + + /** + * Pass the relative path to the icon + * @return string + */ + public function getIcon(): string { + return $this->urlGenerator->imagePath('registration', 'app.svg'); + } +} From e2f2836ae0f0314703ba722f9708e2b141b777d7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 3 Feb 2021 16:45:31 +0100 Subject: [PATCH 2/4] Use "AccountPlus" material design icon Signed-off-by: Joas Schilling --- img/app.svg | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/img/app.svg b/img/app.svg index 4c8bb1b7..2589e24c 100644 --- a/img/app.svg +++ b/img/app.svg @@ -1,7 +1 @@ - - - - - - - \ No newline at end of file + From 36571111c572603642a1c3bfb5a895b2cf227755 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 4 Feb 2021 11:03:50 +0100 Subject: [PATCH 3/4] Use a white app icon and a dark one for the settings Signed-off-by: Joas Schilling --- img/app-dark.svg | 1 + img/app.svg | 2 +- lib/Settings/RegistrationSettingsSection.php | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 img/app-dark.svg diff --git a/img/app-dark.svg b/img/app-dark.svg new file mode 100644 index 00000000..2589e24c --- /dev/null +++ b/img/app-dark.svg @@ -0,0 +1 @@ + diff --git a/img/app.svg b/img/app.svg index 2589e24c..c0062b9b 100644 --- a/img/app.svg +++ b/img/app.svg @@ -1 +1 @@ - + diff --git a/lib/Settings/RegistrationSettingsSection.php b/lib/Settings/RegistrationSettingsSection.php index df11e3d8..f3ddc9d2 100644 --- a/lib/Settings/RegistrationSettingsSection.php +++ b/lib/Settings/RegistrationSettingsSection.php @@ -38,7 +38,7 @@ public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { $this->l10n = $l10n; $this->urlGenerator = $urlGenerator; } - + /** * Section ID to be set in Settings * @return string @@ -46,7 +46,7 @@ public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { public function getID(): string { return 'registration'; } - + /** * Section Name to be displayed * @return string @@ -54,7 +54,7 @@ public function getID(): string { public function getName(): string { return $this->l10n->t('Registration'); } - + /** * Return Priority of section 0-100 * @return int @@ -62,12 +62,12 @@ public function getName(): string { public function getPriority(): int { return 80; } - + /** * Pass the relative path to the icon * @return string */ public function getIcon(): string { - return $this->urlGenerator->imagePath('registration', 'app.svg'); + return $this->urlGenerator->imagePath('registration', 'app-dark.svg'); } } From 1e7c92bd31402a2c01cb1866cece43b97ea89b25 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 4 Feb 2021 11:15:33 +0100 Subject: [PATCH 4/4] Make strict Signed-off-by: Joas Schilling --- lib/Settings/RegistrationSettings.php | 3 ++- lib/Settings/RegistrationSettingsSection.php | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Settings/RegistrationSettings.php b/lib/Settings/RegistrationSettings.php index ecf31398..2794281a 100644 --- a/lib/Settings/RegistrationSettings.php +++ b/lib/Settings/RegistrationSettings.php @@ -25,6 +25,7 @@ namespace OCA\Registration\Settings; +use OCA\Registration\AppInfo\Application; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IGroupManager; @@ -85,7 +86,7 @@ public function getForm(): TemplateResponse { } public function getSection(): string { - return 'registration'; + return Application::APP_ID; } public function getPriority(): int { diff --git a/lib/Settings/RegistrationSettingsSection.php b/lib/Settings/RegistrationSettingsSection.php index f3ddc9d2..36343af0 100644 --- a/lib/Settings/RegistrationSettingsSection.php +++ b/lib/Settings/RegistrationSettingsSection.php @@ -1,4 +1,7 @@ * @@ -23,6 +26,7 @@ namespace OCA\Registration\Settings; +use OCA\Registration\AppInfo\Application; use OCP\IL10N; use OCP\IURLGenerator; use OCP\Settings\IIconSection; @@ -44,7 +48,7 @@ public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { * @return string */ public function getID(): string { - return 'registration'; + return Application::APP_ID; } /** @@ -68,6 +72,6 @@ public function getPriority(): int { * @return string */ public function getIcon(): string { - return $this->urlGenerator->imagePath('registration', 'app-dark.svg'); + return $this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg'); } }