summaryrefslogtreecommitdiffstats
path: root/apps/files_reminders/lib
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2023-08-02 19:15:00 -0700
committerAndy Scherzinger <info@andy-scherzinger.de>2023-08-10 12:28:19 +0200
commit840ec3603c723bef87078bb04539445937023476 (patch)
treeff9b2be11dde12ad669dd1c2eb783275bbe6cc63 /apps/files_reminders/lib
parentd97a58dde6c3b2372628fe545807f1c464d9875c (diff)
downloadnextcloud-server-840ec3603c723bef87078bb04539445937023476.tar.gz
nextcloud-server-840ec3603c723bef87078bb04539445937023476.zip
feat(files_reminders): integrate load scripts
Signed-off-by: Christopher Ng <chrng8@gmail.com> (cherry picked from commit dec011180ada5a319733f7c94e7e3a8643bc6024)
Diffstat (limited to 'apps/files_reminders/lib')
-rw-r--r--apps/files_reminders/lib/AppInfo/Application.php4
-rw-r--r--apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php43
2 files changed, 47 insertions, 0 deletions
diff --git a/apps/files_reminders/lib/AppInfo/Application.php b/apps/files_reminders/lib/AppInfo/Application.php
index d35bd5c5de2..56b0c97a7a2 100644
--- a/apps/files_reminders/lib/AppInfo/Application.php
+++ b/apps/files_reminders/lib/AppInfo/Application.php
@@ -26,6 +26,8 @@ declare(strict_types=1);
namespace OCA\FilesReminders\AppInfo;
+use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\FilesReminders\Listener\LoadAdditionalScriptsListener;
use OCA\FilesReminders\Listener\NodeDeletedListener;
use OCA\FilesReminders\Listener\UserDeletedListener;
use OCA\FilesReminders\Notification\Notifier;
@@ -51,5 +53,7 @@ class Application extends App implements IBootstrap {
$context->registerEventListener(NodeDeletedEvent::class, NodeDeletedListener::class);
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
+
+ $context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
}
}
diff --git a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php
new file mode 100644
index 00000000000..9eadc518851
--- /dev/null
+++ b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php
@@ -0,0 +1,43 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2023 Christopher Ng <chrng8@gmail.com>
+ *
+ * @author Christopher Ng <chrng8@gmail.com>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\FilesReminders\Listener;
+
+use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\FilesReminders\AppInfo\Application;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventListener;
+use OCP\Util;
+
+class LoadAdditionalScriptsListener implements IEventListener {
+ public function handle(Event $event): void {
+ if (!($event instanceof LoadAdditionalScriptsEvent)) {
+ return;
+ }
+
+ Util::addScript(Application::APP_ID, 'main');
+ }
+}