Initial settings that allow to choose the default color of the notes.

This commit is contained in:
Matias De lellis
2020-06-16 22:56:34 -03:00
parent 8c6b0a2392
commit dd534e1f1b
10 changed files with 279 additions and 19 deletions

View File

@@ -52,6 +52,7 @@ class NoteService {
private $attachMapper;
private $tagmapper;
private $fileService;
private $settingsService;
public function __construct(NoteMapper $notemapper,
NoteTagMapper $notetagmapper,
@@ -59,7 +60,8 @@ class NoteService {
ColorMapper $colormapper,
AttachMapper $attachMapper,
TagMapper $tagmapper,
FileService $fileService)
FileService $fileService,
SettingsService $settingsService)
{
$this->notemapper = $notemapper;
$this->notetagmapper = $notetagmapper;
@@ -68,6 +70,7 @@ class NoteService {
$this->attachMapper = $attachMapper;
$this->tagmapper = $tagmapper;
$this->fileService = $fileService;
$this->settingsService = $settingsService;
}
/**
@@ -154,7 +157,11 @@ class NoteService {
* @param string $content
* @param string $color
*/
public function create(string $userId, string $title, string $content, string $color = "#F7EB96"): Note {
public function create(string $userId, string $title, string $content, string $color = NULL): Note {
if (is_null($color)) {
$color = $this->settingsService->getColorForNewNotes();
}
// Get color or append it
if ($this->colormapper->colorExists($color)) {
$hcolor = $this->colormapper->findByColor($color);