Skip to content

Commit

Permalink
refactor(encryption): Migrate app.php to Application.php
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Jul 1, 2024
1 parent beececf commit 39fd19f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
21 changes: 0 additions & 21 deletions apps/encryption/appinfo/app.php

This file was deleted.

36 changes: 30 additions & 6 deletions apps/encryption/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,40 @@
use OCA\Encryption\Session;
use OCA\Encryption\Users\Setup;
use OCA\Encryption\Util;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Encryption\IManager;
use OCP\IConfig;
use Psr\Log\LoggerInterface;

class Application extends \OCP\AppFramework\App {
/**
* @param array $urlParams
*/
public function __construct($urlParams = []) {
parent::__construct('encryption', $urlParams);
class Application extends App implements IBootstrap {
public const APP_ID = 'encryption';

public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
}

public function register(IRegistrationContext $context): void {
}

public function boot(IBootContext $context): void {
\OCP\Util::addScript(self::APP_ID, 'encryption');

$context->injectFn(function (IManager $encryptionManager) use ($context) {
if (!($encryptionManager instanceof \OC\Encryption\Manager)) {
return;
}

if (!$encryptionManager->isReady()) {
return;
}

$context->injectFn($this->registerEncryptionModule(...));
$context->injectFn($this->registerHooks(...));
$context->injectFn($this->setUp(...));
});
}

public function setUp(IManager $encryptionManager) {
Expand Down

0 comments on commit 39fd19f

Please sign in to comment.