summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib/Service
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-10-20 16:03:19 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2022-11-29 11:23:05 +0100
commit064fa10ecfe4725398895a21ab8bafd171e2eadd (patch)
tree5f2d8124eb131a65eac207edee560c49ea7835f3 /apps/theming/lib/Service
parentcedae7c6d74e11c8aaa59b09a38db04dbebc818d (diff)
downloadnextcloud-server-064fa10ecfe4725398895a21ab8bafd171e2eadd.tar.gz
nextcloud-server-064fa10ecfe4725398895a21ab8bafd171e2eadd.zip
Extract colour from custom background
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/theming/lib/Service')
-rw-r--r--apps/theming/lib/Service/BackgroundService.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/theming/lib/Service/BackgroundService.php b/apps/theming/lib/Service/BackgroundService.php
index 667ca99a1f9..002ca169a83 100644
--- a/apps/theming/lib/Service/BackgroundService.php
+++ b/apps/theming/lib/Service/BackgroundService.php
@@ -30,7 +30,7 @@ namespace OCA\Theming\Service;
use InvalidArgumentException;
use OC\User\NoUserException;
use OCA\Theming\AppInfo\Application;
-use OCP\Files\AppData\IAppDataFactory;
+use OCA\Theming\ThemingDefaults;
use OCP\Files\File;
use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
@@ -140,13 +140,13 @@ class BackgroundService {
private IAppData $appData;
private IConfig $config;
private string $userId;
- private IAppDataFactory $appDataFactory;
+ private ThemingDefaults $themingDefaults;
public function __construct(IRootFolder $rootFolder,
IAppData $appData,
IConfig $config,
?string $userId,
- IAppDataFactory $appDataFactory) {
+ ThemingDefaults $themingDefaults) {
if ($userId === null) {
return;
}
@@ -155,11 +155,12 @@ class BackgroundService {
$this->config = $config;
$this->userId = $userId;
$this->appData = $appData;
- $this->appDataFactory = $appDataFactory;
+ $this->themingDefaults = $themingDefaults;
}
public function setDefaultBackground(): void {
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'background_image');
+ $this->config->setUserValue($this->userId, Application::APP_ID, 'background_color', $this->themingDefaults->getDefaultColorPrimary());
}
/**
@@ -171,7 +172,7 @@ class BackgroundService {
* @throws NoUserException
*/
public function setFileBackground($path): void {
- $this->config->setUserValue($this->userId, Application::APP_ID, 'background_image', self::BACKGROUND_DEFAULT);
+ $this->config->setUserValue($this->userId, Application::APP_ID, 'background_image', self::BACKGROUND_CUSTOM);
$userFolder = $this->rootFolder->getUserFolder($this->userId);
/** @var File $file */