Skip to content

Commit

Permalink
Merge pull request #1103 from nextcloud/fix/deprecations
Browse files Browse the repository at this point in the history
fix: Replace deprecated code
  • Loading branch information
susnux authored Feb 27, 2024
2 parents 72ab5b5 + bfe39f2 commit 6a4b368
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
11 changes: 6 additions & 5 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Joas Schilling <coding@schilljs.com>
*
* @license GNU AGPL version 3 or any later version
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -26,7 +26,7 @@
use OCA\FirstRunWizard\Listener\AppEnabledListener;
use OCA\FirstRunWizard\Listener\BeforeTemplateRenderedListener;
use OCA\FirstRunWizard\Notification\Notifier;
use OCP\App\ManagerEvent;
use OCP\App\Events\AppEnableEvent;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand All @@ -41,12 +41,13 @@ public function __construct() {
}

public function register(IRegistrationContext $context): void {
$context->registerEventListener(ManagerEvent::EVENT_APP_ENABLE, AppEnabledListener::class);
$context->registerNotifierService(Notifier::class);

$context->registerEventListener(AppEnableEvent::class, AppEnabledListener::class);
$context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedListener::class);
}

public function boot(IBootContext $context): void {
$serverContainer = $context->getServerContainer();
$serverContainer->getNotificationManager()->registerNotifierService(Notifier::class);
// Everything is already done in register()
}
}
14 changes: 7 additions & 7 deletions lib/Listener/AppEnabledListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @author Morris Jobke <hey@morrisjobke.de>
*
* @license GNU AGPL version 3 or any later version
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -27,20 +27,20 @@
namespace OCA\FirstRunWizard\Listener;

use OCA\FirstRunWizard\Notification\AppHint;
use OCP\App\ManagerEvent;
use OCP\App\Events\AppEnableEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;

/** @template-implements IEventListener<AppEnableEvent> */
class AppEnabledListener implements IEventListener {
/** @var AppHint */
private $appHint;

public function __construct(AppHint $appHint) {
$this->appHint = $appHint;
public function __construct(
private AppHint $appHint,
) {
}

public function handle(Event $event): void {
if (!$event instanceof ManagerEvent) {
if (!$event instanceof AppEnableEvent) {
return;
}

Expand Down

0 comments on commit 6a4b368

Please sign in to comment.