add config proxy
This commit is contained in:
@@ -27,11 +27,12 @@ use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
use OCP\IUserSession;
|
||||
use OCA\SideMenu\AppInfo\Application;
|
||||
use OCA\SideMenu\Service\ConfigProxy;
|
||||
|
||||
class CssController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \OCP\IConfig
|
||||
* @var ConfigProxy
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
@@ -45,7 +46,7 @@ class CssController extends Controller
|
||||
* @param IRequest $request
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct($appName, IRequest $request, IConfig $config)
|
||||
public function __construct($appName, IRequest $request, ConfigProxy $config)
|
||||
{
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
@@ -70,13 +71,13 @@ class CssController extends Controller
|
||||
|
||||
protected function getConfig(): array
|
||||
{
|
||||
$backgroundColor = $this->config->getAppValue(Application::APP_ID, 'background-color', '#333333');
|
||||
$backgroundColorTo = $this->config->getAppValue(Application::APP_ID, 'background-color-to', $backgroundColor);
|
||||
$backgroundColor = $this->config->getAppValue('background-color', '#333333');
|
||||
$backgroundColorTo = $this->config->getAppValue('background-color-to', $backgroundColor);
|
||||
|
||||
$topMenuApps = (array) json_decode($this->config->getAppValue(Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||
$topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]');
|
||||
|
||||
if ($this->user) {
|
||||
$userTopMenuApps = (array) json_decode($this->config->getUserValue($this->user->getUid(), Application::APP_ID, 'top-menu-apps', '[]'), true);
|
||||
$userTopMenuApps = $this->config->getUserValueArray($this->user, 'top-menu-apps', '[]');
|
||||
|
||||
if (!empty($userTopMenuApps)) {
|
||||
$topMenuApps = $userTopMenuApps;
|
||||
@@ -87,20 +88,20 @@ class CssController extends Controller
|
||||
'vars' => [
|
||||
'background-color' => $backgroundColor,
|
||||
'background-color-to' => $backgroundColorTo,
|
||||
'current-app-background-color' => $this->config->getAppValue(Application::APP_ID, 'current-app-background-color', '#444444'),
|
||||
'loader-color' => $this->config->getAppValue(Application::APP_ID, 'loader-color', '#0e75ac'),
|
||||
'text-color' => $this->config->getAppValue(Application::APP_ID, 'text-color', '#FFFFFF'),
|
||||
'opener' => $this->config->getAppValue(Application::APP_ID, 'opener', 'side-menu-opener'),
|
||||
'icon-invert-filter' => abs((int) $this->config->getAppValue(Application::APP_ID, 'icon-invert-filter', '0')).'%',
|
||||
'icon-opacity' => abs((int) $this->config->getAppValue(Application::APP_ID, 'icon-opacity', '100') / 100),
|
||||
'current-app-background-color' => $this->config->getAppValue('current-app-background-color', '#444444'),
|
||||
'loader-color' => $this->config->getAppValue('loader-color', '#0e75ac'),
|
||||
'text-color' => $this->config->getAppValue('text-color', '#FFFFFF'),
|
||||
'opener' => $this->config->getAppValue('opener', 'side-menu-opener'),
|
||||
'icon-invert-filter' => abs($this->config->getAppValueInt('icon-invert-filter', '0')).'%',
|
||||
'icon-opacity' => abs($this->config->getAppValueInt('icon-opacity', '100') / 100),
|
||||
],
|
||||
'display-logo' => (bool) $this->config->getAppValue(Application::APP_ID, 'display-logo', 1),
|
||||
'opener-only' => (bool) $this->config->getAppValue(Application::APP_ID, 'opener-only', 0),
|
||||
'external-sites-in-top-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'external-sites-in-top-menu', 0),
|
||||
'size-icon' => $this->config->getAppValue(Application::APP_ID, 'size-icon', 'normal'),
|
||||
'size-text' => $this->config->getAppValue(Application::APP_ID, 'size-text', 'normal'),
|
||||
'always-displayed' => (bool) $this->config->getAppValue(Application::APP_ID, 'always-displayed', '0'),
|
||||
'big-menu' => (bool) $this->config->getAppValue(Application::APP_ID, 'big-menu', '0'),
|
||||
'display-logo' => $this->config->getAppValueBool('display-logo', 1),
|
||||
'opener-only' => $this->config->getAppValueBool('opener-only', 0),
|
||||
'external-sites-in-top-menu' => $this->config->getAppValueBool('external-sites-in-top-menu', 0),
|
||||
'size-icon' => $this->config->getAppValue('size-icon', 'normal'),
|
||||
'size-text' => $this->config->getAppValue('size-text', 'normal'),
|
||||
'always-displayed' => $this->config->getAppValueBool('always-displayed', '0'),
|
||||
'big-menu' => $this->config->getAppValueBool('big-menu', '0'),
|
||||
'top-menu-apps' => $topMenuApps,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user