. * */ namespace OCA\Talk\PublicShareAuth; use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent; use OCA\Talk\Config; use OCA\Talk\TInitialState; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IInitialStateService; use OCP\Util; /** * Helper class to extend the "publicshareauth" template from the server. * * The additional scripts modify the page in the browser to inject the Talk UI as needed. */ class TemplateLoader implements IEventListener { use TInitialState; public function __construct(IInitialStateService $initialStateService, ICacheFactory $memcacheFactory, Config $talkConfig, IConfig $serverConfig) { $this->initialStateService = $initialStateService; $this->talkConfig = $talkConfig; $this->memcacheFactory = $memcacheFactory; $this->serverConfig = $serverConfig; } /** * Load the "Video verification" UI in the public share auth page. * @param Event $event */ public function handle(Event $event): void { if (!$event instanceof BeforeTemplateRenderedEvent) { return; } if ($event->getScope() !== BeforeTemplateRenderedEvent::SCOPE_PUBLIC_SHARE_AUTH) { // If the scope is not the authentication page we don't load this part of the Talk UI return; } Util::addStyle('spreed', 'merged-share-auth'); Util::addScript('spreed', 'talk-public-share-auth-sidebar'); $this->publishInitialStateForGuest(); } }