mirror of https://github.com/nextcloud/bookmarks
34 lines
838 B
PHP
34 lines
838 B
PHP
<?php
|
|
/*
|
|
* Copyright (c) 2022. The Nextcloud Bookmarks contributors.
|
|
*
|
|
* This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
|
|
*/
|
|
|
|
namespace OCA\Bookmarks\Hooks;
|
|
|
|
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
|
|
use OCP\EventDispatcher\Event;
|
|
use OCP\EventDispatcher\IEventListener;
|
|
use OCP\IRequest;
|
|
use OCP\Util;
|
|
|
|
class BeforeTemplateRenderedListener implements IEventListener {
|
|
private $request;
|
|
public function __construct(IRequest $request) {
|
|
$this->request = $request;
|
|
}
|
|
public function handle(Event $event): void {
|
|
if (!($event instanceof BeforeTemplateRenderedEvent)) {
|
|
return;
|
|
}
|
|
if (!$event->isLoggedIn()) {
|
|
return;
|
|
}
|
|
|
|
if (strpos($this->request->getPathInfo(), '/call/') === 0) {
|
|
Util::addScript('bookmarks', 'bookmarks-talk');
|
|
}
|
|
}
|
|
}
|