|
1 | 1 | <?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
2 | 4 | /** |
3 | 5 | * @copyright Copyright (c) 2018, Roeland Jago Douma <[email protected]> |
4 | 6 | * |
|
26 | 28 | use OCA\Richdocuments\Service\CapabilitiesService; |
27 | 29 | use OCP\App\IAppManager; |
28 | 30 | use OCP\Capabilities\ICapability; |
29 | | -use OCP\IL10N; |
30 | 31 | use OCP\IURLGenerator; |
31 | 32 |
|
32 | 33 | class Capabilities implements ICapability { |
@@ -66,7 +67,7 @@ class Capabilities implements ICapability { |
66 | 67 | 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', |
67 | 68 | 'application/vnd.ms-powerpoint.template.macroEnabled.12', |
68 | 69 | 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', |
69 | | - 'text/csv' |
| 70 | + 'text/csv', |
70 | 71 | ]; |
71 | 72 |
|
72 | 73 | public const MIMETYPES_OPTIONAL = [ |
@@ -95,24 +96,16 @@ class Capabilities implements ICapability { |
95 | 96 | 'application/pdf', |
96 | 97 | ]; |
97 | 98 |
|
98 | | - private IL10N $l10n; |
99 | | - private AppConfig $config; |
100 | | - private CapabilitiesService $capabilitiesService; |
101 | | - private PermissionManager $permissionManager; |
102 | | - private IURLGenerator $urlGenerator; |
103 | | - private IAppManager $appManager; |
104 | | - private ?string $userId = null; |
105 | | - |
106 | | - private $capabilities = null; |
| 99 | + private ?array $capabilities = null; |
107 | 100 |
|
108 | | - public function __construct(IL10N $l10n, AppConfig $config, CapabilitiesService $capabilitiesService, PermissionManager $permissionManager, IAppManager $appManager, ?string $userId, IURLGenerator $urlGenerator) { |
109 | | - $this->l10n = $l10n; |
110 | | - $this->config = $config; |
111 | | - $this->capabilitiesService = $capabilitiesService; |
112 | | - $this->permissionManager = $permissionManager; |
113 | | - $this->appManager = $appManager; |
114 | | - $this->userId = $userId; |
115 | | - $this->urlGenerator = $urlGenerator; |
| 101 | + public function __construct( |
| 102 | + private AppConfig $config, |
| 103 | + private CapabilitiesService $capabilitiesService, |
| 104 | + private PermissionManager $permissionManager, |
| 105 | + private IAppManager $appManager, |
| 106 | + private ?string $userId, |
| 107 | + private IURLGenerator $urlGenerator |
| 108 | + ) { |
116 | 109 | } |
117 | 110 |
|
118 | 111 | public function getCapabilities() { |
@@ -140,13 +133,13 @@ public function getCapabilities() { |
140 | 133 |
|
141 | 134 | $this->capabilities = [ |
142 | 135 | 'richdocuments' => [ |
143 | | - 'version' => \OC::$server->getAppManager()->getAppVersion('richdocuments'), |
| 136 | + 'version' => $this->appManager->getAppVersion('richdocuments'), |
144 | 137 | 'mimetypes' => array_values($filteredMimetypes), |
145 | 138 | 'mimetypesNoDefaultOpen' => array_values($optionalMimetypes), |
146 | 139 | 'mimetypesSecureView' => $this->config->useSecureViewAdditionalMimes() ? self::SECURE_VIEW_ADDITIONAL_MIMES : [], |
147 | 140 | 'collabora' => $collaboraCapabilities, |
148 | | - 'direct_editing' => isset($collaboraCapabilities['hasMobileSupport']) ?: false, |
149 | | - 'templates' => isset($collaboraCapabilities['hasTemplateSaveAs']) || isset($collaboraCapabilities['hasTemplateSource']) ?: false, |
| 141 | + 'direct_editing' => $collaboraCapabilities['hasMobileSupport'] ?? false, |
| 142 | + 'templates' => ($collaboraCapabilities['hasTemplateSaveAs'] ?? false) || ($collaboraCapabilities['hasTemplateSource'] ?? false), |
150 | 143 | 'productName' => $this->capabilitiesService->getProductName(), |
151 | 144 | 'editonline_endpoint' => $this->urlGenerator->linkToRouteAbsolute('richdocuments.document.editOnline'), |
152 | 145 | 'config' => [ |
|
0 commit comments