aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/theming/lib/Themes/CommonThemeTrait.php2
-rw-r--r--apps/theming/lib/Util.php16
-rw-r--r--apps/theming/tests/CapabilitiesTest.php3
-rw-r--r--apps/theming/tests/IconBuilderTest.php2
-rw-r--r--apps/theming/tests/Themes/DefaultThemeTest.php3
-rw-r--r--apps/theming/tests/Themes/DyslexiaFontTest.php5
-rw-r--r--apps/theming/tests/UtilTest.php6
7 files changed, 22 insertions, 15 deletions
diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php
index 620c40199db..360c335fc7d 100644
--- a/apps/theming/lib/Themes/CommonThemeTrait.php
+++ b/apps/theming/lib/Themes/CommonThemeTrait.php
@@ -84,7 +84,7 @@ trait CommonThemeTrait {
protected function generateGlobalBackgroundVariables(): array {
$user = $this->userSession->getUser();
$backgroundDeleted = $this->config->getAppValue(Application::APP_ID, 'backgroundMime', '') === 'backgroundColor';
- $hasCustomLogoHeader = $this->imageManager->hasImage('logo') || $this->imageManager->hasImage('logoheader');
+ $hasCustomLogoHeader = $this->util->isLogoThemed();
$variables = [];
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index 9a00bd1d5b1..5ae2910f73d 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -41,18 +41,13 @@ class Util {
private IConfig $config;
private IAppManager $appManager;
private IAppData $appData;
+ private ImageManager $imageManager;
- /**
- * Util constructor.
- *
- * @param IConfig $config
- * @param IAppManager $appManager
- * @param IAppData $appData
- */
- public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData) {
+ public function __construct(IConfig $config, IAppManager $appManager, IAppData $appData, ImageManager $imageManager) {
$this->config = $config;
$this->appManager = $appManager;
$this->appData = $appData;
+ $this->imageManager = $imageManager;
}
/**
@@ -266,4 +261,9 @@ class Util {
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', '');
return $backgroundLogo !== '' && $backgroundLogo !== 'backgroundColor';
}
+
+ public function isLogoThemed() {
+ return $this->imageManager->hasImage('logo')
+ || $this->imageManager->hasImage('logoheader');
+ }
}
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php
index 41a4a6aa981..1de439a70e9 100644
--- a/apps/theming/tests/CapabilitiesTest.php
+++ b/apps/theming/tests/CapabilitiesTest.php
@@ -29,6 +29,7 @@
namespace OCA\Theming\Tests;
use OCA\Theming\Capabilities;
+use OCA\Theming\ImageManager;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
use OCP\App\IAppManager;
@@ -173,7 +174,7 @@ class CapabilitiesTest extends TestCase {
->method('getTextColorPrimary')
->willReturn($textColor);
- $util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class));
+ $util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class), $this->createMock(ImageManager::class));
$this->util->expects($this->exactly(3))
->method('elementColor')
->with($color)
diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php
index f4ad5bef4ac..6edd6a05525 100644
--- a/apps/theming/tests/IconBuilderTest.php
+++ b/apps/theming/tests/IconBuilderTest.php
@@ -63,7 +63,7 @@ class IconBuilderTest extends TestCase {
$this->themingDefaults = $this->createMock(ThemingDefaults::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->imageManager = $this->createMock(ImageManager::class);
- $this->util = new Util($this->config, $this->appManager, $this->appData);
+ $this->util = new Util($this->config, $this->appManager, $this->appData, $this->imageManager);
$this->iconBuilder = new IconBuilder($this->themingDefaults, $this->util, $this->imageManager);
}
diff --git a/apps/theming/tests/Themes/DefaultThemeTest.php b/apps/theming/tests/Themes/DefaultThemeTest.php
index 73e5b14683a..4471dddb01e 100644
--- a/apps/theming/tests/Themes/DefaultThemeTest.php
+++ b/apps/theming/tests/Themes/DefaultThemeTest.php
@@ -66,7 +66,8 @@ class DefaultThemeTest extends TestCase {
$util = new Util(
$this->config,
$this->appManager,
- $this->createMock(IAppData::class)
+ $this->createMock(IAppData::class),
+ $this->imageManager
);
$this->themingDefaults
diff --git a/apps/theming/tests/Themes/DyslexiaFontTest.php b/apps/theming/tests/Themes/DyslexiaFontTest.php
index 3e92d03e473..4714d9751f4 100644
--- a/apps/theming/tests/Themes/DyslexiaFontTest.php
+++ b/apps/theming/tests/Themes/DyslexiaFontTest.php
@@ -68,8 +68,9 @@ class DyslexiaFontTest extends TestCase {
$util = new Util(
$this->config,
- $this->createMock(AppManager::class),
- $this->createMock(IAppData::class)
+ $this->appManager,
+ $this->createMock(IAppData::class),
+ $this->imageManager
);
$userSession = $this->createMock(IUserSession::class);
diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php
index 914ad8b073f..8f6d972a2fc 100644
--- a/apps/theming/tests/UtilTest.php
+++ b/apps/theming/tests/UtilTest.php
@@ -27,6 +27,7 @@
*/
namespace OCA\Theming\Tests;
+use OCA\Theming\ImageManager;
use OCA\Theming\Util;
use OCP\App\IAppManager;
use OCP\Files\IAppData;
@@ -46,13 +47,16 @@ class UtilTest extends TestCase {
protected $appData;
/** @var IAppManager */
protected $appManager;
+ /** @var ImageManager */
+ protected $imageManager;
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->appData = $this->createMock(IAppData::class);
$this->appManager = $this->createMock(IAppManager::class);
- $this->util = new Util($this->config, $this->appManager, $this->appData);
+ $this->imageManager = $this->createMock(ImageManager::class);
+ $this->util = new Util($this->config, $this->appManager, $this->appData, $this->imageManager);
}
public function dataInvertTextColor() {