2023-06-22 20:10:30 +02:00
|
|
|
<?php
|
2023-06-23 09:44:48 +02:00
|
|
|
|
2023-06-22 20:10:30 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\RePod\AppInfo;
|
|
|
|
|
2023-07-03 16:17:00 +02:00
|
|
|
use OCP\App\IAppManager;
|
2023-06-22 20:10:30 +02:00
|
|
|
use OCP\AppFramework\App;
|
2023-07-03 16:17:00 +02:00
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
|
|
|
use OCP\IUserSession;
|
2023-06-22 20:10:30 +02:00
|
|
|
|
2023-07-03 16:17:00 +02:00
|
|
|
class Application extends App implements IBootstrap
|
2023-06-24 18:37:25 +02:00
|
|
|
{
|
2023-06-22 20:10:30 +02:00
|
|
|
public const APP_ID = 'repod';
|
2023-07-03 16:17:00 +02:00
|
|
|
private const GPODDERSYNC_ID = 'gpoddersync';
|
2023-06-22 20:10:30 +02:00
|
|
|
|
|
|
|
public function __construct() {
|
|
|
|
parent::__construct(self::APP_ID);
|
|
|
|
}
|
2023-07-03 16:17:00 +02:00
|
|
|
|
|
|
|
public function boot(IBootContext $context): void {
|
|
|
|
/** @psalm-suppress DeprecatedInterface */
|
|
|
|
$appContainer = $context->getAppContainer();
|
|
|
|
/** @var IAppManager $appManager */
|
|
|
|
$appManager = $appContainer->get(IAppManager::class);
|
|
|
|
/** @var IUserSession $userSession */
|
|
|
|
$userSession = $appContainer->get(IUserSession::class);
|
|
|
|
|
|
|
|
$gpoddersync = $appManager->isEnabledForUser(self::GPODDERSYNC_ID, $userSession->getUser());
|
|
|
|
if (!$gpoddersync) {
|
|
|
|
$appManager->enableApp(self::GPODDERSYNC_ID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function register(IRegistrationContext $context): void {
|
|
|
|
}
|
2023-06-22 20:10:30 +02:00
|
|
|
}
|