summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/ProviderFactory.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Share20/ProviderFactory.php')
-rw-r--r--lib/private/Share20/ProviderFactory.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php
index 0aacca409d1..6cb6c082df5 100644
--- a/lib/private/Share20/ProviderFactory.php
+++ b/lib/private/Share20/ProviderFactory.php
@@ -60,6 +60,8 @@ class ProviderFactory implements IProviderFactory {
private $shareByCircleProvider = null;
/** @var bool */
private $circlesAreNotAvailable = false;
+ /** @var \OCA\Spreed\Share\RoomShareProvider */
+ private $roomShareProvider = null;
/**
* IProviderFactory constructor.
@@ -221,6 +223,30 @@ class ProviderFactory implements IProviderFactory {
return $this->shareByCircleProvider;
}
+ /**
+ * Create the room share provider
+ *
+ * @return RoomShareProvider
+ */
+ protected function getRoomShareProvider() {
+ if ($this->roomShareProvider === null) {
+ /*
+ * Check if the app is enabled
+ */
+ $appManager = $this->serverContainer->getAppManager();
+ if (!$appManager->isEnabledForUser('spreed')) {
+ return null;
+ }
+
+ try {
+ $this->roomShareProvider = $this->serverContainer->query('\OCA\Spreed\Share\RoomShareProvider');
+ } catch (\OCP\AppFramework\QueryException $e) {
+ return null;
+ }
+ }
+
+ return $this->roomShareProvider;
+ }
/**
* @inheritdoc
@@ -235,6 +261,8 @@ class ProviderFactory implements IProviderFactory {
$provider = $this->getShareByMailProvider();
} else if ($id === 'ocCircleShare') {
$provider = $this->getShareByCircleProvider();
+ } else if ($id === 'ocRoomShare') {
+ $provider = $this->getRoomShareProvider();
}
if ($provider === null) {
@@ -261,6 +289,8 @@ class ProviderFactory implements IProviderFactory {
$provider = $this->getShareByMailProvider();
} else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
$provider = $this->getShareByCircleProvider();
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_ROOM) {
+ $provider = $this->getRoomShareProvider();
}
@@ -281,6 +311,10 @@ class ProviderFactory implements IProviderFactory {
if ($shareByCircle !== null) {
$shares[] = $shareByCircle;
}
+ $roomShare = $this->getRoomShareProvider();
+ if ($roomShare !== null) {
+ $shares[] = $roomShare;
+ }
return $shares;
}