use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as ResourcesLoadAdditionalScriptsEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudIdManager;
use OCP\Files\Config\IMountProviderCollection;
$dispatcher->addServiceListener(BeforeTemplateRenderedEvent::class, LegacyBeforeTemplateRenderedListener::class);
$dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
$dispatcher->addServiceListener(ShareCreatedEvent::class, ShareInteractionListener::class);
- $dispatcher->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () {
- \OCP\Util::addScript('files_sharing', 'collaboration');
- });
$dispatcher->addServiceListener(ShareCreatedEvent::class, UserShareAcceptanceListener::class);
$dispatcher->addServiceListener(UserAddedEvent::class, UserAddedToGroupListener::class);
+ $dispatcher->addListener(ResourcesLoadAdditionalScriptsEvent::class, function () {
+ \OCP\Util::addScript('files_sharing', 'collaboration');
+ });
// notifications api to accept incoming user shares
$oldDispatcher->addListener('OCP\Share::postShare', function (GenericEvent $event) {
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
use OCA\Viewer\Event\LoadViewer;
-use OCP\EventDispatcher\GenericEvent;
+use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as ResourcesLoadAdditionalScriptsEvent;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IConfig;
+use OCP\IUserSession;
+use OCP\Server;
-$config = \OC::$server->getConfig();
-$userSession = \OC::$server->getUserSession();
-$legacyEventDispatcher = \OC::$server->getEventDispatcher();
-/** @var \OCP\EventDispatcher\IEventDispatcher $eventDispatcher */
-$eventDispatcher = \OC::$server->get(OCP\EventDispatcher\IEventDispatcher::class);
+$config = Server::get(IConfig::class);
+$userSession = Server::get(IUserSession::class);
+$eventDispatcher = Server::get(IEventDispatcher::class);
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', false);
$tmpl->assign('showgridview', $showgridview);
// fire script events
-$legacyEventDispatcher->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts', new GenericEvent());
+$eventDispatcher->dispatchTyped(new ResourcesLoadAdditionalScriptsEvent());
$eventDispatcher->dispatchTyped(new LoadAdditionalScriptsEvent());
$eventDispatcher->dispatchTyped(new LoadSidebar());