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