2018-09-20 07:42:52 +00:00
|
|
|
<?php
|
2022-04-15 11:34:01 +00:00
|
|
|
|
2018-09-20 07:42:52 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Nextcloud - Social Support
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later. See the COPYING file.
|
|
|
|
*
|
|
|
|
* @author Maxence Lange <maxence@artificial-owl.com>
|
|
|
|
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
|
|
|
* @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/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-11-12 22:59:01 +00:00
|
|
|
|
2018-09-20 07:42:52 +00:00
|
|
|
namespace OCA\Social\AppInfo;
|
|
|
|
|
2023-04-11 15:26:11 +00:00
|
|
|
use OCA\Social\Dashboard\SocialWidget;
|
|
|
|
use OCA\Social\Listeners\DeprecatedListener;
|
|
|
|
use OCA\Social\Listeners\ProfileSectionListener;
|
2020-06-25 02:48:36 +00:00
|
|
|
use OCA\Social\Notification\Notifier;
|
2020-10-13 13:44:07 +00:00
|
|
|
use OCA\Social\Search\UnifiedSearchProvider;
|
2022-04-14 19:38:02 +00:00
|
|
|
use OCA\Social\WellKnown\WebfingerHandler;
|
2018-09-20 07:42:52 +00:00
|
|
|
use OCP\AppFramework\App;
|
2020-09-24 12:32:55 +00:00
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
2023-04-11 15:26:11 +00:00
|
|
|
use OCP\IUser;
|
2022-09-13 13:51:00 +00:00
|
|
|
use OCP\Profile\BeforeTemplateRenderedEvent;
|
2023-04-11 15:26:11 +00:00
|
|
|
use Symfony\Component\EventDispatcher\GenericEvent;
|
2018-09-20 07:42:52 +00:00
|
|
|
|
2020-10-09 13:07:32 +00:00
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
2018-11-12 22:59:01 +00:00
|
|
|
|
2020-06-25 02:48:36 +00:00
|
|
|
/**
|
|
|
|
* Class Application
|
|
|
|
*
|
|
|
|
* @package OCA\Social\AppInfo
|
|
|
|
*/
|
2020-09-24 12:32:55 +00:00
|
|
|
class Application extends App implements IBootstrap {
|
2022-04-15 11:34:01 +00:00
|
|
|
public const APP_NAME = 'social';
|
2018-09-20 07:42:52 +00:00
|
|
|
|
|
|
|
public function __construct(array $params = []) {
|
|
|
|
parent::__construct(self::APP_NAME, $params);
|
2020-09-24 12:32:55 +00:00
|
|
|
}
|
2020-06-25 02:48:36 +00:00
|
|
|
|
2020-09-24 12:32:55 +00:00
|
|
|
public function register(IRegistrationContext $context): void {
|
2020-10-13 13:44:07 +00:00
|
|
|
$context->registerSearchProvider(UnifiedSearchProvider::class);
|
2022-04-14 19:38:02 +00:00
|
|
|
$context->registerWellKnownHandler(WebfingerHandler::class);
|
2022-09-13 13:51:00 +00:00
|
|
|
$context->registerEventListener(BeforeTemplateRenderedEvent::class, ProfileSectionListener::class);
|
2023-04-06 15:41:25 +00:00
|
|
|
$context->registerDashboardWidget(SocialWidget::class);
|
2023-04-11 15:26:11 +00:00
|
|
|
|
|
|
|
$this->registerDeprecatedListener();
|
2020-06-25 02:48:36 +00:00
|
|
|
}
|
|
|
|
|
2020-09-24 12:32:55 +00:00
|
|
|
public function boot(IBootContext $context): void {
|
|
|
|
$manager = $context->getServerContainer()
|
|
|
|
->getNotificationManager();
|
|
|
|
$manager->registerNotifierService(Notifier::class);
|
2018-09-20 07:42:52 +00:00
|
|
|
}
|
2023-04-11 15:26:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
public function registerDeprecatedListener(): void {
|
|
|
|
$dispatcher = \OC::$server->getEventDispatcher();
|
|
|
|
$dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) {
|
|
|
|
/** @var IUser $user */
|
|
|
|
$user = $event->getSubject();
|
|
|
|
/** @var DeprecatedListener $deprecatedListener */
|
|
|
|
$deprecatedListener = \OC::$server->get(DeprecatedListener::class);
|
|
|
|
$deprecatedListener->userAccountUpdated($user);
|
|
|
|
});
|
|
|
|
}
|
2018-09-20 07:42:52 +00:00
|
|
|
}
|