diff --git a/appinfo/info.xml b/appinfo/info.xml index c9a3817..05deb77 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -4,7 +4,7 @@ Minimal Profile Hides profile fields to create a minimal user profile Allows administrators to hide profile fields like pronouns, social links, etc. - 1.0.4 + 1.0.5 AGPL Your Name MinimalProfile @@ -14,7 +14,4 @@ - - - \ No newline at end of file diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 7c7d987..5e7d715 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -8,6 +8,9 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; class Application extends App implements IBootstrap { @@ -18,8 +21,23 @@ class Application extends App implements IBootstrap { } public function register(IRegistrationContext $context): void { + $context->registerEventListener( + TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS, + LoadScriptsListener::class + ); } public function boot(IBootContext $context): void { } +} + +class LoadScriptsListener implements IEventListener { + + public function handle(Event $event): void { + if (!$event instanceof TemplateResponse) { + return; + } + + $event->addScript('minimalprofile'); + } } \ No newline at end of file