Welcome to mirror list, hosted at ThFree Co, Russian Federation.

InitialStateProvider.php « Service « lib - github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3acd782b8e3767e31e348cfb064b79a5c066651e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

namespace OCA\Text\Service;

use OCP\AppFramework\Services\IInitialState;

class InitialStateProvider {
	private IInitialState $initialState;
	private ConfigService $configService;
	private ?string $userId;

	public function __construct(IInitialState $initialState, ConfigService $configService, ?string $userId) {
		$this->initialState = $initialState;
		$this->configService = $configService;
		$this->userId = $userId;
	}

	public function provideState(): void {
		$this->initialState->provideInitialState(
			'workspace_available',
			$this->configService->isRichWorkspaceAvailable()
		);

		$this->initialState->provideInitialState(
			'workspace_enabled',
			$this->configService->isRichWorkspaceEnabledForUser($this->userId)
		);

		$this->initialState->provideInitialState(
			'default_file_extension',
			$this->configService->getDefaultFileExtension()
		);

		$this->initialState->provideInitialState(
			'rich_editing_enabled',
			$this->configService->isRichEditingEnabled()
		);
	}
}