diff options
Diffstat (limited to 'lib/public/Activity')
-rw-r--r-- | lib/public/Activity/IExtension.php | 4 | ||||
-rw-r--r-- | lib/public/Activity/IFilter.php | 74 | ||||
-rw-r--r-- | lib/public/Activity/IManager.php | 67 |
3 files changed, 124 insertions, 21 deletions
diff --git a/lib/public/Activity/IExtension.php b/lib/public/Activity/IExtension.php index aaa4c869561..21d1bd150ac 100644 --- a/lib/public/Activity/IExtension.php +++ b/lib/public/Activity/IExtension.php @@ -129,6 +129,7 @@ interface IExtension { * * @return array|false * @since 8.0.0 + * @deprecated 9.2.0 - Register an IFilter instead */ public function getNavigation(); @@ -138,6 +139,7 @@ interface IExtension { * @param string $filterValue * @return boolean * @since 8.0.0 + * @deprecated 9.2.0 - Register an IFilter instead */ public function isFilterValid($filterValue); @@ -149,6 +151,7 @@ interface IExtension { * @param string $filter * @return array|false * @since 8.0.0 + * @deprecated 9.2.0 - Register an IFilter instead */ public function filterNotificationTypes($types, $filter); @@ -161,6 +164,7 @@ interface IExtension { * @param string $filter * @return array|false * @since 8.0.0 + * @deprecated 9.2.0 - Register an IFilter instead */ public function getQueryForFilter($filter); } diff --git a/lib/public/Activity/IFilter.php b/lib/public/Activity/IFilter.php new file mode 100644 index 00000000000..f3c57c14e97 --- /dev/null +++ b/lib/public/Activity/IFilter.php @@ -0,0 +1,74 @@ +<?php +/** + * @copyright Copyright (c) 2016, ownCloud, Inc. + * + * @author Joas Schilling <coding@schilljs.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP\Activity; + +/** + * Interface IFilter + * + * @package OCP\Activity + * @since 9.2.0 + */ +interface IFilter { + + /** + * @return string Lowercase a-z and underscore only identifier + * @since 9.2.0 + */ + public function getIdentifier(); + + /** + * @return string A translated string + * @since 9.2.0 + */ + public function getName(); + + /** + * @return int whether the filter should be rather on the top or bottom of + * the admin section. The filters are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * @since 9.2.0 + */ + public function getPriority(); + + /** + * @return string Full URL to an icon, empty string when none is given + * @since 9.2.0 + */ + public function getIcon(); + + /** + * @param string[] $types + * @return string[] An array of allowed apps from which activities should be displayed + * @since 9.2.0 + */ + public function filterTypes(array $types); + + /** + * @return string[] An array of allowed apps from which activities should be displayed + * @since 9.2.0 + */ + public function allowedApps(); +} + diff --git a/lib/public/Activity/IManager.php b/lib/public/Activity/IManager.php index c1476e1a2ae..387a1d85144 100644 --- a/lib/public/Activity/IManager.php +++ b/lib/public/Activity/IManager.php @@ -111,6 +111,27 @@ interface IManager { public function registerExtension(\Closure $callable); /** + * @param string $filter Class must implement OCA\Activity\IFilter + * @return void + * @since 9.2.0 + */ + public function registerFilter($filter); + + /** + * @return IFilter[] + * @since 9.2.0 + */ + public function getFilters(); + + /** + * @param string $id + * @return IFilter + * @throws \InvalidArgumentException when the filter was not found + * @since 9.2.0 + */ + public function getFilterById($id); + + /** * Will return additional notification types as specified by other apps * * @param string $languageCode @@ -177,9 +198,31 @@ interface IManager { */ public function getGroupParameter($activity); + + /** + * Set the user we need to use + * + * @param string|null $currentUserId + * @throws \UnexpectedValueException If the user is invalid + * @since 9.0.1 + */ + public function setCurrentUserId($currentUserId); + + /** + * Get the user we need to use + * + * Either the user is logged in, or we try to get it from the token + * + * @return string + * @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique + * @since 8.1.0 + */ + public function getCurrentUserId(); + /** * @return array * @since 8.0.0 + * @deprecated 9.2.0 - Use getFilters() instead */ public function getNavigation(); @@ -187,6 +230,7 @@ interface IManager { * @param string $filterValue * @return boolean * @since 8.0.0 + * @deprecated 9.2.0 - Use getFilterById() instead */ public function isFilterValid($filterValue); @@ -195,6 +239,7 @@ interface IManager { * @param string $filter * @return array * @since 8.0.0 + * @deprecated 9.2.0 - Use getFilterById()->filterTypes() instead */ public function filterNotificationTypes($types, $filter); @@ -202,27 +247,7 @@ interface IManager { * @param string $filter * @return array * @since 8.0.0 + * @deprecated 9.2.0 - Use getFilterById() instead */ public function getQueryForFilter($filter); - - - /** - * Set the user we need to use - * - * @param string|null $currentUserId - * @throws \UnexpectedValueException If the user is invalid - * @since 9.0.1 - */ - public function setCurrentUserId($currentUserId); - - /** - * Get the user we need to use - * - * Either the user is logged in, or we try to get it from the token - * - * @return string - * @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique - * @since 8.1.0 - */ - public function getCurrentUserId(); } |