| @@ -45,56 +45,56 @@ | ||
| 45 | 45 | |
| 46 | 46 |  class Application extends App implements IBootstrap { | 
| 47 | 47 | |
| 48 | - /** @var string */ | |
| 49 | - public const APP_ID = 'accessibility'; | |
| 48 | + /** @var string */ | |
| 49 | + public const APP_ID = 'accessibility'; | |
| 50 | 50 | |
| 51 | -	public function __construct() { | |
| 52 | - parent::__construct(self::APP_ID); | |
| 53 | - } | |
| 51 | +    public function __construct() { | |
| 52 | + parent::__construct(self::APP_ID); | |
| 53 | + } | |
| 54 | 54 | |
| 55 | -	public function register(IRegistrationContext $context): void { | |
| 56 | - } | |
| 55 | +    public function register(IRegistrationContext $context): void { | |
| 56 | + } | |
| 57 | 57 | |
| 58 | -	public function boot(IBootContext $context): void { | |
| 59 | - $this->injectCss( | |
| 60 | - $context->getAppContainer()->query(IUserSession::class), | |
| 61 | - $context->getAppContainer()->query(IConfig::class), | |
| 62 | - $context->getAppContainer()->query(IURLGenerator::class) | |
| 63 | - ); | |
| 58 | +    public function boot(IBootContext $context): void { | |
| 59 | + $this->injectCss( | |
| 60 | + $context->getAppContainer()->query(IUserSession::class), | |
| 61 | + $context->getAppContainer()->query(IConfig::class), | |
| 62 | + $context->getAppContainer()->query(IURLGenerator::class) | |
| 63 | + ); | |
| 64 | 64 | |
| 65 | - $this->registerInitialState($context->getAppContainer()); | |
| 66 | - } | |
| 65 | + $this->registerInitialState($context->getAppContainer()); | |
| 66 | + } | |
| 67 | 67 | |
| 68 | - private function injectCss(IUserSession $userSession, | |
| 69 | - IConfig $config, | |
| 70 | -							   IURLGenerator $urlGenerator) { | |
| 71 | - // Inject the fake css on all pages if enabled and user is logged | |
| 72 | - $loggedUser = $userSession->getUser(); | |
| 73 | -		if ($loggedUser !== null) { | |
| 74 | - $userValues = $config->getUserKeys($loggedUser->getUID(), self::APP_ID); | |
| 75 | - // we want to check if any theme or font is enabled. | |
| 76 | -			if (count($userValues) > 0) { | |
| 77 | -				$hash = $config->getUserValue($loggedUser->getUID(), self::APP_ID, 'icons-css', md5(implode('-', $userValues))); | |
| 78 | - $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]); | |
| 79 | -				\OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'href' => $linkToCSS]); | |
| 80 | - } | |
| 81 | -		} else { | |
| 82 | - $userValues = ['dark']; | |
| 68 | + private function injectCss(IUserSession $userSession, | |
| 69 | + IConfig $config, | |
| 70 | +                                IURLGenerator $urlGenerator) { | |
| 71 | + // Inject the fake css on all pages if enabled and user is logged | |
| 72 | + $loggedUser = $userSession->getUser(); | |
| 73 | +        if ($loggedUser !== null) { | |
| 74 | + $userValues = $config->getUserKeys($loggedUser->getUID(), self::APP_ID); | |
| 75 | + // we want to check if any theme or font is enabled. | |
| 76 | +            if (count($userValues) > 0) { | |
| 77 | +                $hash = $config->getUserValue($loggedUser->getUID(), self::APP_ID, 'icons-css', md5(implode('-', $userValues))); | |
| 78 | + $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]); | |
| 79 | +                \OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'href' => $linkToCSS]); | |
| 80 | + } | |
| 81 | +        } else { | |
| 82 | + $userValues = ['dark']; | |
| 83 | 83 | |
| 84 | -			$hash = md5(implode('-', $userValues)); | |
| 85 | - $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]); | |
| 86 | -			\OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'media' => '(prefers-color-scheme: dark)', 'href' => $linkToCSS]); | |
| 87 | - } | |
| 88 | - } | |
| 84 | +            $hash = md5(implode('-', $userValues)); | |
| 85 | + $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]); | |
| 86 | +            \OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'media' => '(prefers-color-scheme: dark)', 'href' => $linkToCSS]); | |
| 87 | + } | |
| 88 | + } | |
| 89 | 89 | |
| 90 | -	private function registerInitialState(IAppContainer $container) { | |
| 91 | - /** @var IInitialStateService $initialState */ | |
| 92 | - $initialState = $container->query(IInitialStateService::class); | |
| 90 | +    private function registerInitialState(IAppContainer $container) { | |
| 91 | + /** @var IInitialStateService $initialState */ | |
| 92 | + $initialState = $container->query(IInitialStateService::class); | |
| 93 | 93 | |
| 94 | -		$initialState->provideLazyInitialState(self::APP_ID, 'data', function () use ($container) { | |
| 95 | - /** @var JSDataService $data */ | |
| 96 | - $data = $container->query(JSDataService::class); | |
| 97 | - return $data; | |
| 98 | - }); | |
| 99 | - } | |
| 94 | +        $initialState->provideLazyInitialState(self::APP_ID, 'data', function () use ($container) { | |
| 95 | + /** @var JSDataService $data */ | |
| 96 | + $data = $container->query(JSDataService::class); | |
| 97 | + return $data; | |
| 98 | + }); | |
| 99 | + } | |
| 100 | 100 | } | 
| @@ -75,14 +75,14 @@ discard block | ||
| 75 | 75 | // we want to check if any theme or font is enabled. | 
| 76 | 76 |  			if (count($userValues) > 0) { | 
| 77 | 77 |  				$hash = $config->getUserValue($loggedUser->getUID(), self::APP_ID, 'icons-css', md5(implode('-', $userValues))); | 
| 78 | - $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]); | |
| 78 | + $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID.'.accessibility.getCss', ['md5' => $hash]); | |
| 79 | 79 |  				\OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'href' => $linkToCSS]); | 
| 80 | 80 | } | 
| 81 | 81 |  		} else { | 
| 82 | 82 | $userValues = ['dark']; | 
| 83 | 83 | |
| 84 | 84 |  			$hash = md5(implode('-', $userValues)); | 
| 85 | - $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID . '.accessibility.getCss', ['md5' => $hash]); | |
| 85 | + $linkToCSS = $urlGenerator->linkToRoute(self::APP_ID.'.accessibility.getCss', ['md5' => $hash]); | |
| 86 | 86 |  			\OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'media' => '(prefers-color-scheme: dark)', 'href' => $linkToCSS]); | 
| 87 | 87 | } | 
| 88 | 88 | } | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | /** @var IInitialStateService $initialState */ | 
| 92 | 92 | $initialState = $container->query(IInitialStateService::class); | 
| 93 | 93 | |
| 94 | -		$initialState->provideLazyInitialState(self::APP_ID, 'data', function () use ($container) { | |
| 94 | +		$initialState->provideLazyInitialState(self::APP_ID, 'data', function() use ($container) { | |
| 95 | 95 | /** @var JSDataService $data */ | 
| 96 | 96 | $data = $container->query(JSDataService::class); | 
| 97 | 97 | return $data; |