-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Arthur Schiwon <[email protected]>
- Loading branch information
Showing
4 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) 2020 Arthur Schiwon <[email protected]> | ||
* @copyright Copyright (c) 2024 Arthur Schiwon <[email protected]> | ||
* | ||
* @author Arthur Schiwon <[email protected]> | ||
* | ||
|
@@ -25,15 +25,12 @@ | |
|
||
namespace OCA\FlowNotifications\AppInfo; | ||
|
||
use OCA\FlowNotifications\Flow\Operation; | ||
use OCA\FlowNotifications\Listener\RegisterOperationsListener; | ||
use OCA\FlowNotifications\Notification\Notifier; | ||
use OCP\AppFramework\App; | ||
use OCP\AppFramework\Bootstrap\IBootContext; | ||
use OCP\AppFramework\Bootstrap\IBootstrap; | ||
use OCP\AppFramework\Bootstrap\IRegistrationContext; | ||
use OCP\EventDispatcher\IEventDispatcher; | ||
use OCP\Notification\IManager; | ||
use OCP\Util; | ||
use OCP\WorkflowEngine\Events\RegisterOperationsEvent; | ||
|
||
class Application extends App implements IBootstrap { | ||
|
@@ -44,19 +41,10 @@ public function __construct() { | |
} | ||
|
||
public function register(IRegistrationContext $context): void { | ||
$context->registerNotifierService(Notifier::class); | ||
$context->registerEventListener(RegisterOperationsEvent::class, RegisterOperationsListener::class); | ||
} | ||
|
||
public function boot(IBootContext $context): void { | ||
$container = $context->getServerContainer(); | ||
$container->get(IManager::class)->registerNotifierService(Notifier::class); | ||
|
||
$dispatcher = $container->get(IEventDispatcher::class); | ||
$dispatcher->addListener(RegisterOperationsEvent::class, | ||
function (RegisterOperationsEvent $event) use ($container) { | ||
$operation = $container->get(Operation::class); | ||
$event->registerOperation($operation); | ||
Util::addScript(self::APP_ID, 'flow_notifications-main'); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) 2020 Arthur Schiwon <[email protected]> | ||
* @copyright Copyright (c) 2024 Arthur Schiwon <[email protected]> | ||
* | ||
* @author Arthur Schiwon <[email protected]> | ||
* | ||
|
@@ -45,11 +45,11 @@ | |
|
||
class Operation implements IOperation { | ||
public function __construct( | ||
private IL10N $l, | ||
private IURLGenerator $urlGenerator, | ||
private IManager $notificationManager, | ||
private IUserSession $userSession, | ||
private LoggerInterface $logger, | ||
private readonly IL10N $l, | ||
private readonly IURLGenerator $urlGenerator, | ||
private readonly IManager $notificationManager, | ||
private readonly IUserSession $userSession, | ||
private readonly LoggerInterface $logger, | ||
) { | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) 2024 Arthur Schiwon <[email protected]> | ||
* | ||
* @author Arthur Schiwon <[email protected]> | ||
* | ||
* @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 OCA\FlowNotifications\Listener; | ||
|
||
use OCA\FlowNotifications\AppInfo\Application; | ||
use OCA\FlowNotifications\Flow\Operation; | ||
use OCP\EventDispatcher\Event; | ||
use OCP\EventDispatcher\IEventListener; | ||
use OCP\Util; | ||
use OCP\WorkflowEngine\Events\RegisterOperationsEvent; | ||
|
||
class RegisterOperationsListener implements IEventListener { | ||
Check failure on line 35 in lib/Listener/RegisterOperationsListener.php
|
||
public function __construct( | ||
protected readonly Operation $operation | ||
) { | ||
} | ||
|
||
public function handle(Event $event): void { | ||
if (!$event instanceof RegisterOperationsEvent) { | ||
return; | ||
} | ||
|
||
$event->registerOperation($this->operation); | ||
Util::addScript(Application::APP_ID, 'flow_notifications-main'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) 2020 Arthur Schiwon <[email protected]> | ||
* @copyright Copyright (c) 2024 Arthur Schiwon <[email protected]> | ||
* | ||
* @author Arthur Schiwon <[email protected]> | ||
* | ||
|
@@ -41,9 +41,9 @@ | |
class Notifier implements INotifier { | ||
|
||
public function __construct( | ||
private IL10N $l, | ||
private IURLGenerator $urlGenerator, | ||
private ContainerInterface $container, | ||
private readonly IL10N $l, | ||
private readonly IURLGenerator $urlGenerator, | ||
private readonly ContainerInterface $container, | ||
) { | ||
} | ||
|
||
|