Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-11-29 20:29:25 +0300
committerJulius Härtl <jus@bitgrid.net>2021-11-29 20:33:50 +0300
commitc9cb1bd98224a53bd7db73c62ae4c81c6ea51f00 (patch)
tree45584b148522bd78a0fc1bd683376e2ab02b27cc /lib
parent6551749b8627b2da1eca3bd07947175f4cffadfb (diff)
Improve loading state handling
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php28
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 721e8031..0d6562e1 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -27,6 +27,7 @@ namespace OCA\Richdocuments\AppInfo;
use OC\EventDispatcher\SymfonyAdapter;
use OC\Files\Type\Detection;
use OC\Security\CSP\ContentSecurityPolicy;
+use OCA\Files_Sharing\Listener\LoadAdditionalListener;
use OCA\Richdocuments\AppConfig;
use OCA\Richdocuments\Capabilities;
use OCA\Richdocuments\Middleware\WOPIMiddleware;
@@ -38,6 +39,7 @@ use OCA\Richdocuments\Preview\OpenDocument;
use OCA\Richdocuments\Preview\Pdf;
use OCA\Richdocuments\Service\CapabilitiesService;
use OCA\Richdocuments\Service\FederationService;
+use OCA\Richdocuments\Service\InitialStateService;
use OCA\Richdocuments\Template\CollaboraTemplateProvider;
use OCA\Richdocuments\WOPI\DiscoveryManager;
use OCA\Viewer\Event\LoadViewer;
@@ -78,12 +80,6 @@ class Application extends App implements IBootstrap {
}
}
- /** @var IEventDispatcher $eventDispatcher */
- $eventDispatcher = $this->getContainer()->getServer()->query(IEventDispatcher::class);
- $eventDispatcher->addListener(LoadViewer::class, function () {
- \OCP\Util::addScript('richdocuments', 'richdocuments-viewer');
- });
-
$context->injectFn(function(ITemplateManager $templateManager, IL10N $l10n, IConfig $config, CapabilitiesService $capabilitiesService) {
if (empty($capabilitiesService->getCapabilities())) {
return;
@@ -142,17 +138,15 @@ class Application extends App implements IBootstrap {
});
});
- $context->injectFn(function (SymfonyAdapter $eventDispatcher) {
- $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts',
- function() {
- \OCP\Util::addScript('richdocuments', 'richdocuments-files');
- }
- );
- $eventDispatcher->addListener('OCA\Files_Sharing::loadAdditionalScripts',
- function() {
- \OCP\Util::addScript('richdocuments', 'richdocuments-files');
- }
- );
+ $context->injectFn(function (SymfonyAdapter $symfonyAdapter, IEventDispatcher $eventDispatcher, InitialStateService $initialStateService) {
+ $eventDispatcher->addListener(LoadViewer::class, function () use ($initialStateService) {
+ $initialStateService->provideCapabilities();
+ \OCP\Util::addScript('richdocuments', 'richdocuments-viewer');
+ });
+ $eventDispatcher->addListener('OCA\Files_Sharing::loadAdditionalScripts', function () use ($initialStateService) {
+ $initialStateService->provideCapabilities();
+ \OCP\Util::addScript('richdocuments', 'richdocuments-files');
+ });
if (class_exists('\OC\Files\Type\TemplateManager')) {
$manager = \OC_Helper::getFileTemplateManager();