summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-12-09 13:19:45 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-12-10 10:02:24 +0100
commit2b581814f334b7a79ef5e7a9fb31fc421c60a57c (patch)
tree7ff23c680541f1a9416457b1daaedae3b1aac3f8 /lib/public
parent3e720942e58f99b038616d95e00a01ac9dd2f490 (diff)
downloadnextcloud-server-2b581814f334b7a79ef5e7a9fb31fc421c60a57c.tar.gz
nextcloud-server-2b581814f334b7a79ef5e7a9fb31fc421c60a57c.zip
Add interface for notification handler for dimissed events
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Notification/IDismissableNotifier.php45
-rw-r--r--lib/public/Notification/IManager.php5
2 files changed, 50 insertions, 0 deletions
diff --git a/lib/public/Notification/IDismissableNotifier.php b/lib/public/Notification/IDismissableNotifier.php
new file mode 100644
index 00000000000..61088fc72e0
--- /dev/null
+++ b/lib/public/Notification/IDismissableNotifier.php
@@ -0,0 +1,45 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Notification;
+
+/**
+ * Interface INotifier classes should implement if they want to process notifications
+ * that are dismissed by the user.
+ *
+ * This can be useful if dismissing the notification will leave it in an incomplete
+ * state. The handler can chose to for example do some default action.
+ *
+ * @since 18.0.0
+ */
+interface IDismissableNotifier extends INotifier {
+
+ /**
+ * @param INotification $notification
+ * @throws \InvalidArgumentException In case the handler can't handle the notification
+ *
+ * @since 18.0.0
+ */
+ public function dismissNotification(INotification $notification): void;
+}
diff --git a/lib/public/Notification/IManager.php b/lib/public/Notification/IManager.php
index c1c4d881619..2a9b8116a55 100644
--- a/lib/public/Notification/IManager.php
+++ b/lib/public/Notification/IManager.php
@@ -85,4 +85,9 @@ interface IManager extends IApp, INotifier {
* @since 14.0.0
*/
public function isPreparingPushNotification(): bool;
+
+ /**
+ * @since 18.0.0
+ */
+ public function dismissNotification(INotification $notification): void;
}