Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\DirectEditing\RegisterDirectEditorEvent;
use OCP\EventDispatcher\Event;

class Application extends App implements IBootstrap {
const APP_NAME = 'text';
Expand All @@ -46,11 +47,16 @@ public function __construct(array $params = []) {
public function register(IRegistrationContext $context): void {
$context->registerEventListener(RegisterDirectEditorEvent::class, RegisterDirectEditorEventListener::class);
$context->registerEventListener(LoadViewer::class, LoadViewerListener::class);
$context->registerEventListener('OCA\Files_Sharing::loadAdditionalScripts', FilesSharingLoadAdditionalScriptsListener::class);
$context->registerEventListener(LoadAdditionalScriptsEvent::class, FilesLoadAdditionalScriptsListener::class);
}

public function boot(IBootContext $context): void {
// TODO migrate this to the new IEventDispatcher
$container = $context->getAppContainer();
$context->getServerContainer()->getEventDispatcher()->addListener('OCA\Files_Sharing::loadAdditionalScripts', function() use ($container) {
$listener = $container->query(FilesSharingLoadAdditionalScriptsListener::class);
$listener->handle(new Event());
});
}
}

3 changes: 0 additions & 3 deletions lib/Listeners/FilesSharingLoadAdditionalScriptsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ public function __construct(IConfig $config, IInitialStateService $initialStateS
}

public function handle(Event $event): void {
if (!$this->userSession->isLoggedIn()) {
return;
}
\OCP\Util::addScript('text', 'public');
\OCP\Util::addStyle('text', 'icons');

Expand Down