|
|
|
@ -27,10 +27,12 @@ namespace OCA\Accessibility\Settings; |
|
|
|
|
use OCA\Accessibility\AccessibilityProvider; |
|
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
|
|
|
|
use OCP\IConfig; |
|
|
|
|
use OCP\IInitialStateService; |
|
|
|
|
use OCP\IL10N; |
|
|
|
|
use OCP\IURLGenerator; |
|
|
|
|
use OCP\IUserSession; |
|
|
|
|
use OCP\Settings\ISettings; |
|
|
|
|
use OCP\Util; |
|
|
|
|
|
|
|
|
|
class Personal implements ISettings { |
|
|
|
|
|
|
|
|
@ -52,6 +54,9 @@ class Personal implements ISettings { |
|
|
|
|
/** @var AccessibilityProvider */ |
|
|
|
|
private $accessibilityProvider; |
|
|
|
|
|
|
|
|
|
/** @var IInitialStateService */ |
|
|
|
|
private $initialStateService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Settings constructor. |
|
|
|
|
* |
|
|
|
@ -67,13 +72,15 @@ class Personal implements ISettings { |
|
|
|
|
IUserSession $userSession, |
|
|
|
|
IL10N $l, |
|
|
|
|
IURLGenerator $urlGenerator, |
|
|
|
|
AccessibilityProvider $accessibilityProvider) { |
|
|
|
|
AccessibilityProvider $accessibilityProvider, |
|
|
|
|
IInitialStateService $initialStateService) { |
|
|
|
|
$this->appName = $appName; |
|
|
|
|
$this->config = $config; |
|
|
|
|
$this->userSession = $userSession; |
|
|
|
|
$this->l = $l; |
|
|
|
|
$this->urlGenerator = $urlGenerator; |
|
|
|
|
$this->accessibilityProvider = $accessibilityProvider; |
|
|
|
|
$this->initialStateService = $initialStateService; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -81,19 +88,25 @@ class Personal implements ISettings { |
|
|
|
|
* @since 9.1 |
|
|
|
|
*/ |
|
|
|
|
public function getForm() { |
|
|
|
|
Util::addScript('accessibility', 'accessibility'); |
|
|
|
|
Util::addStyle('accessibility', 'style'); |
|
|
|
|
|
|
|
|
|
$serverData = [ |
|
|
|
|
$availableConfig = [ |
|
|
|
|
'themes' => $this->accessibilityProvider->getThemes(), |
|
|
|
|
'fonts' => $this->accessibilityProvider->getFonts(), |
|
|
|
|
'highcontrast' => $this->accessibilityProvider->getHighContrast(), |
|
|
|
|
'selected' => [ |
|
|
|
|
'highcontrast' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'highcontrast', false), |
|
|
|
|
'theme' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false), |
|
|
|
|
'font' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false) |
|
|
|
|
] |
|
|
|
|
'highcontrast' => $this->accessibilityProvider->getHighContrast() |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
$userConfig = [ |
|
|
|
|
'highcontrast' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'highcontrast', false), |
|
|
|
|
'theme' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false), |
|
|
|
|
'font' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false) |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
return new TemplateResponse($this->appName, 'settings-personal', ['serverData' => $serverData]); |
|
|
|
|
$this->initialStateService->provideInitialState($this->appName, 'available-config', $availableConfig); |
|
|
|
|
$this->initialStateService->provideInitialState($this->appName, 'user-config', $userConfig); |
|
|
|
|
|
|
|
|
|
return new TemplateResponse($this->appName, 'settings-personal'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|