|
18 | 18 | use OCA\Encryption\Session; |
19 | 19 | use OCA\Encryption\Users\Setup; |
20 | 20 | use OCA\Encryption\Util; |
| 21 | +use OCP\AppFramework\App; |
| 22 | +use OCP\AppFramework\Bootstrap\IBootContext; |
| 23 | +use OCP\AppFramework\Bootstrap\IBootstrap; |
| 24 | +use OCP\AppFramework\Bootstrap\IRegistrationContext; |
21 | 25 | use OCP\Encryption\IManager; |
22 | 26 | use OCP\IConfig; |
23 | 27 | use Psr\Log\LoggerInterface; |
24 | 28 |
|
25 | | -class Application extends \OCP\AppFramework\App { |
26 | | - /** |
27 | | - * @param array $urlParams |
28 | | - */ |
29 | | - public function __construct($urlParams = []) { |
30 | | - parent::__construct('encryption', $urlParams); |
| 29 | +class Application extends App implements IBootstrap { |
| 30 | + public const APP_ID = 'encryption'; |
| 31 | + |
| 32 | + public function __construct(array $urlParams = []) { |
| 33 | + parent::__construct(self::APP_ID, $urlParams); |
| 34 | + } |
| 35 | + |
| 36 | + public function register(IRegistrationContext $context): void { |
| 37 | + } |
| 38 | + |
| 39 | + public function boot(IBootContext $context): void { |
| 40 | + \OCP\Util::addScript(self::APP_ID, 'encryption'); |
| 41 | + |
| 42 | + $context->injectFn(function (IManager $encryptionManager) use ($context) { |
| 43 | + if (!($encryptionManager instanceof \OC\Encryption\Manager)) { |
| 44 | + return; |
| 45 | + } |
| 46 | + |
| 47 | + if (!$encryptionManager->isReady()) { |
| 48 | + return; |
| 49 | + } |
| 50 | + |
| 51 | + $context->injectFn($this->registerEncryptionModule(...)); |
| 52 | + $context->injectFn($this->registerHooks(...)); |
| 53 | + $context->injectFn($this->setUp(...)); |
| 54 | + }); |
31 | 55 | } |
32 | 56 |
|
33 | 57 | public function setUp(IManager $encryptionManager) { |
|
0 commit comments