improved dark mode, automatic theme switch (#5720)
This commit is contained in:
@@ -10,9 +10,7 @@
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
use App\Configuration\LocaleService;
|
||||
use App\Constants;
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserPreference;
|
||||
use KevinPapst\TablerBundle\Helper\ContextHelper;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\KernelEvent;
|
||||
@@ -46,8 +44,6 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$this->helper->setAssetVersion((string) Constants::VERSION_ID);
|
||||
|
||||
if ($this->localeService->isRightToLeft($event->getRequest()->getLocale())) {
|
||||
$this->helper->setIsRightToLeft(true);
|
||||
}
|
||||
@@ -63,9 +59,14 @@ final class ThemeOptionsSubscriber implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$skin = $user->getPreferenceValue(UserPreference::SKIN);
|
||||
$skin = $user->getSkin();
|
||||
if ($skin === 'dark') {
|
||||
$this->helper->setIsDarkMode(true);
|
||||
} elseif ($skin === 'auto') {
|
||||
$this->helper->setThemeAuto(true);
|
||||
} else {
|
||||
$this->helper->setIsDarkMode(false);
|
||||
$this->helper->setThemeAuto(false);
|
||||
}
|
||||
|
||||
// do not allow boxed layout, header is not compatible and other functions need the full size as well
|
||||
|
||||
Reference in New Issue
Block a user